Hello everyone.
I am facing a strange error with the curand library.
I generate random numbers for each of my threads, each thread having its own state.
init code :
__global__ void initRandomGpu(unsigned int seed, curandStateXORWOW_t* states,int nbrColloides)
{
const int idx = blockDim.x * blockIdx.x + threadIdx.x;
if(idx<nbrColloides)
curand_init(seed,idx,0,&states[idx]);
}
and number generation
__global__ void randomForces(curandStateXORWOW_t* states...)
{
const int idx = blockDim.x * blockIdx.x + threadIdx.x;
if(idx<cfg->nbrColloides)
{
glm::dvec3 tmp = glm::dvec3(curand_normal(&states[idx]),curand_normal(&states[idx]),curand_normal(&states[idx]));
// do something with it ...
This code works for a few thousand threads but when you reach a certain number of threads (aka 50000) several thousand threads generate exactly the same values.
What did I miss?