尝试doSMP示例时出错

时间:2011-07-22 18:10:42

标签: r parallel-processing

我正在尝试在doSMP插图中运行简单示例,但会收到以下错误。首先,我不确定现有的doSMP会话是怎么回事,因为我在重新启动机器后立即执行了下面的代码。此外,有关包doSMP不存在的重复错误,但库(doSMP)调用工作正常。帮助!

> librayr(doSMP)
Error: could not find function "librayr"
> library(doSMP)
Loading required package: foreach
Loading required package: iterators
Loading required package: codetools
foreach: simple, scalable parallel programming from Revolution Analytics
Use Revolution R for scalability, fault tolerance and more.
http://www.revolutionanalytics.com
Loading required package: revoIPC
Warning messages:
1: package 'doSMP' was built under R version 2.13.1
2: package 'foreach' was built under R version 2.13.1
3: package 'revoIPC' was built under R version 2.13.1
> w <- startWorkers(workerCount=4)
Warning messages:
1: In startWorkers(workerCount = 4) :
  there is an existing doSMP session using doSMP1
2: In startWorkers(workerCount = 4) :
  there is an existing doSMP session using doSMP2
> Error in library(doSMP) : there is no package called 'doSMP'
Calls: suppressMessages -> withCallingHandlers -> library
Execution halted
Error in library(doSMP) : there is no package called 'doSMP'
Calls: suppressMessages -> withCallingHandlers -> library
Execution halted
Error in library(doSMP) : there is no package called 'doSMP'
Calls: suppressMessages -> withCallingHandlers -> library
Execution halted
Error in library(doSMP) : there is no package called 'doSMP'
Calls: suppressMessages -> withCallingHandlers -> library
Execution halted

2 个答案:

答案 0 :(得分:1)

关闭这个问题 - 包装太麻烦了。如果其他人已经让它可靠地工作,那么请回复,我将取消标记这个帖子作为答案。

答案 1 :(得分:0)

每当调用startWorkers函数时,doSMP都会创建一个任务队列。如果在退出R会话之前没有调用stopWorkers(),则退出R后,用于启动任务队列的进程间通信资源仍然存在。

您可以按如下方式删除任务队列:

>rmSessions(all.names=TRUE)
attempting to delete qnames: doSMP1, doSMP2, doSMP3, doSMP4, doSMP5, doSMP6, doSMP7, doSMP8
successfully deleted queues: doSMP1, doSMP2, doSMP3, doSMP4, doSMP5

现在对startWorkers()的任何后续调用都不会产生任何警告。这在'rmSessions'的帮助文件中有记录。

斯蒂芬·韦勒(Stephen Weller) Revolution Analytics技术支持工程师
Revolution Analytics,Inc。
1505 Westlake Ave North Suite 300
西雅图,WA 98109