How to compile and install Octopus 9.1 with OpenMPI on CentOS 7
Oct 22, 2020 | 1684 views
!!! Recommend: You can also compile the latest Octopus with gcc version 8 with the same procedure.
================= 如何编译安装Octopus 9.1 =====================
说明!!!:using mpif90 as FC compiler when compiling blas, lapack, libxc libraries
According to "Normally it is necessary to compile all Fortran libraries with the same compiler. If you have trouble, try to look for help in the Octopus mailing list." [Testing_your_build]
参考资料:
1. Octopus安装-算盘
2. 安装 Octopus
3. wiki Manual:Building_from_scratch
4. wiki Manual:Installation#Testing_your_build
5. https://octopus-code.org/wiki/Manual:Installation
软件安装到/opt/目录下,如下
[root@mgt lapack-3.9.0]# ls -F /opt/ | more
BLAS-3.8.0/
fftw-3.3.8/
gsl-2.4/
HOW-Octopus-9.1-Was-Installed.txt
lapack-3.9.0/
libxc-4.3.4/
octopus-9.1/
openmpi-4.0.5/
安装一些必须的工具包:
---------------------
yum install -y autoconf automake libtool
--------------------
环境变量被更改到/etc/profile
--------------------
export LD_LIBRARY_PATH=/opt/gsl-2.4/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/openmpi-4.0.5/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/libxc-4.3.4//lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/fftw-3.3.8//lib:$LD_LIBRARY_PATH
export PATH=/opt/gsl-2.4/bin:$PATH
export PATH=/opt/openmpi-4.0.5/bin:$PATH
export PATH=/opt/octopus-9.1/bin:$PATH
export PATH=/opt/libxc-4.3.4//bin:$PATH
export PATH=/opt/fftw-3.3.8//bin:$PATH
=== 1. 编译安装openmpi-4.0.5 =======
Tutorial refer to https://www.jianshu.com/p/7309d3b1c735
Reference:
wget https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.5.tar.bz2
./configure --prefix=/opt/openmpi-4.0.5
make -j
make -j install
cd examples/
make
./hello_c
echo 'export LD_LIBRARY_PATH=/opt/openmpi-4.0.5/lib:$LD_LIBRARY_PATH' >> /etc/profile
echo 'export PATH=/opt/openmpi-4.0.5/bin:$PATH' >> /etc/profile
=== 2. 编译安装 BLAS-3.8.0/ ===
[root@mgt BLAS-3.8.0]# grep -v '^#' make.inc
SHELL = /bin/sh
PLAT = _LINUX
FORTRAN = mpif90
OPTS = -O3
DRVOPTS = $(OPTS)
NOOPT =
LOADER = mpif90
LOADOPTS =
ARCH = ar
ARCHFLAGS= cr
RANLIB = ranlib
BLASLIB = blas$(PLAT).a
mkdir -pv /opt/BLAS-3.8.0/
cp blas_LINUX.a /opt/BLAS-3.8.0/libblas.a
=== 3. 编译安装 lapack-3.9.0 ===
mv make.inc.example make.inc
### EDIT make.inc like below
[root@mgt lapack-3.9.0]# grep FC make.inc
# Modify the FC and FFLAGS definitions to the desired compiler
FC = mpif90
make -j
cd ..
tar cvf - lapack-3.9.0/*.a | tar xvf - -C /opt/
=== 可选但此教程有安装:编译安装 scalapack-2.1.0 ======
Tutorial can refer to 安装scalapack
wget https://github.com/Reference-ScaLAPACK/scalapack/archive/v2.1.0.tar.gz
[root@mgt scalapack-2.1.0]# grep -v '^#' SLmake.inc | grep -E 'BLAS|LAPACK'
SCALAPACKLIB = libscalapack.a
BLASLIB = /opt/BLAS-3.8.0/blas_LINUX.a
LAPACKLIB = /opt/lapack-3.9.0/liblapack.a
LIBS = $(LAPACKLIB) $(BLASLIB)
make -j
cd ..
tar cvf - scalapack-2.1.0 | tar xvf - -C /opt/
=== 4. 编译安装 libxc-4.3.4 ===
[root@mgt libxc-4.3.4]#
autoreconf -i
./configure --prefix=/opt/libxc-4.3.4 CC=gcc CXX=g++ FC=mpif90
make -j
make -j install
echo 'export LD_LIBRARY_PATH=/opt/libxc-4.3.4//lib:$LD_LIBRARY_PATH' >> /etc/profile
echo 'export PATH=/opt/libxc-4.3.4//bin:$PATH' >> /etc/profile
=== 5. 编译安装 gsl-2.4 =======
wget http://ftp.gnu.org/gnu/gsl/gsl-2.4.tar.gz
tar xvzf gsl-2.4.tar.gz
cd gsl-2.4
[root@mgt gsl-2.4]#
mkdir build-gsl
cd build-gsl/
../configure --prefix=/opt/gsl-2.4
make -j
make -j install
echo 'export LD_LIBRARY_PATH=/opt/gsl-2.4/lib:$LD_LIBRARY_PATH' >> /etc/profile
echo 'export PATH=/opt/gsl-2.4/bin:$PATH' >> /etc/profile
==== 6. 编译安装 fftw-3.3.8 ==========
wget http://fftw.org/fftw-3.3.8.tar.gz
tar xzvf fftw-3.3.8.tar.gz
cd fftw-3.3.8/
ls
less README
./configure --prefix=/opt/fftw-3.3.8
make -j
make install
ls /opt/fftw-3.3.8/
echo 'export LD_LIBRARY_PATH=/opt/fftw-3.3.8//lib:$LD_LIBRARY_PATH' >> /etc/profile
echo 'export PATH=/opt/fftw-3.3.8//bin:$PATH' >> /etc/profile
======== FINAL: 编译安装 Octopus 9.1 =============
wget https://octopus-code.org/download/9.1/octopus-9.1.tar.gz
tar xzf octopus-9.1.tar.gz
cd octopus-9.1/
ls
./configure --prefix=/opt/octopus-9.1 --with-libxc-prefix=/opt/libxc-4.3.4/ --with-gsl-prefix=/opt/gsl-2.4/ --with-blas=/opt/BLAS-3.8.0/libblas.a --with-lapack="-L/opt/lapack-3.9.0 -ltmglib -llapack" --with-scalapack="-L/opt/scalapack-2.1.0 -lscalapack" --with-fftw-prefix=/opt/fftw-3.3.8/ --enable-mpi
make -j
make install
echo 'export PATH=/opt/octopus-9.1/bin:$PATH' >> /etc/profile
# Test octopus 9.1 using a helloworld example