pbdMPI (version 0.3-9)

global stop and warning: Global Stop and Warning Functions

Description

These functions are global stop and warning applying on distributed data for all ranks, and are called by experts only. These functions may lead to potential performance degradation and system termination.

Usage

comm.stop(..., call. = TRUE, domain = NULL,
          all.rank = .pbd_env$SPMD.CT$print.all.rank,
          rank.print = .pbd_env$SPMD.CT$rank.source,
          comm = .pbd_env$SPMD.CT$comm,
          mpi.finalize = .pbd_env$SPMD.CT$mpi.finalize,
          quit = .pbd_env$SPMD.CT$quit)

comm.warning(..., call. = TRUE, immediate. = FALSE, domain = NULL, all.rank = .pbd_env$SPMD.CT$print.all.rank, rank.print = .pbd_env$SPMD.CT$rank.source, comm = .pbd_env$SPMD.CT$comm)

comm.warnings(..., all.rank = .pbd_env$SPMD.CT$print.all.rank, rank.print = .pbd_env$SPMD.CT$rank.source, comm = .pbd_env$SPMD.CT$comm)

comm.stopifnot(..., call. = TRUE, domain = NULL, all.rank = .pbd_env$SPMD.CT$print.all.rank, rank.print = .pbd_env$SPMD.CT$rank.source, comm = .pbd_env$SPMD.CT$comm, mpi.finalize = .pbd_env$SPMD.CT$mpi.finalize, quit = .pbd_env$SPMD.CT$quit)

Arguments

...

variables to be cat.

call.

see stop() and warnings().

immediate.

see stop() and warnings().

domain

see stop() and warnings().

all.rank

if all ranks print (default = FALSE).

rank.print

rank for printing if not all ranks print (default = 0).

comm

communicator for printing (default = 1).

mpi.finalize

if MPI should be shutdown.

quit

if quit R when errors happen.

Value

comm.stop() and comm.stopifnot() terminate all ranks, comm.warning() returns messages, and comm.warnings() print the message.

Details

These functions will respectively apply stop(), warning(), warnings(), and stopifnot() locally.

References

Programming with Big Data in R Website: http://r-pbd.org/

Examples

Run this code
# NOT RUN {
### Save code in a file "demo.r" and run with 2 processors by
### SHELL> mpiexec -np 2 Rscript demo.r

spmd.code <- "
### Initial.
suppressMessages(library(pbdMPI, quietly = TRUE))
init()
if(comm.size() != 2){
  comm.cat(\"2 processors are requried.\n\", quiet = TRUE)
  finalize()
}

### Examples.
comm.warning(\"test warning.\n\")
comm.warnings()
comm.stop(\"test stop.\n\")
comm.stopifnot(1 == 2)

### Finish.
finalize()
"
# execmpi(spmd.code, nranks = 2L)
# }

Run the code above in your browser using DataLab