This package requires an MPI library (OpenMPI, MPICH2, or LAM/MPI).
The install command (with OpenMPI library) is
> tar zxvf pbdMPI_0.1-0.tar.gz
> R CMD INSTALL pbdMPI
Other arguments include
--with-mpi-type
OPENMPI
--with-mpi-include
${MPI_ROOT}/include
--with-mpi-libpath
${MPI_ROOT}/lib
--with-mpi
${MPI_ROOT}
}
where ${MPI_ROOT}
is the path to the MPI root.
See the package source file pbdMPI/configure
for details.
After loading library(pbdMPI)
, the standard process starts from
init()
which set two global variables .comm.size
and .comm.rank
. The standard process should end
with finalize()
.
Most functions are assumed to run in SPMD, i.e.
in batch mode. Ideally, most codes run with mpiexec
and Rscript
,
together, such as
> mpiexec -np 2 Rscript some_code.r
where some_code.r
contains whole SPMD program.
The package source files provide several examples based on pbdMPI/inst/examples/test_spmd/
major SPMD functions
pbdMPI/inst/examples/test_rmpi/
analog to pbdMPI/inst/examples/test_parallel/
analog to pbdMPI/inst/examples/test_performance/
performance tests
pbdMPI/inst/examples/test_s4/
S4 extension
pbdMPI/inst/examples/test_cs/
client/server examples
pbdMPI/inst/examples/test_long_vector/
long vector examples
}
where test_long_vector
needs to recompile with setting
#define MPI_LONG_DEBUG 1}
in pbdMPI/src/pkg_constant.h
.
The current version is mainly written and tested under OpenMPI
environments in Linux system (xubuntu-11.04). Also, it is tested
under MPICH2 environments in Windows 7 system.
It is expected to be fine for other MPI libraries and other OS platforms.
allgather()
,
allreduce()
,
bcast()
,
gather()
,
reduce()
,
scatter()
.