#!/usr/bin/python # -*- coding: utf-8 -*- # XXX # -- # Code forked from python-cuda-2.0_42 © Arno Pähler, 2007-08 # -- from cufft_defs import * from cuda.utils import libutils cufft = libutils.get_lib("cufft", RTLD_GLOBAL) # cufftResult CUFFTAPI cufftPlan1d(cufftHandle *plan, # int nx, # cufftType type, # int batch); cufftPlan1d = cufft.cufftPlan1d cufftPlan1d.restype = cufftResult cufftPlan1d.argtypes = [cufftHandle_p, c_int, cufftType, c_int] # cufftResult CUFFTAPI cufftPlan2d(cufftHandle *plan, # int nx, int ny, # cufftType type); cufftPlan2d = cufft.cufftPlan2d cufftPlan2d.restype = cufftResult cufftPlan2d.argtypes = [cufftHandle_p, c_int, c_int, cufftType] # cufftResult CUFFTAPI cufftPlan3d(cufftHandle *plan, # int nx, int ny, int nz, # cufftType type);
#!/usr/bin/python # -*- coding: utf-8 -*- # XXX # -- # Code forked from python-cuda-2.0_42 © Arno Pähler, 2007-08 # -- from cu_defs import * from cuda.utils import libutils cu = libutils.get_lib("cuda", RTLD_GLOBAL) class cuException(Exception): pass # from file: cuda.h # /********************************* # ** Initialization # *********************************/ # CUresult cuInit(unsigned int Flags); cuInit = cu.cuInit cuInit.restype = CUresult cuInit.argtypes = [ c_uint ] # /************************************ # ** # ** Device management # ** # ***********************************/ #
#!/usr/bin/python # -*- coding: utf-8 -*- # XXX # -- # Code forked from python-cuda-2.0_42 © Arno Pähler, 2007-08 # -- from cuda_defs import * from cuda.utils import libutils cudart = libutils.get_lib("cudart", RTLD_GLOBAL) class cudaException(Exception): pass #cudaError_t cudaMalloc3D(struct cudaPitchedPtr* pitchDevPtr, # struct cudaExtent extent); cudaMalloc3D = cudart.cudaMalloc3D cudaMalloc3D.restype = cudaError_t cudaMalloc3D.argtypes = [ POINTER(cudaPitchedPtr), cudaExtent ] #cudaError_t cudaMalloc3DArray(struct cudaArray** arrayPtr, # const struct cudaChannelFormatDesc* desc, struct cudaExtent extent); cudaMalloc3DArray = cudart.cudaMalloc3DArray cudaMalloc3DArray.restype = cudaError_t cudaMalloc3DArray.argtypes = [ POINTER(cudaArray_p), POINTER(cudaChannelFormatDesc), cudaExtent ] #cudaError_t cudaMemset3D(struct cudaPitchedPtr pitchDevPtr, # int value, struct cudaExtent extent);
#!/usr/bin/python # -*- coding: utf-8 -*- # XXX # -- # Code forked from python-cuda-2.0_42 © Arno Pähler, 2007-08 # -- from cufft_defs import * from cuda.utils import libutils cufft = libutils.get_lib("cufft", RTLD_GLOBAL) #cufftResult CUFFTAPI cufftPlan1d(cufftHandle *plan, # int nx, # cufftType type, # int batch); cufftPlan1d = cufft.cufftPlan1d cufftPlan1d.restype = cufftResult cufftPlan1d.argtypes = [cufftHandle_p, c_int, cufftType, c_int] #cufftResult CUFFTAPI cufftPlan2d(cufftHandle *plan, # int nx, int ny, # cufftType type); cufftPlan2d = cufft.cufftPlan2d cufftPlan2d.restype = cufftResult cufftPlan2d.argtypes = [cufftHandle_p, c_int, c_int, cufftType] #cufftResult CUFFTAPI cufftPlan3d(cufftHandle *plan, # int nx, int ny, int nz, # cufftType type);
#!/usr/bin/python # -*- coding: utf-8 -*- # XXX # -- # Code forked from python-cuda-2.0_42 © Arno Pähler, 2007-08 # -- from cublas_defs import * from cuda.utils import libutils cublas = libutils.get_lib("cublas", RTLD_GLOBAL) # from Arno ## Loading the library below causes a Segmentation fault ## upon exit - functionality itself is not affected ## This is a known bug in cleanup - see NVIDIA CUDA forum ##/* CUBLAS helper functions */ ## ##cublasStatus cublasInit (void); ##cublasStatus cublasShutdown (void); ##cublasStatus cublasGetError (void); ##cublasStatus cublasAlloc (int n, int elemSize, void **devicePtr); ##cublasStatus cublasFree (const void *devicePtr); cublasInit = cublas.cublasInit cublasInit.restype = cublasStatus cublasInit.argtypes = None cublasShutdown = cublas.cublasShutdown cublasShutdown.restype = cublasStatus