I can’t use curandSetPseudoRandomGeneratorSeed with curandGenerateLongLong:
int n = 10;
unsigned long long *randomKeys;
curandGenerator_t gen;
cudaMalloc(&randomKeys, n*sizeof(unsigned long long));
curandCreateGenerator(&gen, curandRngType_t::CURAND_RNG_QUASI_SCRAMBLED_SOBOL64);
curandGenerateLongLong(gen, randomKeys, n);
How can I seed the curandGenerateLongLong, because it gives me the same numbers every time I run it.
If I run the app for the 1st time (with the mentioned codes/setup), it prints for instance 1.
For the 2nd time, it prints 1 too. so it’s completely predictable and needs a mechanism to seed it.
hence, if you start ‘recording’ from ‘result’ 0 the 1st time, and from ‘result’ n the nth time,
result[0] != result[n]
i think the case is common for all random generators - host or device
i doubt whether random generators make provision for iteration; i would consider your case as informally iterating
a simple solution is to offset the ‘start’
curand has a record that is passed to it; can you not offset the start or count there?
if not, manually offset the count/ start
in essence, let the random generator ‘idle’/ run for a while before recording and using the output
as illustration, on the host, not to have the same output each time, have the start as a random number itself
int lint1, lint2;
lint1 = rand();
lint2 = 0;
// simply dump the output
while (lint2 < lint1)
{
lint2++;
lint3 = rand();
}
Since the longlong generator function requires a 64-bit generator, and only the SOBOL sequences are available in 64-bit generator types, and the SOBOL sequences are only quasirandom, it seems that you will have to use such a contrived seeding method.