带Machinefile的IPython MPI

带Machinefile的IPython MPI,ipython,mpi,distributed-computing,Ipython,Mpi,Distributed Computing,我想将IPython的MPI功能用于分布式计算。也就是说,我希望MPI能够运行一个机器文件,这样我就可以添加多台机器 编辑: 我忘了包括我的配置 配置 ~/.ipython/profile_default/ipcluster_config.py # The command line arguments to pass to mpiexec. c.MPILauncher.mpi_args = ["-machinefile ~/.ipy

我想将IPython的MPI功能用于分布式计算。也就是说,我希望MPI能够运行一个机器文件,这样我就可以添加多台机器

编辑:

我忘了包括我的配置

配置

~/.ipython/profile_default/ipcluster_config.py
# The command line arguments to pass to mpiexec.                                
c.MPILauncher.mpi_args = ["-machinefile ~/.ipython/profile_default/machinefile"]


# The mpiexec command to use in starting the process.                           
c.MPILauncher.mpi_cmd = ['mpiexec']
Bash执行

$ dacluster start -n20
2015-06-10 16:16:46.661 [IPClusterStart] Starting ipcluster with [daemon=False]
2015-06-10 16:16:46.661 [IPClusterStart] Creating pid file: /home/aidan/.ipython/profile_default/pid/ipcluster.pid
2015-06-10 16:16:46.662 [IPClusterStart] Starting Controller with MPI
2015-06-10 16:16:46.700 [IPClusterStart] ERROR | IPython cluster: stopping
2015-06-10 16:16:47.667 [IPClusterStart] Starting 20 Engines with MPIEngineSetLauncher
2015-06-10 16:16:49.701 [IPClusterStart] Removing pid file: /home/aidan/.ipython/profile_default/pid/ipcluster.pid
机械文件

~/.ipython/profile_default/machinefile

localhost slots=8
aidan-slave slots=16
我可能会提到,它在我跑步时起作用

mpiexec -machinefile machinefile mpi_hello
该执行的输出包括主机名,因此我确信它实际上正在分发。加上我在上面看


谢谢你,我想我问得太早了。问题在下面一行

c.MPILauncher.mpi_args = ["-machinefile ~/.ipython/profile_default/machinefile"]
它应该在具有绝对路径的空间上拆分

c.MPILauncher.mpi_args = ["-machinefile", "/home/aidan/.ipython/profile_default/machinefile"]
我希望这能帮助别人。注意,这只解决了BASH输出中的问题。通过MPI连接到远程服务器(即aidan从服务器)。如果启动dacluster,我会在顶部看到一堆python会话启动,这是远程运行IPython会话的症状

不幸的是,DistArray示例(至少是pi_montecarlo)无限期地挂起。我回到问题的根源,发现在distarray中globalapi模块的context.py文件的第736行中挂起的行

def _execute(self, lines, targets):
    return self.view.execute(lines, targets=targets, block=True)

我认为这是MPI连接中断或损坏的症状,因为该行似乎希望在所有从属进程上执行命令。我不知道如何修复它。

您的问题是什么?对不起,为什么我会在Bash执行中列出错误?我该如何修复它们呢?不,我只是放弃了,自己写了MPI代码。根据您想做什么,我建议您(在使用MPI进行了数月的黑客攻击之后)自己编写代码,并使用它来分析代码以进行进一步优化。关于MPI并行化的文献通常使用OpenMP在本地进行并行化,然后使用MPI在集群中的不同节点之间进行通信。