run_method_parallel: Run one or more methods on simulated data.

View source: R/parallel-methods.R

run_method_parallelR Documentation

Run one or more methods on simulated data.

Description

This is an internal function. Jobs are run in parallel both by method and by index. Users should call the wrapper function run_method.

Usage

run_method_parallel(
  my_methods,
  dir,
  model_name,
  index,
  out_dir,
  out_loc,
  socket_names,
  libraries,
  save_locally = TRUE
)

Arguments

my_methods

list of methods to be run in parallel

dir

the directory where Model object was saved (by generate_model)

model_name

the Model object's name attribute

index

a vector of positive integer indices. Allows simulations to be carried out in chunks. Each chunk gets a separate RNG stream, meaning that the results will be identical whether we run these in parallel or sequentially.

out_dir

full directory to where method outputs are stored.

out_loc

a length-1 character vector that gives location (relative to model's path) that method outputs are stored.This can be useful for staying organized when multiple simulations are based on the same Model and Draws objects.

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.


simulator documentation built on Feb. 16, 2023, 9:34 p.m.