One - One Code All

Blog Content

openmpi的安装

Linux-Mac   2018-06-21 22:15:06


openmpi官网: https://www.open-mpi.org/
openmpi文档:https://www.open-mpi.org/doc/current/
openmpi下载:https://www.open-mpi.org/software/ompi/v3.1/

安装
1) 下载openmpi
2) tar -xzvf openmpi-3.1.2.tar.gz
3) cd openmpi-3.1.2
4) ./configure  --with-devel-headers--with-slurm --prefix=/usr/local/openmpi | tee ../install.log
5) make all | tee ../make.log
6) make install | tee ../install2.log

 

配置环境
7) vi /etc/ld.so.conf  最后增加一行
/usr/local/openmpi/lib
保存退出
8) /sbin/ldconfig   回车等待。
9) vi /etc/profile, 最后 增加一行:

PATH=${PATH}:/usr/local/openmpi/bin



保存退出

10)执行
. /etc/profile

打开新的终端,使环境变量生效。

测试是否安装成功

10)cd examples
11) make

12)
mpirun -np 4 hello_c
mpirun  -np 4 ./hello_f90              可以得到类似ppt中的输出

 mpi多机时, 需要有machines文件。文件内容如下:

tp1 1 /home/pact/mpich/examples/basic/cpi
tp2 1 /home/pact/mpich/examples/basic/cpi
tp3 1 /home/pact/mpich/examples/basic/cpi

分别表示机器名/ip,  进程个数, 进程名(进程名可以没有); 当使用机器名时, 则需要架设DNS服务器。

mpirun -machinefile ./machine.linux -np 4 ./hello_f90


上一篇:mac mysql导出数据找不到mysqldump
下一篇:mpi编译时出现 MPI has not been declared 错误

The minute you think of giving up, think of the reason why you held on so long.