8#ifndef GRID_DIST_ID_KERNELS_CUH_
9#define GRID_DIST_ID_KERNELS_CUH_
15template<
unsigned int dim>
42 return wthr.x * wthr.y * wthr.z;
46#define GRID_ID_3_GLOBAL(ite_gpu) grid_key_dx<3,int> key;\
47 grid_key_dx<3,int> keyg;\
48 key.set_d(0,threadIdx.x + blockIdx.x * blockDim.x + ite_gpu.start.get(0));\
49 key.set_d(1,threadIdx.y + blockIdx.y * blockDim.y + ite_gpu.start.get(1));\
50 key.set_d(2,threadIdx.z + blockIdx.z * blockDim.z + ite_gpu.start.get(2));\
52 bool inactive = false;\
54 keyg.set_d(0,key.get(0) + ite_gpu.origin.get(0));\
55 keyg.set_d(1,key.get(1) + ite_gpu.origin.get(1));\
56 keyg.set_d(2,key.get(2) + ite_gpu.origin.get(2));\
58 if (key.get(0) > ite_gpu.stop.get(0) || key.get(1) > ite_gpu.stop.get(1) || key.get(2) > ite_gpu.stop.get(2))\
62#define GRID_ID_2_GLOBAL(ite_gpu) grid_key_dx<2,int> key;\
63 grid_key_dx<2,int> keyg;\
64 key.set_d(0,threadIdx.x + blockIdx.x * blockDim.x + ite_gpu.start.get(0));\
65 key.set_d(1,threadIdx.y + blockIdx.y * blockDim.y + ite_gpu.start.get(1));\
67 bool inactive = false;\
69 keyg.set_d(0,key.get(0) + ite_gpu.origin.get(0));\
70 keyg.set_d(1,key.get(1) + ite_gpu.origin.get(1));\
72 if (key.get(0) > ite_gpu.stop.get(0) || key.get(1) > ite_gpu.stop.get(1))\
77template<
typename grid_type,
typename ite_gpu_type,
typename func_t,
typename ... args_t>
78__global__
void grid_apply_functor(
grid_type g, ite_gpu_type ite, func_t f, args_t ... args)
83template<
typename grid_type,
typename ite_gpu_type,
typename func_t,
typename ... args_t>
84__global__
void grid_apply_functor_shared_bool(
grid_type g, ite_gpu_type ite, func_t f, args_t ... args)
86 __shared__
bool is_empty_block;
88 f(g,ite,is_empty_block,args...);
This is a distributed grid.
grid_key_dx is the key to access any element in the grid