Hi,

No long ago I have posted on this mailing list my wrapper of CUFFT in ctypes. The wrapper works fine with GPUArray with no problem and gives the correct output. But whenever I exit Python, I've got the following error message:

PyCUDA WARNING: a clean-up operation failed (dead context maybe?)
cuCtxDestroy failed: invalid value

I have attached a minimal example leading to this error. Basically, I just initialize PyCUDA, create a CUFFT plan, then destroy the plan and exit. Does anyone knows how to get rid of that error message, or is it ok to ignore this error?

Daniel
import ctypes
from ctypes import c_uint, c_int, c_float, POINTER, cast, Structure, byref

#####################
# Wrappers to CUFFT #
#####################

import platform
if platform.system()=='Microsoft': libcufft = ctypes.windll.LoadLibrary('cufft.dll')
if platform.system()=='Darwin':    libcufft = ctypes.cdll.LoadLibrary('/usr/local/cuda/lib/libcufft.dylib')
if platform.system()=='Linux':     libcufft = ctypes.cdll.LoadLibrary('libcufft.so')
else:                              libcufft = ctypes.cdll.LoadLibrary('libcufft.so')

cufftResult = c_int
cufftHandle = c_uint
cufftType = c_int

cufftPlan1d = libcufft.cufftPlan1d
cufftPlan1d.restype = cufftResult
cufftPlan1d.argtypes = [POINTER(cufftHandle), c_int, cufftType, c_int]
cufftPlan1d.__doc__ = """cufftResult cufftPlan1d(cufftHandle * plan, int nx, cufftType type, int batch)"""

cufftDestroy = libcufft.cufftDestroy
cufftDestroy.restype = cufftResult
cufftDestroy.argtypes = [cufftHandle]
cufftDestroy.__doc__ = """cufftResult cufftDestroy(cufftHandle plan)"""

CUFFT_R2C = 0x2a     # Real to Complex (interleaved)
CUFFT_C2R = 0x2c     # Complex (interleaved) to Real
CUFFT_C2C = 0x29     # Complex to Complex, interleaved
CUFFT_D2Z = 0x6a     # Double to Double-Complex
CUFFT_Z2D = 0x6c     # Double-Complex to Double
CUFFT_Z2Z = 0x69     # Double-Complex to Double-Complex

###########
# Testing #
###########
import pycuda.autoinit
plan = cufftHandle()
cufftPlan1d(byref(plan), 4, CUFFT_C2C, 0)
cufftDestroy(plan)
_______________________________________________
PyCUDA mailing list
[email protected]
http://tiker.net/mailman/listinfo/pycuda_tiker.net

Reply via email to