epi_utils_multicore: Setup a parallel run

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/epi_utils_multicore.R

Description

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

Usage

1
2
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 <https://github.com/AntonioJBT/episcout>

See Also

plan, detectCores, registerDoFuture, availableCores, availableWorkers.

Examples

1
2
3
4
5
6
7
8
9
## 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 Nov. 7, 2019, 5:34 p.m.