I forgot to attach the test code in my last email. Here it is.

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 #
###########
# plan = cufftHandle()
# cufftPlan1d(byref(plan), 0, CUFFT_R2C, 0)
# cufftDestroy(plan)

# import pycuda.autoinit
# from pycuda.autoinit import context
import pycuda.driver as drv
drv.init()
import pycuda.tools as t

d=t.get_default_device()

d =t.get_default_device()
c1 = d.make_context()
c2 = d.make_context()
# c2.synchronize()

# c2.pop()
# c1.pop()
# c1.detach()
# c2.detach()

c2.synchronize()

plan = cufftHandle()
cufftPlan1d(byref(plan), 8, CUFFT_C2C, 0)
# cufftDestroy(plan)

c2.synchronize()

# c2.detach()
c2.pop()
# c2.push() # This will give an error

c1.pop()
c1.push()
_______________________________________________
PyCUDA mailing list
[email protected]
http://tiker.net/mailman/listinfo/pycuda_tiker.net

Reply via email to