大数据基础(一)openmpi,mpich,mpi4py在ubuntu 16.04下的安装指南

http://blog.csdn.net/dst1213/article/details/51171261

安装mpi4py的方法

直接pip install mpi4py不可取。
需要安装以下依赖包:
https://bitbucket.org/mpi4py/mpi4py/src
Dependencies
Python 2.6, 2.7, 3.2 or above, or PyPy 2.0 or above.
A functional MPI 1.x/2.x/3.x implementation like MPICH or Open MPI built with shared/dynamic libraries.
To work with the in-development version, you need to install Cython.
默认已安装有anaconda python 2.7.11
依赖包:
1. openmpi
http://blog.csdn.net/swuteresa/article/details/9405383
1.1 编译器的检查
gcc --version
g++ --version
python --version


1.2.下载(可先cd /opt/目录下再wget)
URL: http://www.open-mpi.org/software/ompi/v1.10/
wget https://www.open-mpi.org/software/ompi/v1.10/downloads/openmpi-1.10.2.tar.gz
tar xvzf openmpi-1.10.x.tar.gz
cd openmpi-xxx/
1.3.安装openMPI(默认至目录:/usr/local/lib):
./configure
1.4.安装所有需要的文件:
sudo make all install
1.5.添加库共享路径:
sudo gedit /etc/profile
在profile文件的最后加上一行:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
如果是ubuntu server 则 vi ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
使该配置文件生效:
source /etc/profile
1.6.进行测试:
cd openmpi-1.10.2/examples
make
mpirun -np 4 hello_c
注意:如果是root账户会提示添加 --allow.xxx参数


2. mpich 和 Cython 二选一安装,都装了比较保险

http://www.mpich.org/downloads/
wget http://www.mpich.org/static/downloads/3.2/mpich-3.2.tar.gz
tar xvzf mpich.xxx.tar.gz
cd mpich.xxx/
./configue
make
make install
3. Cython
wget https://pypi.python.org/packages/source/C/Cython/Cython-0.23.4.tar.gz#md5=157df1f69bcec6b56fd97e0f2e057f6e
tar xvzf Cython.xxx.tar.gz好像whl在ubuntu server 14下无法安装
cd Cython.xxx/
./configure
如果报错没有 fortran 77 compiler 就安装一个,如果./configure再报fortran 90 compiler不管,
apt-get install fortran77-compiler
./configure
make
python setup.py install
检查
ipython下
输入import Cython,无错误提示表示成功

4.安装mpi4py
https://pypi.python.org/pypi/mpi4py/#downloads
ubuntu server 14.04用whl安装有错误提示,用tar.gz即可
wget https://pypi.python.org/packages/source/m/mpi4py/mpi4py-2.0.0.tar.gz#md5=4f7d8126d7367c239fd67615680990e3
tar xvzf mpi4py.xxx.tar.gz
cd mpi4py.xxx/
python setup.py install
检查
ipython下
输入import mpi4py
输入from mpi4py import MPI
均无错误提示,表示安装成功。

你可能感兴趣的:(HPC)