barrier(comm = .SPMD.CT$comm)
comm.is.null(comm = .SPMD.CT$comm)
comm.rank(comm = .SPMD.CT$comm)
comm.size(comm = .SPMD.CT$comm)
comm.dup(comm, newcomm)
comm.free(comm = .SPMD.CT$comm)
init(set.seed = TRUE)
finalize(mpi.finalize = .SPMD.CT$mpi.finalize) comm.abort(errorcode = 1, comm = .SPMD.CT$comm)
comm.split(comm = .SPMD.CT$comm, color = 0L, key = 0L,
newcomm = .SPMD.CT$newcomm)
comm.disconnect(comm = .SPMD.CT$comm)
comm.connect(port.name, info = .SPMD.CT$info,
rank.root = .SPMD.CT$rank.root, comm = .SPMD.CT$comm,
newcomm = .SPMD.CT$newcomm)
comm.accept(port.name, info = .SPMD.CT$info,
rank.root = .SPMD.CT$rank.root, comm = .SPMD.CT$comm,
newcomm = .SPMD.CT$newcomm)
port.open(info = .SPMD.CT$info)
port.close(port.name)
serv.publish(port.name, serv.name = .SPMD.CT$serv.name,
info = .SPMD.CT$info)
serv.unpublish(port.name, serv.name = .SPMD.CT$serv.name,
info = .SPMD.CT$info)
serv.lookup(serv.name = .SPMD.CT$serv.name, info = .SPMD.CT$info)
intercomm.merge(intercomm = .SPMD.CT$intercomm,
high = 0L, comm = .SPMD.CT$comm)
intercomm.create(local.comm = .SPMD.CT$comm,
local.leader = .SPMD.CT$rank.source, peer.comm = .SPMD.CT$intercomm,
remote.leader = .SPMD.CT$rank.dest, tag = .SPMD.CT$tag,
newintercomm = .SPMD.CT$newcomm)
comm.c2f(comm = .SPMD.CT$comm)
barrier()
blocks all processors until everyone call this.
comm.is.null()
returns -1
if the array of communicators is not
allocated, i.e. init()
is not called yet. It returns 1
if the communicator is not initialized, i.e. NULL
. It
returns 0
if the communicator is initialized.
comm.rank()
returns the processor's rank for the given comm
.
comm.size()
returns the total processes for the given comm
.
comm.dup()
duplicate a newcomm
from comm
.
comm.free()
free a comm
.
init()
initializes a MPI world, and set two global variables
.comm.size
and .comm.rank
in .GlobalEnv
. A random seed
will be preset by default (Sys.getpid() + Sys.time()
) to the package
finalize()
frees memory and finishes a MPI world if
mpi.finalize = TRUE
.
comm.abort()
aborts MPI.
comm.split()
create a newcomm
by color and key.
comm.disconnect()
frees a comm
.
comm.connect()
connects a newcomm
.
comm.accept()
accepts a newcomm
.
port.open()
opens a port and returns the port name.
port.close()
closes a port by name.
serv.publish()
publishs a service via port.name
.
serv.unpublish()
unpublishs a service via port.name
.
serv.lookup()
lookup the serv.name
and returns the port name.
intercomm.merge()
merges the intercomm
to intracommunicator.
intercomm.create()
creates a new intercomm
from two
peer intracommunicators.
comm.c2f()
returns an integer for Fortran MPI support.
### Save code in a file "demo.r" and run with 2 processors by
### SHELL> mpiexec -np 2 Rscript demo.r
### Initial.
library(pbdMPI, quietly = TRUE)
init()
.comm.size <- comm.size()
.comm.rank <- comm.rank()
### Examples .
comm.print(.comm.size)
comm.print(.comm.rank, all.rank = TRUE)
comm.print(comm.rank(), rank.print = 1)
comm.print(comm.c2f())
### Finish.
finalize()
Run the code above in your browser using DataLab