public static void generate_kernel(GThread thread, RandStateXORWOW[] state, int[] result) { int id = thread.threadIdx.x + thread.blockIdx .x * 64; int count = 0; uint x = 0; /* Copy state to local memory for efficiency */ RandStateXORWOW localState = state[id]; /* Generate pseudo - random unsigned ints */ for (int n = 0; n < 100000; n++) { x = thread.curand(ref localState); /* Check if low bit set */ if ((x & 1) == 1) { count++; } } /* Copy state back to global memory */ state[id] = localState; /* Store results */ result[id] += count; }
// __device__ unsigned int curand (curandStateXORWOW_t state) public static uint curand(this GThread thread, ref RandStateXORWOW state) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "curand"); }
public static void skipahead_sequence(this GThread thread, ulong n, ref RandStateXORWOW state) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "skipahead_sequence"); }
//__device__ oat curand_uniform (curandStateXORWOW_t state) public static double curand_uniform_double(this GThread thread, ref RandStateXORWOW state) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "curand_uniform_double"); }
//__device__ oat curand_normal (curandStateXORWOW_t state) public static float curand_normal(this GThread thread, ref RandStateXORWOW state) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "curand_normal"); }
//__device__ double curand_log_normal_double (curandStateXORWOW_t //state, double mean, double stddev) public static float curand_log_normal_double(this GThread thread, ref RandStateXORWOW state, double mean, double stddev) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "curand_log_normal"); }
//__device__ void curand_init (unsigned long long seed, unsigned long long //subsequence, unsigned long long offset, curandStateXORWOW_t state) public static void curand_init(this GThread thread, ulong seed, ulong subsequence, ulong offset, ref RandStateXORWOW state) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "curand_init"); }
// __device__ unsigned int curand (curandStateXORWOW_t state) public static uint curand(this GThread thread, ref RandStateXORWOW state) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "curand"); }
public static void setup_kernel(GThread thread, RandStateXORWOW[] state) { int id = thread.threadIdx.x + thread.blockIdx.x * 64; thread.curand_init(1234, (ulong)id, 0, ref state[id]); }
public static void skipahead_sequence(this GThread thread, ulong n, ref RandStateXORWOW state) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "skipahead_sequence"); }
//__device__ oat curand_uniform (curandStateXORWOW_t state) public static double curand_uniform_double(this GThread thread, ref RandStateXORWOW state) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "curand_uniform_double"); }
//__device__ oat curand_normal (curandStateXORWOW_t state) public static float curand_normal(this GThread thread, ref RandStateXORWOW state) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "curand_normal"); }
//__device__ double curand_log_normal_double (curandStateXORWOW_t //state, double mean, double stddev) public static float curand_log_normal_double(this GThread thread, ref RandStateXORWOW state, double mean, double stddev) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "curand_log_normal"); }
//__device__ void curand_init (unsigned long long seed, unsigned long long //subsequence, unsigned long long offset, curandStateXORWOW_t state) public static void curand_init(this GThread thread, ulong seed, ulong subsequence, ulong offset, ref RandStateXORWOW state) { throw new CudafyException(CudafyException.csX_NOT_SUPPORTED, "curand_init"); }