我已經在Windows 7上安裝了R(64位)版本2.11.1,並且還包含了用於並行處理的「REvolution foreach windows bundle」中的doSMP和revoIPC。然後我上傳庫doSMP到R和來自RR在Windows 7上的64位並行處理doSMP
> 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"
你的幫助非常感謝。
託尼
謝謝德克。可能我會在帶有doMC的Linux平臺上嘗試。我是否正確,doSMP目前僅適用於Windows上的32位R? – Tony 2010-11-27 05:19:51