maedoc / libtvb

TVB C library
6 stars 8 forks source link

OpenCL RNG #139

Open maedoc opened 8 years ago

maedoc commented 8 years ago

We'll need to generate random numbers preferably not hand-coded; PyOpenCL uses RANLUX.

paramhanji commented 8 years ago

Consider combining a few primitive cyclic generators as described here. This is results in a fast RNG that has independent sub generators and should be easy enough to implement in OpenCL.

AbheekG commented 8 years ago

@catchchaos We can use AMD's clRNG library. It has nice optimized implementations of MRG31k3p, MRG32k3a and LFSR113. Nevertheless, algorithm given in the website is also nice.

maedoc commented 8 years ago

I would prefer to choose one or two with the highest periods, which is an important factor in quality:

Imagine a parameter sweep of 5 parameters, each having 100 values, and each simulation requires 10000000 time steps. If there are 400 state variables, we will need around 10^20 random numbers.

Because OpenCL targets hardware with single precision, there's no reason not to choose RANLUX, though again having a second one to compare with could be good.

paramhanji commented 8 years ago

Yup, RANLUX looks like our best bet currently and is certainly one of the popular options. If you're still looking for alternatives, I did come across the MIXMAX RNG described in this paper. I'll look at it more thoroughly if you find it promising.

maedoc commented 8 years ago

yup that's definitely the one linked to in the description of this issue.

paramhanji commented 8 years ago

Oops sorry I didn't see that :p I just happened to come across it while looking for a PRNG and thought I'd mention it for further reference. I'll delete the comment.