[petsc-users] Speed of random generator

Timothée Nicolas timothee.nicolas at gmail.com
Sun Jun 19 06:53:09 CDT 2016


Hi all,

I am trying to generate a lot of random numbers to use in a Fokker-Planck
simulation. The particles receive random kicks from a normal distribution
with a specified statistics. I have some issues here:

- The manual says to NOT use PetscRandomCreate for Monte Carlo simulations
because it wouldn't have the same statistics across processors. I assume it
would in principle apply to my Fokker-Planck simulation described above
too, right?

- If I want to generate the random numbers more carefully, it says I have
to use PetscRandomRegister, and to check src/sys/random/impls/rand/rand.c
for an example, but src/sys/random does not exist in my distribution
(obtained with git). How do I find this?

- There is a speed issue. On my computer, the generator is about 10 times
slower than the method numpy.random.rand() of python. Is it expected ? This
is alleviated by parallelization, but since I moved to FORTRAN from python
in hope of accelerating my code, this is too bad. I consider moving to
petsc4py, would it be a good choice?

Thanks in advance

Timothee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160619/f050baa7/attachment.html>


More information about the petsc-users mailing list