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)

