Rhpc-package {Rhpc} | R Documentation |
Rhpc_lapply, Rhpc_lapplyLB and Rhpc_worker_call using MPI provides better HPC environment on R(works fast on HPC). and this package supports long vector, can deal with slightly big data.
Rhpc_initialize() Rhpc_finalize() Rhpc_getHandle(procs) Rhpc_worker_call(cl, FUN, ...) Rhpc_worker_noback(cl, FUN, ...) Rhpc_lapply(cl, X, FUN, ...) Rhpc_lapplyLB(cl, X, FUN, ...) Rhpc_sapply(cl, X, FUN, ..., simplify, USE.NAMES) Rhpc_sapplyLB(cl, X, FUN, ..., simplify, USE.NAMES) Rhpc_apply(cl, X, MARGIN, FUN, ...) Rhpc_numberOfWorker(cl) Rhpc_Export(cl, variableNames, pos, envir) Rhpc_EvalQ(cl, expr, envir) Rhpc_setupRNG(cl, iseed)
cl |
external pointer to MPI communicator |
procs |
number of process, void if Rhpc |
X |
vector or list. Divided into smaller vectors according to the number of workers, and distributed to workers when the function is first executed. One-sided communication is used asynchronously |
FUN |
string of function name or function object. Function name or string (string expresses function name) Distributed by collective communication at first, then they are not sent again |
MARGIN |
a vector giving the subscripts which the function will
be applied over. E.g., for a matrix |
simplify |
logical or character string; should the result be
simplified to a vector, matrix or higher dimensional array if
possible? For |
USE.NAMES |
logical; if |
... |
arguments. Distributed by collective communication at first, then they are not sent again |
variableNames |
string vector |
iseed |
random number seed |
expr |
expression to evaluate |
pos |
default is current environment position |
envir |
where to look for the object |
Rhpc batch wrapper in package directory if you use mpirun.
This package sets "Rhpc.mpi.c.comm"
,"Rhpc.mpi.f.comm"
,
"Rhpc.mpi.rank"
and "Rhpc.mpi.procs"
can get attribute of MPI in getOption().
http://prs.ism.ac.jp/~nakama/Rhpc
Junji NAKANO <nakanoj@ism.ac.jp> and Ei-ji Nakama<nakama@com-one.com>
Maintainer: Ei-ji Nakama <nakama@com-one.com>
## Not run: # use Rhpc command Rhpc_initialize() cl <- Rhpc_getHandle() # ommit number of worker if use Rhpc batch # Rhpc set to options opstr=list("Rhpc.mpi.rank","Rhpc.mpi.procs","Rhpc.mpi.c.comm","Rhpc.mpi.f.comm") do.call("options",opstr) Rhpc_worker_call(cl, "do.call","options", opstr) # warning! : pointer not export, worker Rhpc.mpi.c.comm is (nil) on master. Rhpc_worker_call(cl, Sys.getpid) Rhpc_lapply(cl,1:10000,sqrt) Rhpc_lapplyLB(cl,1:10000,sqrt) Rhpc_sapply(cl,1:10000,sqrt) Rhpc_sapplyLB(cl,1:10000,sqrt) df<-data.frame(a=1:4,b=5:8) Rhpc_apply(cl,df,1,max) Rhpc_apply(cl,df,2,max) Rhpc_finalize() # # command line example # # mpirun -n 4 Rhpc CMD BATCH --no-save `script file for exemplified above' # ## End(Not run)