pycuda._driver.LogicError: cuMemAlloc failed: context is destroyed
(caused by scikit-cuda or even CUDA itself?)
#356
-
Running the following in a clean python context throws import pycuda.autoinit
import numpy as np
import pycuda
import skcuda
import skcuda.fft as cufft
plan = cufft.Plan((2,2), np.complex64, np.complex64)
del plan # equivalent to `skcuda.cufft.cufftDestroy(plan.handle)`
#skcuda.cufft.cufftDestroy(plan.handle) # equivalent to `del plan`
pycuda.gpuarray.empty((2,2), np.float32) Deleting the FFT plan in scikit-cuda destroys the pycuda context. This happens no matter if you use As long as (See also my stackoverflow question: https://stackoverflow.com/questions/72218532/deleting-an-fft-plan-in-scikit-cuda-destroys-the-pycuda-context.) My system:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
By using https://documen.tician.de/pycuda/driver.html#pycuda.driver.Device.retain_primary_context |
Beta Was this translation helpful? Give feedback.
By using
pycuda.autoinit
, you're putting pycuda in charge of context management. That's not typically a good recipe for interacting with libraries that use the CUDA runtime API (like cuFFT, to my understanding). You might be better off retaining the "primary context" made by/for the runtime API and using that instead:https://documen.tician.de/pycuda/driver.html#pycuda.driver.Device.retain_primary_context