User's Guide:Details:Message Passing

Next:Creating New SPRNG Generators Previous:Generators


Message Passing

Most SPRNG calls do not require message passing, though SPRNG provides utilities to make it easier for users to pass streams from one process to another. Message passing is used by SPRNG only in two cases: (i) when the same seed is required on all the processes in a call to make_sprng_seed, this function broadcasts a single seed to all the processes and (ii) during initialization with the simple interface, SPRNG needs to determine the total number of processes and the rank of the local process.

MPI Version

SPRNG uses MPI in order to obtain or broadcast the information mentioned in the two cases above. The MPI version of SPRNG provides functions that make these calls. This version is obtained by defining the macro SPRNG_MPI in the SPRNG makefile before building the libraries. Even if the MPI version of the library has been installed, SPRNG will make MPI calls only when the user defines the macro USE_MPI before including a SPRNG header file. This feature enables users to use SPRNG in sequential programs even if the MPI version has been installed.

Note: In the MPI version with USE_MPI defined SPRNG first creates a new communicator when make_sprng_seed is called, in order to avoid any interference with the users communication calls. Then a new seed on the process with rank 0 is created, which is broadcast to all the processes. Users should ensure that if any process calls make_sprng_seed, then all processes do, in order to enable these collective operation to complete.

In the simple interface, users running multiple processes should define the macro USE_MPI, in order to ensure that they obtain distinct streams on each process. The reason for this is that this interface makes MPI calls to determine the process rank, which is used to obtain different streams on the different processes. If the above mentioned macro is not used, then MPI calls are not made and the process rank is assumed to be 0 in each process.

Use with PVM

Later versions of SPRNG may have support for PVM too available. Currently, PVM users can easily use SPRNG as long as they use the default interface. In order to obtain the same seed on all the processes while using make_sprng_seed, they can produce a seed on a single process and then pass it explicitly to the other processes.


[Quick 
Start] [User's 
Guide] [Reference 
Manual] [Quick 
Reference] [Next: 
Making New SPRNG Generators]