openMPIcluster: Create an MPI cluster object

Description Usage Arguments Note Examples

View source: R/mpiworkers.R

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

1
2
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.

Note

Make sure that openMPIcluster is called consistently with startMPIcluster, otherwise your program will hang. In particular, make sure that bcast is set the same, and that comm is 0, which is the default value.

Examples

1
2
3
4
5
## Not run: 
# make an MPI cluster object with emulated broadcast:
cl <- openMPIcluster(bcast=FALSE)

## End(Not run)

doMPI documentation built on May 2, 2019, 1:10 p.m.