random_shuffle + MPI

A

aTuL

Hi All,

I am trying to use the random_shuffle algorithm to shuffle the
contents of a vectors. Now I wish to use MPI to execute this
functionality in parallel on multiple processors. I believe that the
parallel execution of the random_shuffle will not be indentical on all
the machinies. Is that correct?

If that is correct then I was wondering if there is any good way of
sending the shuffled vector around (without converting to an array.).
Has anyone in the past circulated the C++ STL vectors around using
MPI_BCAST? Any thoughts on how to do it?

Can I try the variant with RandomNumberGenerator class??

Regards,
Atul.
 
N

Noah Roberts

aTuL said:
Hi All,

I am trying to use the random_shuffle algorithm to shuffle the
contents of a vectors. Now I wish to use MPI to execute this
functionality in parallel on multiple processors. I believe that the
parallel execution of the random_shuffle will not be indentical on all
the machinies. Is that correct?

If that is correct then I was wondering if there is any good way of
sending the shuffled vector around (without converting to an array.).
Has anyone in the past circulated the C++ STL vectors around using
MPI_BCAST? Any thoughts on how to do it?

Can I try the variant with RandomNumberGenerator class??

You need to ask in a group where MPI is on-topic.
 
A

aTuL

You need to ask in a group where MPI is on-topic.

I really feel this is more to do with the use of random_shuffle
algorithm, if there is some way I can make sure that I can get the
same shuffled output for a integers in the vector then I think I am
more over done. Passing the vector around with MPI is a way to get
around this problem. Hence, I asked it here. I have also asked on the
comp.parallel.mpi group.
 
K

Kai-Uwe Bux

aTuL said:
I really feel this is more to do with the use of random_shuffle
algorithm, if there is some way I can make sure that I can get the
same shuffled output for a integers in the vector then I think I am
more over done. Passing the vector around with MPI is a way to get
around this problem. Hence, I asked it here. I have also asked on the
comp.parallel.mpi group.

Well, if you have a pseudo random number generator that produces
reproducible sequences from a given seed _and_ you have the same
deterministic random_shuffle on all processors, then you should be fine.
The standard does not specify this, but the straight forward implementation
of random_shuffle introduces no randomness by and in itself: all randomness
is put of into querying the RNG. Thus, the rearrangement only depends on
the behavior of the RNG. If you pass equivalent RNGs, you should get
identical permutations.

Pseudo random number generators are deterministic: if you specify the same
seed, you get the same output sequence.


Best

Kai-Uwe Bux
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,897
Members
47,439
Latest member
shasuze

Latest Threads

Top