Sequence number in curand_init()

Hello all,

I have a question concerning the sequence variable that can be used to initialize the XORWOW generator.
Although, I read some related forum entries I still do not exactly understand what “sequence” really means. (The documentation is not very instructive for the “sequence”)

I understand that - according to the CURAND doc - it is good practice to use one seed and a different sequence number for the individual threads.

When will the different sequences start to overlap?

Is there a limit of the number of threads that can be used at the same time?

Thank you for any advice,


The distance between first elements in successive sequences is dependent on the generator. For XORWOW (default generator) it is 2**67.

There is an example that uses the kernel API in the online docs. As is typical, it initializes each thread’s sequence to the thread ID, with the same seed for all threads. With this setup, you would have to generate 2**67 results per thread to run into adjacent sequences.

There is no limit imposed by CURAND for how many threads may be in use. You may use the maximum supported by your GPU and CUDA.

Thank you for your reply!

That means sequence 0 will overlap with sequence 1 after sequence 0 called curand() 267 times (what will barely be the case for typical applications). Having a periodicity >2190 for XORWOW, there are indeed enough sequences to be used. Must be something like 2190/267=2**123?
In my simulation the typical number of threads is about 50000 to 2000000 and not more than 100000 curand-calls per thread. Thus, everything seems to be in order.

Thank you again,