IPython并行计算无法正常工作

时间:2011-10-30 15:17:30

标签: parallel-processing ipython

我正在尝试在Linux机器上运行ipython并行编程(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并行处理工作?

3 个答案:

答案 0 :(得分:1)

在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次测试都通过了。

答案 1 :(得分:0)

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

答案 2 :(得分:0)

ipcluster对它使用的配置文件(配置文件)有何看法?

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

Create(profile='myprofile')

Create(profile="default_profile')
相关问题