编译模板:OpenMPI


1.OpenMPI-4.1.4 Linux-x86_64 / intel编译器
 module load intel-compiler-2020-x86_64
mkdir $openmpi_dir/build
cd $openmpi_dir/build
../configure --prefix=/home/MyID/Tool/OpenMPI CC=icc CXX=icpc F77=ifort FC=ifort

根据需要,还可以加上参数 --enable-mpi-cxx , --enable-mpi-fortran ,和 --enable-static

make -j4
make install(若定义了--prefix执行此步,可选)

编译结束后,添加环境变量:
export PATH=/home/MyID/Tool/OpenMPI/bin:$PATH
export LIBRARY_PATH=/home/MyID/Tool/OpenMPI/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=/home/MyID/Tool/OpenMPI/lib:$LD_LIBRARY_PATH
export CPATH=/home/MyID/Tool/OpenMPI/include:$CPATH

验证:
which mpicc
which mpic++
which mpif77
which mpif90