Do a function in parallel.

Description

This is an internal function. The function_to_do is done in parallel and its output is saved either on slave (locally) or on master.

Usage

1
2
do_in_parallel(function_to_do, function_params, save_to_file, save_params,
  socket_names, libraries, save_locally = TRUE)

Arguments

function_to_do

this is the function that will be done in parallel

function_params

a list where function_params[[i]] is a named list of parameters to be passed to function_to_do for job i

save_to_file

function that saves stuff to file

save_params

a list where save_params[[i]] is a named list of parameters to be passed to save_to_file for job i. Each save_params[[i]] must include out_dir, which is location where file is to be saved.

socket_names

quoting from makePSOCKcluster: "either a character vector of host names on which to run the worker copies of R, or a positive integer (in which case that number of copies is run on localhost)."

libraries

character vector of R packages that will be needed on the slaves.

save_locally

if TRUE, then files will be saved on slaves. If FALSE, they will be saved on master.

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.