parLapplyLBm: Memoizing wrapper for parLapplyLB

View source: R/VectorizeM.R

parLapplyLBmR Documentation

Memoizing wrapper for parLapplyLB

Description

Memoizing wrapper for parLapplyLB

Usage

parLapplyLBm(cl = NULL, X, fun, ..., chunk.size = NULL)

Arguments

cl

cluster object

X

list or vector of inputs

fun

function to apply

...

additional arguments passed to lapply

chunk.size

passed to parallel::parLapplyLB

Value

list of results.

See Also

parLapplyLB, lapplym, VectorizeM, vapplym

Examples


if(requireNamespace("parallel", quietly = TRUE)) {
  cl <- parallel::makeCluster(2)
  fs <- function(x) { x <- x[[1]]; Sys.sleep(1); sin(x) }
  # without memoization should take 1000 seconds
  lst <- parLapplyLBm(cl, c(rep(0, 1000), rep(1, 1000)), fs)
  parallel::stopCluster(cl)
}


wrapr documentation built on Aug. 20, 2023, 1:08 a.m.