pbdMPI-package {pbdMPI} | R Documentation |
pbdMPI provides an efficient interface to MPI by utilizing S4 classes and methods with a focus on Single Program/Multiple Data (SPMD) parallel programming style, which is intended for batch parallel execution.
Package: | pbdMPI |
Type: | Package |
License: | Mozilla Public License 2.0 |
LazyLoad: | yes |
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
Argument | Default |
--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, such as
Directory | Examples |
pbdMPI/inst/examples/test_spmd/ | major SPMD functions |
pbdMPI/inst/examples/test_rmpi/ | analog to Rmpi |
pbdMPI/inst/examples/test_parallel/ | analog to parallel |
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.
Wei-Chen Chen wccsnow@gmail.com, George Ostrouchov, Drew Schmidt, Pragneshkumar Patel, and Hao Yu.
Programming with Big Data in R Website: http://r-pbd.org/
allgather()
,
allreduce()
,
bcast()
,
gather()
,
reduce()
,
scatter()
.
## Not run: ### Under command mode, run the demo with 2 processors by ### (Use Rscript.exe for windows system) mpiexec -np 2 Rscript -e "demo(allgather,'pbdMPI',ask=F,echo=F)" mpiexec -np 2 Rscript -e "demo(allreduce,'pbdMPI',ask=F,echo=F)" mpiexec -np 2 Rscript -e "demo(bcast,'pbdMPI',ask=F,echo=F)" mpiexec -np 2 Rscript -e "demo(gather,'pbdMPI',ask=F,echo=F)" mpiexec -np 2 Rscript -e "demo(reduce,'pbdMPI',ask=F,echo=F)" mpiexec -np 2 Rscript -e "demo(scatter,'pbdMPI',ask=F,echo=F)" ## End(Not run)