[MPICH] mpich2 & rand()

Andras Joo jooam at aston.ac.uk
Sat Jun 23 07:04:21 CDT 2007


I've encountered a problem regarding the random number generator inside 
mpich. Please consider the following code segment

//...init mpi
cout << rand() << endl;
//...finalize mpi

Now each time I run the program with
$ mpirun -n nr_proc my_prog
I got a sequence of nr_proc elements, with the same value!
It is crucial for me to get different values for the different processes.
Can anyone help me out with this, please?

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20070623/19e562a2/attachment.htm>

More information about the mpich-discuss mailing list