The reason I hadn't used the XORWOWRandomNumberGenerator class is because
it's use is undocumented and I had a look at the class but couldn't figure
out what the hell was going on. Looking at it again now, I don't see how I
could have guessed that the generator pointer is stored in the states
member variable.

2011/12/9 Thomas Wiecki <[email protected]>

> Here is my first implementation:
> https://gist.github.com/1452214
>
> Any feedback and suggestions for improvement are welcome!
>
> 2011/12/9 Thomas Wiecki <[email protected]>:
> > Is there a variable that will tell me number of available threads?
> >
> > On Fri, Dec 9, 2011 at 11:36 AM, Tomasz Rybak <[email protected]> wrote:
> >> Dnia 2011-12-09, pią o godzinie 11:06 -0500, Thomas Wiecki pisze:
> >>> That does seem to work. Its actually what I initially thought of doing
> >>> (but didn't know that .state can be passed as a curandState. Thanks!
> >>
> >> No problem. .state is just a pointer to device memory storing states.
> >>
> >>>
> >>> Is the .fill(array) required? I tried it without and at least didn't
> crash.
> >>
> >> No. All initialisation is done in constructor.
> >> .fill() just calls curand() (or similar) using those states.
> >>
> >>>
> >>> Just so I know what it's doing, upon instantiation,
> >>> XORWOWRandomNumberGenerator() creates the maximum number of
> >>> curandStates? What happens when I call my function with idx being
> >>> greater than this number?
> >>
> >> undefined behaviour^TM ;-)
> >> It will try to go outside allocated memory and behaviour will
> >> depend on the device, CUDA version, etc.
> >> On some it will just read unitilialised data, on some hardware
> >> might caught access to unallocated memory, ...
> >> IMO it will be the same as IndexOutOfRange in C/C++ - we
> >> do now know what will happen.
> >>
> >>>
> >>> On Fri, Dec 9, 2011 at 8:12 AM, Tomasz Rybak <[email protected]> wrote:
> >>> > Dnia 2011-12-09, pią o godzinie 08:01 -0500, Thomas Wiecki pisze:
> >>> >> The problem is that I don't want an array of random numbers in the
> end
> >>> >> (as your code does), but want to pass generators to a cuda function
> >>> >> that then simulates a stochastic process. So I need access to the
> >>> >> curandState.
> >>> >
> >>> > The memory storing array of generators' states in in property
> >>> > XORWOWRandomNumberGenerator.states. Array has as many elements
> >>> > as there is cores on the GPU (e.g. 512 for GTX 590).
> >>> >
> >>> > Regards.
> >>> >
> >>> > --
> >>> > Tomasz Rybak <[email protected]> GPG/PGP key ID: 2AD5 9860
> >>> > Fingerprint A481 824E 7DD3 9C0E C40A  488E C654 FB33 2AD5 9860
> >>> > http://member.acm.org/~tomaszrybak
> >>
> >>
> >> --
> >> Tomasz Rybak <[email protected]> GPG/PGP key ID: 2AD5 9860
> >> Fingerprint A481 824E 7DD3 9C0E C40A  488E C654 FB33 2AD5 9860
> >> http://member.acm.org/~tomaszrybak
>
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to