R:bigrf的doMPI后端

时间:2015-03-26 19:29:30

标签: r parallel-processing random-forest parallel-foreach

我试图将下面的bigrf示例与doMPI后端并行化。

# Libraries
library(doMPI)
library(bigrf)

# Load data
data(Cars93, package="MASS")
y <- Cars93$Type
x <- Cars93

# Parallelization
cl <- startMPIcluster(count=2, verbose=TRUE)
exportDoMPI(cl, c("big.matrix"))
registerDoMPI(cl)

# Select variables with which to train model.
vars <- c(4:22)

# Run model, grow 50 trees on the first 60 examples.
forest1 <- bigrfc(x[1:60, ], y[1:60], ntree=50L, varselect=vars)

# Stop the Cluster
closeCluster(cl)

然而,看起来有些线程看不到&#34; modaC&#34;,bigrf包的C函数,给出以下错误,

task 2 failed - ""modaC" not available for .Call() for package "bigrf""

回溯

7 stop(simpleError(msg, call = expr))
6 e$fun(obj, substitute(ex), parent.frame(), e$data)
5 foreach(treenum = (forest@ntrees + 1):(forest@ntrees + ntrees), 
.combine = combine.treeresults, .init = forest, .inorder = FALSE, 
.verbose = FALSE) %dopar% {
if (trace >= 1L)  ... at grow.R#161
4 .local(forest, ...)
3 grow(forest, x, ntrees, printerrfreq = printerrfreq, printclserr = printclserr, 
trace = trace) at grow.R#1
2 grow(forest, x, ntrees, printerrfreq = printerrfreq, printclserr = printclserr, 
trace = trace) at bigrfc.R#257
1 bigrfc(x[1:60, ], y[1:60], ntree = 50L, varselect = vars)

和会话信息

R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=pt_BR.UTF-8       LC_NUMERIC=C               LC_TIME=pt_BR.UTF-8       
 [4] LC_COLLATE=pt_BR.UTF-8     LC_MONETARY=pt_BR.UTF-8    LC_MESSAGES=pt_BR.UTF-8   
 [7] LC_PAPER=pt_BR.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] bigrf_0.1-11        bigmemory_4.4.6     BH_1.55.0-3         bigmemory.sri_0.1.3
[5] doMPI_0.2.1         Rmpi_0.6-5          iterators_1.0.7     foreach_1.4.2      

loaded via a namespace (and not attached):
[1] codetools_0.2-8 compiler_3.0.2  parallel_3.0.2  tools_3.0.2 

我已经知道doMPI只传递明确请求的变量,例如big.matrix,但我不知道如何obtainpass modaC。

0 个答案:

没有答案