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.
On Fri, Dec 9, 2011 at 5:38 AM, Tomasz Rybak <[email protected]> wrote: > Excuse me stupid question, but why are you reimplementing > XORWOWRandomNumberGenerator instead of using it? > > The code should look like this: > > import numpy > > # This initializes random number generator > r = pycuda.curandom.XORWOWRandomNumberGenerator() > # This will create GPUArray of 32-bit floats with > # sizes 100x200x300 and fill it with normalized random > # numbers > array = r.gen_normal((100, 200, 300), dtype = numpy.float32) > # Or, if you already have array... > array = pycuda.gpuarray.GPUArray((200, 400), dtype = numpy.float32) > r.fill_normal(array) > > It will use as many cores as you have, check for errors, etc. > > Best 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 _______________________________________________ PyCUDA mailing list [email protected] http://lists.tiker.net/listinfo/pycuda
