autoParApply: *apply with auto-parallelization if available

Description Usage Arguments Examples

View source: R/autoParApply.R

Description

autoPar*apply functions guess the number of cores to use and run in parallel if possible. “L”, “S” and “” (nothing) are available. This function will make all objects in the global environment, and all currently loaded packages available to the parallel cluster nodes. This may fail in unexpected ways if other environments are attached to the search path.

Usage

1
2
3
4
5
autoParLapply(X, FUN, .maxCores = NULL, ...)

autoParSapply(X, FUN, .maxCores = NULL, ...)

autoParApply(X, MARGIN, FUN, .maxCores = NULL, ...)

Arguments

X, MARGIN, FUN, ...

arguments to lapply, sapply and apply or their parallel equivalents

.maxCores

limit the number of cores.

Examples

1
2
3
4
5
6
7
8
## Not run: autoParLapply(1:10, function(x) x^2)
## Not run: autoParSapply(1:10, function(x) x^2)
## Not run: 
x <- array(1:30, dim=c(2, 5, 3))
autoParApply(x, 1, sum)
autoParApply(x, c(1, 3), sum)

## End(Not run)

xrobin/xavamess documentation built on June 15, 2021, 3:46 a.m.