Top

How to compile and install Octopus 9.1 with OpenMPI on CentOS 7

Oct 22, 2020 | 1510 views

#InstallGuide

!!! 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:

- openmpi building#easy-build


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 



Leave a comment

4 comments

Ali Kazempour Oct. 27, 2020, 7:03 p.m.

Dear friend I follow exactly the same procedure for octopus-9.2 as above, but I faced error: I used this configure script: ./configure --prefix=/opt/octopus-9.2 --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 after make -j I get following error: ====================== Warning: Variable 'spglib_error' at (1) is a parameter to the BIND(C) procedure 'spg_get_error_message_c' but may not be C interoperable ions/spglib_f08.f90:510.33: call spg_free_dataset_c(dset_c) 1 Error: Type mismatch in argument 'dataset' at (1); passed TYPE(spglibdataset_c) to REAL(4) mpif90 -O3 -I ../external_libs/bpdn -I ../external_libs/dftd3 -I ../external_libs/spglib-1.9.9/src/ -I /opt/libxc-4.3.4//include -I/opt/fftw-3.3.8//include -c -o basic/multicomm.o basic/multicomm_oct.f90 mpif90 -O3 -I ../external_libs/bpdn -I ../external_libs/dftd3 -I ../external_libs/spglib-1.9.9/src/ -I /opt/libxc-4.3.4//include -I/opt/fftw-3.3.8//include -c -o basic/space.o basic/space_oct.f90 make[2]: *** [ions/spglib_f08.o] Error 1 make[2]: *** Waiting for unfinished jobs.... mpif90 -O3 -I ../external_libs/bpdn -I ../external_libs/dftd3 -I ../external_libs/spglib-1.9.9/src/ -I /opt/libxc-4.3.4//include -I/opt/fftw-3.3.8//include -c -o basic/mpi_debug.o basic/mpi_debug_oct.f90 math/math.F90:832: ; return 1 Error: Semicolon at (1) needs to be preceded by statement math/math.F90:839: ; return 1 Error: Semicolon at (1) needs to be preceded by statement basic/mpi_debug.F90:159.14: sec_out = MPI_Wtime() 1 Error: Function 'mpi_wtime' at (1) has no IMPLICIT type basic/mpi_debug.F90:143.13: sec_in = MPI_Wtime() 1 Error: Function 'mpi_wtime' at (1) has no IMPLICIT type make[2]: *** [basic/mpi_debug.o] Error 1 basic/multicomm.F90:589.34: mc%full_comm = MPI_COMM_NULL 1 Error: Symbol 'mpi_comm_null' at (1) has no IMPLICIT type make[2]: *** [basic/multicomm.o] Error 1 make[2]: *** [math/math.o] Error 1 make[2]: Leaving directory `/root/octopus-9.2/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/root/octopus-9.2' make: *** [all] Error 2 [root@localhost octopus-9.2]# ========================= How can I fix the error? I am unsing centos6.8. Thanks a lot I

Author Oct. 28, 2020, 1:12 p.m.

Hi, Ali. I think you should try in CentOS 7. You can also compile the latest Octopus (10.2) with gcc8 (https://stateofemptiness.com/post/install-gcc8-in-centos-7). Compile OpenMPI or MPICH first, then follow the same procedure.

Ali Kazempour Nov. 4, 2020, 3:40 p.m.

Hi I installed centos 7 and the octopus-9.1 is installed successfully. But the above setting does not work for octopus-develop version.

Ali Kazempour Nov. 4, 2020, 4:59 p.m.

Hi The above setting also does not work and fails to be installed using gcc8 for compiling octopus-10.2 on centos 7. Thanks