如何在 2 核 MacBook Pro 上运行多核?

发布于 2024-12-08 21:25:50 字数 699 浏览 0 评论 0原文

所以这段代码:

library(plyr)
library(doMC) 
registerDoMC(cores=2) 
x=1:100
llply(x, some_function, .parallel=TRUE)

失败并出现如下错误:

__THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__ ()

当我从终端运行 R 时,错误消失。所以是 GUI 的一些东西破坏了它。不幸的是,我与协作者共享此代码,因此我无法要求他们从终端运行它。此论坛帖子说< em>看来 doMC 后端的这个问题是由于我一直在采购“/Applications/R.app/Contents/Resources/GUI-tools.R”但我不是故意这样做的在R.app。有什么办法可以消除这种相互冲突的行为吗?

我的 Mac 规格:还运行 R GUI 2.13.1。 OSX 10.7.1,doMC 版本 1.2.3,带 64 位 R.app。还有配备 Intel Core 2 Duo 的 MB Pro 2.53

So this bit of code:

library(plyr)
library(doMC) 
registerDoMC(cores=2) 
x=1:100
llply(x, some_function, .parallel=TRUE)

fails with an error like so:

__THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__ ()

the error disappears when I run R from terminal. So it's something about the GUI that breaks it. Unfortunately, I share this code with collaborators and so I can't ask them to run it from the terminal. This forum post says It looks as if this problem w/ the doMC backend was coming from my having been sourcing the "/Applications/R.app/Contents/Resources/GUI- tools.R" but I am not intentionally doing that in R.app. Is there any way to turn off this conflicting behavior?

My Mac specs: Also running R GUI 2.13.1. OSX 10.7.1, doMC Version 1.2.3 with 64bit R.app. Also have a MB Pro 2.53 with Intel Core 2 Duo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我也只是我 2024-12-15 21:25:50

如果您想要真正的答案,请在 R-SIG-Mac 上询问;)。这与 GUI 工具无关,它与子进程中运行的 Cocoa 事件循环有关 - 有关 GUI 的警告,请参阅 ?multicore。您可能想要更新到更新的多核,这会禁用 GUI 中的事件循环(如果可能)。还要避免在您运行的代码中进行任何 Quartz 图形调用。

Ask on R-SIG-Mac if you want real answers ;). This has nothing to do with the GUI tools, it has to do with the Cocoa running event loop in the children - see ?multicore for the warning about GUIs. You may want to update to more recent multicore which disables the event loop in the GUI (if possible). Also avoid any Quartz graphics calls in the code you run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文