【问题标题】:IPython parallel computing not workingIPython并行计算不起作用
【发布时间】:2011-10-30 15:17:30
【问题描述】:

我正在尝试让 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 并行处理工作?

【问题讨论】:

    标签: parallel-processing ipython


    【解决方案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 个测试都通过了。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        【解决方案3】:

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

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

        Create(profile='myprofile')
        

        Create(profile="default_profile')
        

        【讨论】:

          猜你喜欢
          • 2014-09-18
          • 2011-07-26
          • 2015-09-09
          • 2012-08-31
          • 1970-01-01
          • 1970-01-01
          • 2017-10-16
          • 2011-08-13
          • 1970-01-01
          相关资源
          最近更新 更多