# NOT RUN {
# use Rhpc command
Rhpc_initialize()
# If you start the process dynamically on Windows, the dos window of
# mpiexec will be created, but you should not close this window.
cl <- Rhpc_getHandle(5) # 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'
#
# }
Run the code above in your browser using DataLab