xcmsPapply               package:xcms               R Documentation

_x_c_m_s_P_a_p_p_l_y

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_U_s_a_g_e:

         xcmsPapply(arg_sets, papply_action, papply_commondata = list(), 
                show_errors = TRUE, do_trace = FALSE, also_trace = c())

_A_r_g_u_m_e_n_t_s:

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. 

_D_e_t_a_i_l_s:

     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, <URL: 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, <URL: http://mpi.deino.net/>, also see
           <URL: http://www.stats.uwo.ca/faculty/yu/Rmpi/> 

_V_a_l_u_e:

     A list of return values from papply_action.  Each value
     corresponds to the element of arg_sets used as a parameter to
     papply_action

_N_o_t_e:

     Does not support distributing recursive calls in parallel.  If 
     papply is used inside papply_action, it will call a non-parallel
     version

_A_u_t_h_o_r(_s):

     Duane Currie <duane.currie@acadiau.ca>, modified by Ralf
     Tautenhahn <rtautenh@ipb-halle.de>.

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://ace.acadiau.ca/math/ACMMaC/software/papply/>

_E_x_a_m_p_l_e_s:

     ## 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)

