cupy: AttributeError: 'NoneType' object has no attribute 'record'
CuPy Version : 7.3.0 CUDA Root : /usr/local/cuda CUDA Build Version : 10020 CUDA Driver Version : 10020 CUDA Runtime Version : 10020 cuBLAS Version : 10202 cuFFT Version : 10102 cuRAND Version : 10102 cuSOLVER Version : (10, 3, 0) cuSPARSE Version : 10301 NVRTC Version : (10, 2) cuDNN Build Version : 7605 cuDNN Version : 7605 NCCL Build Version : 2406 NCCL Runtime Version : 2507
If I try to run the following command, I get the following error.
cp.asarray(z[cp.newaxis, :, :])
Traceback (most recent call last):
File "kalman.py", line 125, in <module>
z = cp.asarray(z[cp.newaxis, :, :])
File "/home/belt/anaconda3/envs/cusignal/lib/python3.8/site-packages/cupy/creation/from_data.py", line 68, in asarray
return core.array(a, dtype, False, order)
File "cupy/core/core.pyx", line 1785, in cupy.core.core.array
File "cupy/core/core.pyx", line 1862, in cupy.core.core.array
File "cupy/core/core.pyx", line 1950, in cupy.core.core._send_object_to_gpu
AttributeError: 'NoneType' object has no attribute 'record'
What’s interesting is that it only happens after a run a CuPy kernel. One which doesn’t even access variable z.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 22 (22 by maintainers)
Commits related to this issue
- Update stream usage per takagi's suggestions in https://github.com/cupy/cupy/issues/3316 — committed to mnicely/cusignal by mnicely 4 years ago
I mean CuPy’s
Streamobjects at the following lines:https://github.com/mnicely/cusignal/blob/a366bb66fb56357d98e77276ba9d031c347febb8/python/cusignal/estimation/filters.py#L150
https://github.com/mnicely/cusignal/blob/a366bb66fb56357d98e77276ba9d031c347febb8/python/cusignal/estimation/filters.py#L160
but, sorry, I misunderstood that these objects are actually referenced by
_cupy_predict_wrapperand_cupy_update_wrapperso it’s not the cause.The actual cause is that, in a previous loop, a
KalmanFilterinstance’s CuPyStreamis left beingused and, in the next loop, it is collected when anotherKalmanFilterinstance is assigned, eventually the CuPy current stream becomesNonewith a dead weak reference.I’ve confirmed that
withstatement for temporaryStreamuse eliminates the error:@takagi I believe I made the appropriate changes. Can you try now?
Thanks @takagi! This is great to understand. It looks like I need to update our library to issue we don’t see this issue again.
I thought I got around but I’m hitting it again. I’m trying to run a loop and it crashes on the first
cp.asarrayof the second loop (that uses CuPy raw kernels). The Numba kernels have no issues.See my latest script. kalman_test_script.txt
It this case the error is
Sorry, I don’t have a better minimal example at the moment.