Simulate from a model in parallel.

Description

This is an internal function. Draws are done in chunks labeled by indices and of size determined by nsim. Users should call the wrapper function simulate_from_model.

Usage

1
2
simulate_parallel(model_ref, nsim, index, seeds, socket_names, libraries,
  save_locally = TRUE)

Arguments

model_ref

object of class ModelRef

nsim

number of simulations to be conducted on each chunk. Vector of same length as index

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.

seeds

a list of length(index) L'Ecuyer-CMRG seed vectors. Each should be from a separate stream. In particular, starting from the seed used to generate the model object, seeds[i] should be the result of calling nextRNGStream index[i] times.

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.