IPython并行计算不工作

发布于 2024-12-12 09:35:32 字数 981 浏览 0 评论 0原文

我试图让 ipython 并行编程在 Linux 机器上工作(Rocks/CentOS 5.4、Python 2.7.2、IPython 0.11)。安装没有问题,但是,我无法使用 ipcluster/ipython 执行任何命令。

也就是说,我尝试了以下命令。在 ipcluster 端:

/share/apps/Python-2.7/bin/ipcluster start --n=4

ipython 端:

[malkarouri@grid02 ~]$ /share/apps/Python-2.7/bin/ipython
Python 2.7.2 (default, Oct 18 2011, 15:35:37) 
Type "copyright", "credits" or "license" for more information.

IPython 0.11 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from IPython.parallel import Client

In [2]: rc=Client()

In [3]: dview=rc[:]

In [4]: ar=dview.apply_async(lambda x: x + 3, 7)

In [5]: ar.get()

之后最后一个命令永远不会返回答案(实际上挂起)。

如何让 ipython 并行处理工作?

I am trying to get ipython parallel programming working on a Linux machine (Rocks/CentOS 5.4, Python 2.7.2, IPython 0.11). The installation had no problems, however, I am unable to execute any command using ipcluster/ipython.

Namely, I tried the following commands. On the ipcluster side:

/share/apps/Python-2.7/bin/ipcluster start --n=4

On the ipython side:

[malkarouri@grid02 ~]$ /share/apps/Python-2.7/bin/ipython
Python 2.7.2 (default, Oct 18 2011, 15:35:37) 
Type "copyright", "credits" or "license" for more information.

IPython 0.11 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from IPython.parallel import Client

In [2]: rc=Client()

In [3]: dview=rc[:]

In [4]: ar=dview.apply_async(lambda x: x + 3, 7)

In [5]: ar.get()

after which the last command never comes back with an answer (effectively hangs).

How can I get ipython parallel processing to work?

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

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

发布评论

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

评论(3

超可爱的懒熊 2024-12-19 09:35:32

在 Ubuntu 11.10、python 2.7.2、ipython 0.11(与 pip 一起安装)上尝试了您的示例,它可以工作:

In [5]: ar.get()
Out[5]: [10, 10, 10, 10]

您可能想尝试为并行模块运行 ipython 测试套件,看看它在哪里失败:

iptest -v IPython.parallel

在我的机器上,所有 97 个测试都通过。

tried your example on Ubuntu 11.10, python 2.7.2, ipython 0.11 (installed with pip) and it works:

In [5]: ar.get()
Out[5]: [10, 10, 10, 10]

you might want to try run the ipython test suite for the parallel module and see where it fails:

iptest -v IPython.parallel

on my machine all 97 tests pass.

山有枢 2024-12-19 09:35:32

尝试定义一个函数,而不是 lambda 函数。

Try defining a function, not a lambda function.

终止放荡 2024-12-19 09:35:32

ipcluster 关于它使用的配置文件(配置文件)说了些什么?

尝试在 Client() 创建中指定配置文件

Create(profile='myprofile')

Create(profile="default_profile')

What does ipcluster said about the config files (profile ) it used ?

Try specifying the profile in the Client() creation

Create(profile='myprofile')

or

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