安装open-mpi 2018-03-01

为了安装iqtree的多线程版本,我先安装了openmpi

下载:https://www.open-mpi.org/software/ompi/v3.0/openmpi-3.0.1rc3.tar.gz

然后参考了http://blog.csdn.net/amaowolf/article/details/7938357

1.将openmpi-1.5.tar.gz 文件拷贝到一个临时的目录里面(如tem)

2.解压文件:$tar -zxvf openmpi-3.0.1rc3.tar.gz

3.进入解压后的目录:$cd openmpi-3.0.1rc3

4.$./configure --prefix=/home/zhenboying/software/openmpi-3.0.1rc3CC=iccCXX=icpcF77=ifort FC=ifort

注:要提前建立文件夹/home/zhenboying/software/openmpi-3.0.1rc3

5.$make all install

安装的过程超级长,可以干点别的

6. 环境配置:

首先,vi ~/.bashrc (打开文件.bashrc,按i 进入编辑状态)添加

export PATH=/home/zhenboying/software/openmpi-3.0.1rc3/bin:$PATH

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/zhenboying/software/openmpi-3.0.1rc3/lib

ESC

:x

关闭之后 source ~/.bashrc(使设置起作用,以后再新进入shell 之后直接可以用

安装完成后,进入安装文件包的examples目录,make,编译完测试程序

mpicc -g    hello_c.c   -o hello_c

mpicc -g    ring_c.c   -o ring_c

make[1]: Entering directory `/home/zhenboying/software/openmpi-3.0.1rc3/examples'

mpic++ -g    hello_cxx.cc   -o hello_cxx

mpic++ -g    ring_cxx.cc   -o ring_cxx

make[1]: Leaving directory `/home/zhenboying/software/openmpi-3.0.1rc3/examples'

make[1]: Entering directory `/home/zhenboying/software/openmpi-3.0.1rc3/examples'

mpif77 -g hello_f77.f -o hello_f77

mpif77 -g ring_f77.f -o ring_f77

make[1]: Leaving directory `/home/zhenboying/software/openmpi-3.0.1rc3/examples'

make[1]: Entering directory `/home/zhenboying/software/openmpi-3.0.1rc3/examples'

mpif90 -g hello_f90.f90 -o hello_f90

mpif90 -g ring_f90.f90 -o ring_f90

make[1]: Leaving directory `/home/zhenboying/software/openmpi-3.0.1rc3/examples'

最后,测试一下mpirun -np 2  /homezhenboying/software/openmpi-3.0.1rc3/examples/hello_f90, 没有出问题应该结果是:

测试失败如果是example的问题也没关系。

Hello, world, I am            1  of            2

Hello, world, I am            0  of            2

注意:openmpi 卸载,可以直接删除安装文件

你可能感兴趣的:(安装open-mpi 2018-03-01)