我正在学习如何使用batchtools package,但是有些事情我不太了解,如何使用parallelMap或doParallel建立链接/连接?
library(batchtools)
library(parallelMap)
tmp = makeRegistry(file.dir = NA, make.default = FALSE)
f = function(i) {
parallelMap::parallelMap(Sys.sleep, rep(10, i))
}
ids = batchMap(f, i = 4, reg = tmp)
res = list(pm.backend = "multicore", ncpus = 4)
parallelStart()
...
parallelStop()