epi_utils_multicore: Setup a parallel run

View source: R/epi_utils_multicore.R

epi_utils_multicoreR Documentation

Setup a parallel run

Description

epi_utils_multicore() setups a parallel function call using the package future.

Usage

epi_utils_multicore(
  num_cores = NULL,
  future_plan = "multiprocess",
  gc = TRUE,
  verbose = TRUE,
  ...
)

Arguments

num_cores

Number of cores to use. Default cores - 1.

future_plan

The strategy to use for plan(). Default is 'multiprocess'.

gc

Garbage collection. Default is TRUE. Not all strategies use it though and cause an overhead.

verbose

Prints out the settings for future::plan(). Default is TRUE.

...

pass any further parameters accepted by future::plan().

Value

Nothing

Note

num_cores is calculated as max(1, parallel::detectCores() - 1). If using sequential a warning will be emitted for workers. Not all strategies use gc(). See plan.

Author(s)

Antonio Berlanga-Taylor <\url{https://github.com/AntonioJBT/episcout}>

See Also

plan, detectCores, registerDoFuture, availableCores, availableWorkers.

Examples

## Not run: 
epi_utils_multicore(num_cores = 1, future_plan = 'sequential')
future_v %<-% { sum(1 + 2)}
future_v
epi_utils_multicore(future_plan = 'multiprocess')
future_v %<-% {sum(2 + 2)}
future_v

## End(Not run)

AntonioJBT/episcout documentation built on Dec. 1, 2024, 4:07 a.m.