mpi4py在MPICH2上的安装

在阅读此文前,您已经顺利在cluster上安装并运行了C++版本的mpich2,如尚未成功,请阅读:

http://blog.csdn.net/baidu_24281959/article/details/51471017

1.  下载mpi4py:

https://bitbucket.org/mpi4py/mpi4py/downloads/

你也可以选择(python官方提供的多种安装方式):

yum方式笔者测试时已经失效,请选择easy_install或pip,

怎么安装pip/easy_install请参见:

http://blog.csdn.net/baidu_24281959/article/details/51524388

如果选择pip方式,请选择第二种:

pip install https://bitbucket.org/mpi4py/mpi4py/get/master.tar.gz

2.  如果读者顺利完成安装,请忽略以下内容,直接转到文末,这里写给自动化安装失败的读者:

Permissiondenied请在命令之前添加sudo

出现类似:

Processing mpi4py-2.0.0.tar.gz
Writing /tmp/easy_install-fJbrlu/mpi4py-2.0.0/setup.cfg
Running mpi4py-2.0.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-fJbrlu/mpi4py-2.0.0/egg-dist-tmp-hobcFp
no previously-included directories found matching 'misc'
no previously-included directories found matching 'conf/conda-recipes'
no previously-included directories found matching 'conf/appveyor'
no previously-included directories found matching 'conf/jenkins'
no previously-included directories found matching 'conf/travis'
/usr/bin/ld: cannot find -llmpe
collect2: ld returned 1 exit status
/usr/bin/ld: cannot find -lvt-mpi
collect2: ld returned 1 exit status
/usr/bin/ld: cannot find -lvt.mpi
collect2: ld returned 1 exit status
/usr/bin/ld: cannot find -lvt-mpi
collect2: ld returned 1 exit status
/usr/bin/ld: cannot find -lvt.mpi
collect2: ld returned 1 exit status
/usr/bin/ld: cannot find -lvt-hyb
collect2: ld returned 1 exit status
/usr/bin/ld: cannot find -lvt.ompi
collect2: ld returned 1 exit status
_configtest.c:2:17: error: mpi.h: No such file or directory
_configtest.c: In function ‘main’:
_configtest.c:6: warning: implicit declaration of function ‘MPI_Init’
_configtest.c:7: warning: implicit declaration of function ‘MPI_Finalize’
error: Setup script exited with error: Cannot compile MPI programs. Check yourconfiguration!!!

错误的读者,请下载mpi4py-1.3.1.tar.gz

3.  解压缩到指定文件夹下,这里我们直接解压缩到Downloads文件夹下:

tar –xgvf mpi4py_1.3.1.tar.gz
cd mpi4py_1.3.1

4.  修改该文件夹下mpi.cfg文件:

第45行,mpi_dir路径,根据当时安装mpich2的路径填写,笔者这里安装到了/opt/mpich2-1.4.1p1

mpi4py在MPICH2上的安装_第1张图片

5.  保存修改后,执行:

python setup.py install

会遭遇permission denied错误,此时再次执行:

sudo python setup.py install

如果出现中途卡死的情况,请删除mpi4py_1.3.1文件夹,再次重做步骤4,5。

 

之前可能需要先安装Cython以及python-dev,参见http://blog.csdn.net/baidu_24281959/article/details/51524388安装即可。

 

你可能感兴趣的:(Linux,python,cluster,MPI)