功能我有這樣的重複性[R片斷找不到裏面clusterApply
rm(list=ls())
library(doSNOW)
f <- function(a, b) a+b
g <- function(c) f(c*c, c+c)
v <- c(1, 2, 3, 4, 5, 6)
cl <- makeMPIcluster(1)
cat(clusterApply(cl, v, g))
stopCluster(cl)
,我得到了以下錯誤消息:
Error in checkForRemoteErrors(val) :
6 nodes produced errors; first error: could not find function "f"
我使用Ubuntu下的[R 2.14.1。 MPI已安裝並正在運行。
我知道foreach結構存在類似的問題,但它允許通過.export參數手動引用函數。我找不到類似於clusterApply的東西。有沒有解決方法?
謝謝!