Page 1 of 1

Compiling VASP on Ubuntu 22.04

Posted: Mon Jan 13, 2025 3:29 pm
by jamboNum5

Hi There

I had tried a few attempts to get VASP going, I managed to find this previous post which discussed compiling VASP on Ubuntu 20.04/22.04, this gave some good tips on getting VASP compiling successfully. My makefile is the same as the post below:

https://vrruwv.vasp.at/forum/viewtopic.php?t=18800

Code: Select all

# Default precompiler options
CPP_OPTIONS = -DHOST=\"LinuxGNU\" \
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
-DscaLAPACK \
-DCACHE_SIZE=4000 \
-Davoidalloc \
-Dvasp6 \
-Duse_bse_te \
-Dtbdyn \
-Dfock_dblbuf \
-D_OPENMP

CPP = gcc -E -C -w $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS)

FC = mpif90 -fopenmp
FCL = mpif90 -fopenmp

FREE = -ffree-form -ffree-line-length-none

FFLAGS = -w -ffpe-summary=none

OFLAG = -O2
OFLAG_IN = $(OFLAG)
DEBUG = -O0

OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
OBJECTS_O2 += fft3dlib.o

# For what used to be vasp.5.lib
CPP_LIB = $(CPP)
FC_LIB = $(FC)
CC_LIB = gcc
CFLAGS_LIB = -O
FFLAGS_LIB = -O1
FREE_LIB = $(FREE)

OBJECTS_LIB = linpack_double.o

# For the parser library
CXX_PARS = g++
LLIBS = -lstdc++

# When compiling on the target machine itself, change this to the
# relevant target when cross-compiling for another architecture
VASP_TARGET_CPU ?= -march=native
FFLAGS += $(VASP_TARGET_CPU)

# For gcc-10 and higher (comment out for older versions)
FFLAGS += -fallow-argument-mismatch

# BLAS and LAPACK (mandatory)
#OPENBLAS_ROOT ?= /path/to/your/openblas/installation
BLASPACK = -lopenblas

# scaLAPACK (mandatory)
#SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
SCALAPACK = -lscalapack-openmpi

LLIBS += $(SCALAPACK) $(BLASPACK)

# FFTW (mandatory)
#FFTW_ROOT ?= /path/to/your/fftw/installation
LLIBS += -lfftw3 -lfftw3_omp
INCS += -I/usr/include

# HDF5-support (optional but strongly recommended)
CPP_OPTIONS+= -DVASP_HDF5
#HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L/usr/lib/x86_64-linux-gnu/hdf5/openmpi/ -lhdf5_fortran
INCS += -I/usr/include/hdf5/openmpi/

Issue One
Following the wiki/index.php/Validation_tests, I kicked off the make runtest binary to make sure everything was running correctly. There seems to be some errors with the andersen_nve section, I have attached the full output from the log as a compressed file as it rather long.

CASE: andersen_nve
ERROR: the test yields different results for the energies, please check
ERROR: the test yields different results for the forces, please check
ERROR: the stress tensor is different, please check

Issue Two

When the Academic tried to run some tests, they had a message regarding the execve call failing (see screenshot). I'm not quite sure which test was being ran here.

I don't know a great deal about this software as I'm a sys-admin, just worried there might be something wrong with the compiled version.

Thanks in advance, James


Re: Compiling VASP on Ubuntu 22.04

Posted: Mon Jan 13, 2025 8:03 pm
by ahampel

Dear James,

thank you for posting your question in the official VASP forum.

I will try to break down your question into three parts.

1) problem with test
Is the andersen_nve test the only one that fails? If so please share the test output / error log with us. You can do this by first setting following environment variable:

Code: Select all

export VASP_TESTSUITE_TESTS="andersen_nve"

and the run the testsuite again, i.e. make test &> log &. This should only execute this test and the log file should tell us better what went wrong. andersen_nve is a GAMMA point test. So it requires the vasp_gam binary. Maybe something is wrong with that?

2) the makefile
I think the makefile looks fine. Please also check: wiki/index.php/Personal_computer_installation#Ubuntu . I can just recommend that for cluster usage obenblas will probably not perform very well. Please check whether there is the possibility of using another blas implementation, i.e. intel MKL or similar. This is merely a performance recommendation, but VASP should definitely run.

3) the user error
The error very suspiciously says: "permission denied" . Can you check if the specified executable path of the user is correct? I wonder why the user would start something from build/std (that should work), but make will place all executables of VASP into the vasp_dir/bin/ dir. If this is correct can you check permission settings for that file. If that is all fine, execve call failing could also be with MPI due to problems of slurm allocations, i.e. if the user tries to run something via MPI and did not prior allocate resources.

Let me know if this gets things going and I am happy to dig further if this did not help.

Best,
Alex H.


Re: Compiling VASP on Ubuntu 22.04

Posted: Wed Jan 15, 2025 10:29 am
by jamboNum5

Thanks for your quick reply.

I'll take a look at running the test suite for andersen_nve only and send over the results. There was some ref to it in the log that I attached in the original post, but this is a bit too science specific for my sys-admin brain :)

In regards to point 2. I hadn't seen the Ubuntu specific instructions you linked, I was working from the main README file from the install dir. I went ahead and tried recompiling from scratch inline with the Ubuntu instructions and ran into a bit of a bump.

Code: Select all

...f951: Warning: Nonexistent include directory ‘/include’ [-Wmissing-include-dirs]
f951: Warning: Nonexistent include directory ‘/include’ [-Wmissing-include-dirs]
f951: Warning: Nonexistent include directory ‘/include’ [-Wmissing-include-dirs]
f951: Warning: Nonexistent include directory ‘/include’ [-Wmissing-include-dirs]
make[2]: *** [makefile:166: vhdf5_base.o] Error 1
make[2]: *** Waiting for unfinished jobs....
vhdf5_base.F:6:7:

    6 |   use hdf5
      |       1
Fatal Error: Cannot open module file ‘hdf5.mod’ for reading at (1): No such file or directory

The hds5.mod file does exist, when I search the files, it loads up the following location below.

Code: Select all

/usr/include/hdf5/serial/hdf5.mod
/usr/include/hdf5/openmpi/hdf5.mod

I tried setting /usr/include/hdf5 as the HDF5_ROOT install dir on the off chance this would help VASP file the mod files, but this didn't seem to help and caused other issues.

Many thanks


Re: Compiling VASP on Ubuntu 22.04

Posted: Wed Jan 15, 2025 11:28 am
by ahampel

Ah I somehow totally overlooked the attached zip file. I had a quick look. It is not clear why but somehow the andersen_nve just abruptly exited. However, given that all other tests passed I would not be too worried about that. One thing I did notice is that you should probably set export OMP_NUM_THREADS=1 or maybe 4 before starting the testsuite. By default it set it to 64 which probably oversubscribes the node on which you run the tests. Maybe this also caused some problems. Otherwise this version seems to work fine. No need to compile it differently I would say. Would be interesting to see if executing the test alone will work.

What did you change with respect to hdf5 now if you compare the makefile.include? If there is no specific reason you can head back to your previous VASP build. But I will try to build VASP 6.5 on Ubuntu later and will report to you if that works for me. From what I see it looks as if it does not find the hdf5 include dir, which is a bit strange given that it worked before.

Best,
Alex


Re: Compiling VASP on Ubuntu 22.04

Posted: Thu Jan 16, 2025 7:57 am
by ahampel

Hi James,

I tried to compile VASP in a Docker container with Ubuntu 24.04 and I realized that the installed hdf5 packages in Ubuntu place their includes and libs quite weirdly. I am not 100% sure if this holds for Ubuntu 22.04 as well but please try to change the LLIBS and INCS lines in the makefile.include to point explicitly to the hdf5 directories:

Code: Select all

LLIBS      += -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lhdf5_fortran
INCS       += -I/usr/include/hdf5/serial

I got these by running: dpkg-query -L libhdf5-dev | grep hdf5.mod . After adding this make found the required hdf5.mod file. I will make a note in the wiki page.

Best,
Alex H.


Re: Compiling VASP on Ubuntu 22.04

Posted: Thu Jan 16, 2025 4:50 pm
by jamboNum5

Hi Alex,

I tried updated the lines you mentioned, I had the error "Can't open included file 'fftw3.f'"

I went ahead and amended the fftw include dir and it seemed to compile successfully.

Code: Select all

# FFTW (mandatory)
#FFTW_ROOT  ?= /path/to/your/fftw/installation
LLIBS      += -L$(FFTW_ROOT)/lib -lfftw3 -lfftw3_omp
INCS       += -I/usr/include

Just re-ran make test and couldn't see any obvious errors, the log is attached. In the mean time, I'll ask the Academic to take another look and see how they get on.

Thanks again! - J


Re: Compiling VASP on Ubuntu 22.04

Posted: Thu Jan 16, 2025 7:37 pm
by ahampel

You are very welcome. Let me know if the user can now successfully run the his / her calculation.

Best,
Alex H.