I would like to use the MersenneTwister routine in CUDA1.1 sample code as the random number generator for my MonteCarlo calculation. I added the following “printf” lines for checking the validity of this code;
for(i = 0; i < MT_RNG_COUNT; i++)
for(j = 0; j < N_PER_RNG; j++){
rCPU = h_RandCPU[i * N_PER_RNG + j];
rGPU = h_RandGPU[i + j * MT_RNG_COUNT];
delta = fabs(rCPU - rGPU);
/*-----------------------------------------------------------------------------------*/
printf("%i \t %+10.8e \t %i \t %+10.8e \t %+10.8e\n",
i + j * MT_RNG_COUNT, rGPU,
i * N_PER_RNG + j, rCPU,
delta);
/*----------------------------------------------------------------------------------*/
sum_delta += delta;
sum_ref += fabs(rCPU);
if(delta >= max_delta) max_delta = delta;
}
This “for” block is from (about) 188 lines of the MersenneTwister.cu.
After generating the (131072=4096*32) random numbers, I put the points on the 3rd column (index of number) vs 2nd column (random number) plane by using gnuplot. I can see a few lines (bias of tone, shade) in the figures. I also draw the numbers on the 1st column (index of random number) vs 2nd column (random number) plane for the cross check. I also find the horizontal bars in a few regions.
I changed the seed or the sample numbers of the random numbers, but this feature is not changed.
Is this result correct for this code ? Or am I wrong ??
#the sample code says “TEST PASSED”, anyway.
If this is correct result, I cannot use this code for my calculation.
Please give your suggestion.