Learn R Programming

doMPI (version 0.2.2)

openMPIcluster: Create an MPI cluster object

Description

The openMPIcluster function is used to create an MPI cluster object in a cluster worker. It is never executed by the master process. Unlike startMPIcluster, it does not actually launch workers. It simply creates an MPI cluster object, which is passed to the workerLoop function. It is used internally in spawn mode, but it also needs to be used in doMPI scripts that are started in non-spawn mode.

Usage

openMPIcluster(bcast=TRUE, comm=0, workerid=mpi.comm.rank(comm), verbose=FALSE,
               mtag=10, wtag=11)

Arguments

bcast
Indicates if a true MPI broadcast should be used to send shared “job” data to the workers. If FALSE is specified, the data is sent by separate messages to each worker, which is sometimes faster than using a broadcast. So this option really controls whether to do a real or an emulated broadcast. Defaults to TRUE.
comm
The MPI communicator number. This should always be 0 when called from non-spawn mode. Defaults to 0.
workerid
The rank of the worker calling openMPIcluster.
verbose
Indicates if verbose messages should be enabled. Defaults to FALSE.
mtag
Tag to use for messages sent to the master. Do not use this option unless you know what you're doing, or your program will very likely hang. Defaults to 10.
wtag
Tag to use for messages sent to the workers. Do not use this option unless you know what you're doing, or your program will very likely hang. Defaults to 11.

Examples

Run this code
## Not run: ------------------------------------
# # make an MPI cluster object with emulated broadcast:
# cl <- openMPIcluster(bcast=FALSE)
## ---------------------------------------------

Run the code above in your browser using DataLab