A batchtools backend that resolves futures in parallel via forked background R processes
Source:R/batchtools_multicore.R
batchtools_multicore.Rd
A batchtools backend that resolves futures in parallel via forked background R processes
Usage
batchtools_multicore(
...,
workers = availableCores(constraints = "multicore"),
fs.latency = 0
)
Arguments
- workers
The number of multicore processes to be available for concurrent batchtools multicore futures.
- fs.latency
[
numeric(1)
]
Expected maximum latency of the file system, in seconds. Set to a positive number for network file systems like NFS which enables more robust (but also more expensive) mechanisms to access files and directories. Usually safe to set to0
to disable the heuristic, e.g. if you are working on a local file system.- ...
Not used.
Details
Batchtools multicore futures use batchtools cluster functions
created by batchtools::makeClusterFunctionsMulticore()
with
ncpus = workers
.
An alternative to the batchtools multicore backend is to use
plan(future::multicore)
.
Examples
plan(batchtools_multicore, workers = 2)
message("Main process ID: ", Sys.getpid())
#> Main process ID: 620860
f <- future(Sys.getpid())
pid <- value(f)
message("Worker process ID: ", pid)
#> Worker process ID: 621555