$search
00001 #ifndef CUDA_COMMON_H 00002 #define CUDA_COMMON_H 00003 00005 00006 #define dxDeviceContext cudaStream_t 00007 #define dxDeviceQueue cudaStream_t 00008 #define dxParallelInfF CUDART_INF_F 00009 #define dxParallelInfD CUDART_INF 00010 #define dxOverload 00011 #define dxDevice __device__ 00012 #define dxHost __host__ 00013 #define dxDeviceData 00014 #define dxConstant __constant__ 00015 #define dxParams params 00016 #define dxGlobal __global__ 00017 #define dxShared __shared__ 00018 #define dxSyncthreads() __syncthreads() 00019 00020 #define dxBlockIdx blockIdx 00021 #define dxBlockDim blockDim 00022 #define dxThreadIdx threadIdx 00023 #define dxGridDimX() gridDim.x 00024 #define dxBlockIdxX() blockIdx.x 00025 #define dxBlockDimX() blockDim.x 00026 #define dxThreadIdxX() threadIdx.x 00027 #define dxGlobalOffsetX() 0 00028 #define dxGlobalIdxX() (dxBlockIdxX() * dxBlockDimX() + dxThreadIdxX()) 00029 00030 #define dxBlockIdxY() blockIdx.y 00031 #define dxBlockDimY() blockDim.y 00032 #define dxThreadIdxY() threadIdx.y 00033 #define dxGlobalOffsetY() 0 00034 #define dxGlobalIdxY() (dxBlockIdxY() * dxBlockDimY() + dxThreadIdxY()) 00035 #define dxExecKernel(numb, numt, kfunc, args) kfunc<<<numb, numt>>>args 00036 00038 00039 // Note: For the CUDA runtime API, we have no notion of a context, these are just placeholders 00040 static dxDeviceContext sDeviceContext = 0; 00041 static dxDeviceQueue sDeviceQueue = 0; 00042 00044 00045 inline dxDeviceContext dxGetDeviceContext( ) { return sDeviceContext; } 00046 inline dxDeviceQueue dxGetDeviceQueue( ) { return sDeviceQueue; } 00047 inline void dxGlobalSync() { cudaThreadSynchronize(); } 00048 inline void dxInitDevice() { cudaFree(0); } 00049 inline void dxShutdownDevice() { cudaThreadExit(); } 00050 00051 #endif