1.4. OpenMPI
1.4.1. 参考网站
FAQ: Building Open MPI (open-mpi.org)
1.4.2. 安装过程
1wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.4.tar.gz
2tar -xvf openmpi-4.1.4.tar.gz
3
4cd openmpi-4.1.4
5
6# ./configure
7# 默认安装目录: /usr/local/lib/openmpi
8# 自定义目录: ./configure --prefix=$HOME/opt/openmpi
9# 指定编译器 ./configure CC=gcc CXX=g++ F77=gfortran FC=gfortran
10
11./configure --prefix=$HOME/opt/openmpi
12make all install
1.4.3. 添加环境变量
To use MPI you will have to adapt your PATH and LD_LIBRARY_PATH
environment variable. This appends the two lines to .bashrc file
which is executed when starting a terminal session.
1# 有多个版本的mpi时, 默认使用路径中靠前的版本
2
3echo "# OpenMPI-4.1.4" >> $HOME/.bashrc
4echo "MPI_HOME=$HOME/opt/openmpi"
5echo "export PATH=${MPI_HOME}/bin:$PATH" >> $HOME/.bashrc
6echo "export LD_LIBRARY_PATH=${MPI_HOME}/lib:$LD_LIBRARY_PATH" >> $HOME/.bashrc
7echo "export MANPATH=${MPI_HOME}/share/man:$MANPATH" >> $HOME/.bashrc
8echo ' ' >> $HOME/.bashrc
9source ~/.bashrc
10
11mpicc -v
1.4.4. 卸载
The make uninstall process from Open MPI a.b.c build tree should completely uninstall that version from the installation tree. Remove the old installation directory entirely and then install the new version.
1.4.5. 测试
1cd openmpi-4.1.4/examples
2make
1.4.6. mpi4py
1pip install mpi4py