Learn R Programming

Rhpc (version 0.13-343.05)

Rhpc-package: A package for High-Performance Computing

Description

Rhpc_lapply, Rhpc_lapplyLB and Rhpc_worker_call using MPI provides better HPC environment on R(works fast on HPC). Maybe start from the Rhpc batch command is better(faster). Because strong mutual concessions(slowly) often occur by sched_yield, we recommend the use with the batch mode...XD

Rhpc batch in package directory.

Usage

Rhpc_initialize()
Rhpc_finalize()
Rhpc_getHandle(procs)
Rhpc_worker_call(cl, FUN, ...)
Rhpc_worker_shy(cl, FUN, ...)
Rhpc_lapply(cl, X, FUN, ...)
Rhpc_lapplyLB(cl, X, FUN, ...)
Rhpc_numberOfWorker(cl)
Rhpc_Export(cl, variableNames, pos, envir)
Rhpc_EvalQ(cl, expr, envir)
Rhpc_setupRNG(cl, iseed)

Arguments

cl
external pointer to MPI communicator
procs
number of process, void if Rhpc
X
vector or list
FUN
string of function name or function object
...
arguments
variableNames
string vector
iseed
random number seed
expr
expression to evaluate
pos
default is current environment position
envir
where to look for the object

Details

http://prs.ism.ac.jp/~nakama/Rhpc

Examples

Run this code
# use Rhpc command
Rhpc_initialize()
cl <- Rhpc_getHandle() # ommit number of worker if use Rhpc batch
Rhpc_worker_call(cl, Sys.getpid)
Rhpc_lapply(cl,1:10000,sqrt)
Rhpc_lapplyLB(cl,1:10000,sqrt)
Rhpc_finalize()
#
# command line example
#
# mpirun -n 4 Rhpc CMD BATCH --no-save `script file for exemplified above'
#

Run the code above in your browser using DataLab