-
Notifications
You must be signed in to change notification settings - Fork 1
/
slcuda.h
38 lines (33 loc) · 911 Bytes
/
slcuda.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <cuda.h>
#include <curand.h>
#define CUDA_FORCE 100
#define THREADIDX_X blockIdx.x * blockDim.x + threadIdx.x;
#define THREADIDX_Y blockIdy.y * blockDim.y + threadIdy.y;
#define THREADIDX_Z blockIdz.z * blockDim.z + threadIdz.z;
#define THREADIDX blockIdx.z*(gridDim.x*gridDim.y)+\
(blockIdx.y*blockDim.y+threadIdx.y)*blockDim.x*gridDim.x+\
threadIdx.x+blockDim.x*blockIdx.x
int SLCUDA_BLOCK_SIZE;
int SLcuda_Type_Id;
typedef struct
{
int devid;
int ndims;
unsigned long nelems;
unsigned long size;
int valid;
int type;
SLindex_Type dims[3];
void *dptr;
}
SLcuda_Type;
int SLcurand_Type_Id;
typedef struct
{
curandGenerator_t gen;
}
SLcurand_Type;
void slcuda_compute_dims2d(int N, int bsize, int *dx, int *dy);
SLcuda_Type *slcuda_init_cuda(unsigned long size, SLtype type, int ndims, int *dims);
SLcuda_Type *slcuda_pop_cuda(void);
int slcuda_push_cuda(SLcuda_Type *cuda);