打包batchtools和parallelMap

时间:2019-03-13 07:23:47

标签: r

我正在学习如何使用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()

0 个答案:

没有答案