Using MersenneTwister to generate random numbers Can random sequence be continued?

Hi all,

I’d like to generate pseudo random numbers for a Monte Carlo application. Included in the CUDA SDK distribution is a Mersenne-Twister generator. There are also other random number generators available [1],[2].

First question: I’d like to generate more random numbers than will fit in device memory. One Mersenne-Twister kernel call won’t be enough. Is it possible to “continue” the Mersenne-Twister sequence between kernel calls? If not, what is the recommended way to generate a lot of random numbers?

Second question: Is there any common wisdom about which pseudo RNG’s work well with CUDA?




Linear congruential generators implemented in CUDA

As a follow up, I am currently using a modification of:

The generated random sequence is exactly that of the rand48 algorithm provided by the C standard library, but the implementation has been parallelized in a clever way. I’ve modified this implementation so that random numbers can be generated, one at a time, within a CUDA device function. The code is attached.

In a different thread there is a discussion of other (simple) random number generators which parallelize well. I’m considering using this one:
RNG discussion
rand48_cu.txt (4.34 KB)