I would like to use pycuda and the FFT functions from scikit-cuda together. The code below
- creates a
skcuda.fft.Plan
, - deletes that plan and then
- tries to allocate a
pycuda.gpuarray.GPUArray
.
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)
The last line throws pycuda._driver.LogicError: cuMemAlloc failed: context is destroyed
.
Somehow, skcuda.cufft.cufftDestroy(plan.handle)
also destroys the pycuda context (which is of type pycuda._driver.Context
).
Can somebody see a good fix?