parallel processing - Nested/Chained parLapply functions (R) -
i'm unable find conclusive answer whether able use output of 1 parlapply call in parlapply function. example:
first.vars <- c("a", "b", "c", "d") second.vars <- c(1, 2, 3, 4) no.cores <- detectcores() -1 cl <- makecluster(no.cores) clusterevalq(cl, library(parallel)) clusterexport(cl, ls()) parlapply(cl, first.vars, function(first.vars) parlapply(cl, second.vars, function(second.vars) paste(c(first.vars, second.vars), collapse = ""))
my expectation retrieve nested list "a1", "a2", "a3", "a4", "b1", "b2" etc... case when use non-parallelised function.
however parallel method doesn't work , guess 'cl' of top-most parlapply doesn't contain output of bottom parlapply , therefore can't run.
any ideas?
Comments
Post a Comment