Looking for a way to transform the example code below into getting a_gpu to pull from a random normal distribution. Currently using "varX = numpy.random.normal(mean,sigma,data_points).astype(numpy.float32)" but this is not fast enough as I need dozens of variables and millions of data_points for Monte Carlo simulation. Already have the MCS computations offloaded to the GPU so my variables randomization now takes up 98% of the MCS execution time. Other suggestions and approaches welcome.
import numpy as np
import pyopencl as cl
ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)
from pyopencl.clrandom import rand as clrand
a_gpu = clrand(queue, (2**10,), dtype=np.float32, a=0, b=1)
a = a_gpu.get()
print (a_gpu);
Aucun commentaire:
Enregistrer un commentaire