Page 1 of 1

VASP 6.2.1 compilation on Ubuntu 18.04.6 error

Posted: Sat Sep 25, 2021 3:30 pm
by meng-fu_chen
Greetings:

Recently we are compiling VASP 6.2.1 on our machine, with Ubuntu 18.04.6, using gcc 7.5.0. We also have DFT-D4 installed and want to link VASP to the D4 package.
However when we are compiling we always get error message on "undefined reference to..." in scalapack.
For example, this kind of message:
"/usr/lib/x86_64-linux-gnu/scalapack/libscalapack.a(BI_BlacsAbort.o): In function `BI_BlacsAbort':
BI_BlacsAbort.c:(.text+0x20): undefined reference to `ompi_mpi_comm_world'"

The makefile.include and make logs are in the attached file. Could someone please provide us help with this issue, thanks!

Re: VASP 6.2.1 compilation on Ubuntu 18.04.6 error

Posted: Mon Sep 27, 2021 12:09 pm
by andreas.singraber
Hello!

Indeed, there is a large amount of linking issues in the log files.. but it's not only related to ScaLAPACK, there are also undefined references to BLAS and LAPACK functions. Also, the linking to DFT-D4 will not work correctly, since it says in the log:

Code: Select all

make[2]: pkg_config: Command not found
while you are using it in the makefile.include to locate DFT-D4:

Code: Select all

LLIBS      = $(SCALAPACK) $(LAPACK) $(BLAS) $(shell pkg_config --libs dftd4)
I would suggest to start simple and first fix the compilation without DFT-D4. The error you mentioned in your post

Code: Select all

undefined reference to `ompi_mpi_comm_world'
hints that you are maybe linking to the wrong ScaLAPACK library. Looking at the Ubuntu repositories I can see that there are two versions of ScaLAPACK, compiled with either OpenMPI or MPICH (which are two independent implementations of MPI). The packages are named libscalapack-mpich-dev and libscalapack-openmpi-dev. Can you check which of them is actually installed/used? In other words, the makefile.include uses

Code: Select all

/usr/lib/x86_64-linux-gnu/scalapack/libscalapack.a
and it could be the one not matching with your MPI used for compiling. Could you please also post the output of these two commands so that we know exactly which MPI you are using:

Code: Select all

mpif90 -show
mpif90 -showme:link
Thank you!

All the best,

Andreas Singraber

Re: VASP 6.2.1 compilation on Ubuntu 18.04.6 error

Posted: Wed Sep 29, 2021 9:05 am
by meng-fu_chen
Greetings:

Hi, thanks for the reply.

Using the command "mpif90 -show" this is the output:

"gfortran -I/opt/intel/compilers_and_libraries_2018.1.163/linux/mpi/intel64/include/gfortran -I/opt/intel/compilers_and_libraries_2018.1.163/linux/mpi/intel64/include -L/opt/intel/compilers_and_libraries_2018.1.163/linux/mpi/intel64/lib/release_mt -L/opt/intel/compilers_and_libraries_2018.1.163/linux/mpi/intel64/lib -Xlinker --enable-new-dtags -Xlinker -rpath -Xlinker /opt/intel/compilers_and_libraries_2018.1.163/linux/mpi/intel64/lib/release_mt -Xlinker -rpath -Xlinker /opt/intel/compilers_and_libraries_2018.1.163/linux/mpi/intel64/lib -Xlinker -rpath -Xlinker /opt/intel/mpi-rt/2017.0.0/intel64/lib/release_mt -Xlinker -rpath -Xlinker /opt/intel/mpi-rt/2017.0.0/intel64/lib -lmpifort -lmpi -lmpigi -ldl -lrt -lpthread"

As for the versions of ScaLAPACK you mentioned, I think the SCALAPACK we linked to is not those two, because we only newly installed it from an external download. Could you advise us on which SCALAPACK we should install/use and the command for it?

Thanks for your time!

Re: VASP 6.2.1 compilation on Ubuntu 18.04.6 error

Posted: Thu Sep 30, 2021 10:09 am
by andreas.singraber
Hey,

ok, it seems you are using a combination of GCC compiler (gfortran) + Intel libraries, because all your include and link directories point to some "intel" subdirectories. Were you aware of this situation and is this done on purpose? I would not recommend mixing Intel and GCC unless you know exactly what your are doing...

If you already have the Intel compiler installed anyway, I would rather also use their compiler (instead of mpif90 which invokes gfortran) which is called mpiifort. Can you check whether this exists on your system? If you cannot find it, you may have to run

Code: Select all

source /opt/intel/compilers_and_libraries_2018.1.163/setvars.sh
or similar... I don't know the exact procedure for the 2018 Intel compiler. Please have a look at the compiler's documentation for setting it up correctly.

If you are going to use the Intel compiler, please also use the corresponding makefile.include as a basis.. you can find it in the VASP directory:

Code: Select all

arch/makefile.include.linux_intel_omp
Just use this instead of your current makefile.include and do a

Code: Select all

make veryclean
before trying to recompile the code.

Best,

Andreas Singraber