Description Usage Arguments Details Value Note Author(s) References Examples
An apply-like function which uses Rmpi to distribute the processing evenly across a cluster. Will use a non-MPI version if distributed processing is not available.
1 2 | xcmsPapply(arg_sets, papply_action, papply_commondata = list(),
show_errors = TRUE, do_trace = FALSE, also_trace = c())
|
arg_sets |
a list, where each item will be given as an argument to papply\_action |
papply_action |
A function which takes one argument. It will be called on each element of arg\_sets |
papply_commondata |
A list containing the names and values of variables to be accessible to the papply\_action. 'attach' is used locally to import this list. |
show_errors |
If set to TRUE, overrides Rmpi's default, and messages for errors which occur in R slaves are produced. |
do_trace |
If set to TRUE, causes the papply\_action function to be traced. i.e. Each statement is output before it is executed by the slaves. |
also_trace |
If supplied an array of function names, as strings, tracing will also occur for the specified functions. |
Similar to apply and lapply, applies a function to all items of a list, and returns a list with the corresponding results.
Uses Rmpi to implement a pull idiom in order to distribute the processing evenly across a cluster. If Rmpi is not available, or there are no slaves, implements this as a non-parallel algorithm.
xcmsPapply
is a modified version of the papply function from package papply 0.2 (Duane Currie).
Parts of the slave function were wrapped in try() to make it failsafe and progress output was added.
Make sure Rmpi
was installed properly by executing the example below.
Rmpi
was tested with
OpenMPI : Unix, http://www.open-mpi.org/, don't forget to export MPI_ROOT
before installing Rmpi e.g. export MPI_ROOT=/usr/lib/openmpi
DeinoMPI : Windows, http://mpi.deino.net/, also see http://www.stats.uwo.ca/faculty/yu/Rmpi/
A list of return values from papply\_action. Each value corresponds to the element of arg\_sets used as a parameter to papply\_action
Does not support distributing recursive calls in parallel. If papply is used inside papply\_action, it will call a non-parallel version
Duane Currie <duane.currie@acadiau.ca>, modified by Ralf Tautenhahn <rtautenh@ipb-halle.de>.
http://ace.acadiau.ca/math/ACMMaC/software/papply/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
library(Rmpi)
library(xcms)
number_lists <- list(1:10,4:40,2:27)
mpi.spawn.Rslaves(nslaves=2)
results <- xcmsPapply(number_lists,sum)
results
mpi.close.Rslaves()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.