我在
Windows 7上安装了R(64位)版本2.11.1,还从“REvolution foreach windows bundle”打包doSMP和revoIPC进行并行处理.然后我将库doSMP上传到R并从R获得以下消息
> library(doSMP)
Loading required package: revoIPC
Error: package 'revoIPC' is not installed for 'arch=x64'
如何解决这个问题?似乎doSMP工作在R的32位分布上,而不是64位分布.
我还测试了以下程序
------------------------------------------------------
require(doSMP)
workers <- startWorkers(4) # My computer has 2 cores
registerDoSMP(workers)
# create a function to run in each itteration of the loop
check <-function(n) {
for(i in 1:1000)
{
sme <- matrix(rnorm(100), 10,10)
solve(sme)
}
}
times <- 10 # times to run the loop
# comparing the running time for each loop
system.time(x <- foreach(j=1:times ) %dopar% check(j)) # 2.56 seconds (notice that the first run would be slower, because of R's lazy loading)
system.time(for(j in 1:times ) x <- check(j)) # 4.82 seconds
# stop workers
---------------------------------------------------------------------------
我收到了来自R的以下消息
> workers <- startWorkers(4) # My computer has 2 cores
Error: could not find function "startWorkers"
> registerDoSMP(workers)
Error: could not find function "registerDoSMP"
非常感谢您的帮助.
托尼
最佳答案 错误消息
Loading required package: revoIPC
Error: package 'revoIPC' is not installed for 'arch=x64'
非常明确:您运行的是64位R,但是您没有加载doSMP所需的所有子组件,特别是缺少revoIPC包.
如果您是Revo客户,请与他们联系.如果没有,那么也许你需要为R考虑不同的并行计算解决方案.