aradi / SCPC-Method

21 stars 14 forks source link

VASP.6.3.0 Compilation Issue #8

Closed Shibu778 closed 2 years ago

Shibu778 commented 2 years ago

While installing vasp.6.3.0 using the mentioned procedure by including following in my makefile.include

DLMGROOT   = <mypath>/SCPC-Rev7-All/vasp-6.2.0-scpc-rev-7/libext/dl_mg_2.0.2
PSPFFTROOT = <mypath>/SCPC-Rev7-All/vasp-6.2.0-scpc-rev-7/libext/pspfft-1.0/Build
INCS      +=-I$(DLMGROOT)/lib
INCS      +=-I$(PSPFFTROOT)/include
LLIBS     +=-Wl,--start-group $(DLMGROOT)/lib/libdlmg.a -Wl,--end-group
LLIBS     +=-Wl,--start-group $(PSPFFTROOT)/lib/libpspfft.a -Wl,--end-group

I got the following issue.

<mypath>/SCPC-Rev7-All/vasp-6.2.0-scpc-rev-7/libext/dl_mg_2.0.2/lib/libdlmg.a(dl_mg.o): In function `dl_mg_mp_dl_mg_init_':
dl_mg.F90:(.text+0x12dd): undefined reference to `omp_get_max_threads'
<mypath>/SCPC-Rev7-All/vasp-6.2.0-scpc-rev-7/libext/dl_mg_2.0.2/lib/libdlmg.a(dl_mg_defco_fd_mod.o): In function `dl_mg_defco_fd_mp_dl_mg_defco_fd_derivative_':
dl_mg_defco_fd_mod.F90:(.text+0xab0): undefined reference to `__kmpc_global_thread_num'
dl_mg_defco_fd_mod.F90:(.text+0xabf): undefined reference to `__kmpc_ok_to_fork'
dl_mg_defco_fd_mod.F90:(.text+0xad5): undefined reference to `__kmpc_push_num_threads'
dl_mg_defco_fd_mod.F90:(.text+0xb28): undefined reference to `__kmpc_fork_call'
dl_mg_defco_fd_mod.F90:(.text+0xb40): undefined reference to `__kmpc_serialized_parallel'
dl_mg_defco_fd_mod.F90:(.text+0xbb6): undefined reference to `__kmpc_end_serialized_parallel'
dl_mg_defco_fd_mod.F90:(.text+0xf7f): undefined reference to `__kmpc_for_static_init_4'
dl_mg_defco_fd_mod.F90:(.text+0x1e4e): undefined reference to `__kmpc_for_static_fini'
dl_mg_defco_fd_mod.F90:(.text+0x1e60): undefined reference to `__kmpc_barrier'
dl_mg_defco_fd_mod.F90:(.text+0x1ecd): undefined reference to `__kmpc_for_static_init_4'
dl_mg_defco_fd_mod.F90:(.text+0x2e35): undefined reference to `__kmpc_for_static_fini'
dl_mg_defco_fd_mod.F90:(.text+0x2e47): undefined reference to `__kmpc_barrier'
dl_mg_defco_fd_mod.F90:(.text+0x2f85): undefined reference to `__kmpc_for_static_init_4'
dl_mg_defco_fd_mod.F90:(.text+0x3da4): undefined reference to `__kmpc_for_static_fini'
dl_mg_defco_fd_mod.F90:(.text+0x3db6): undefined reference to `__kmpc_barrier'
dl_mg_defco_fd_mod.F90:(.text+0x3eed): undefined reference to `__kmpc_for_static_init_4'
.........
(More of such undefined reference to _kmpc_* error)
.........
dl_mg_kernels.F90:(.text+0x142c5): undefined reference to `__kmpc_for_static_fini'
make[2]: *** [vasp] Error 1
make[2]: Leaving directory `<mypath>/vasp.6.3.0_scpc/vasp.6.3.0/build/std'
cp: cannot stat 'vasp': No such file or directory
make[1]: *** [all] Error 1
make[1]: Leaving directory `<mypath>/vasp.6.3.0_scpc/vasp.6.3.0/build/std'
make: *** [std] Error 2

This was because of not including the -qopenmp option during compiling vasp. We have used this option while compiling dl_mg, so we should include that while linking during vasp installation. So, I have included that option after libdlmg.a. After that I did not get any error.

So, my final addition to makefile.include in vasp.6.3.0 installation is as follows.

# SCPC integration (rev7)
CPP_OPTIONS+= -DSCPC
DLMGROOT   = /sscu_gpfs/scratch/mrcshib/Code/vasp.6.3.0_scpc/SCPC-Rev7-All/vasp-6.2.0-scpc-rev-7/libext/dl_mg_2.0.2
PSPFFTROOT = /sscu_gpfs/scratch/mrcshib/Code/vasp.6.3.0_scpc/SCPC-Rev7-All/vasp-6.2.0-scpc-rev-7/libext/pspfft-1.0/Build
INCS      +=-I$(DLMGROOT)/lib
INCS      +=-I$(PSPFFTROOT)/include
LLIBS     +=-Wl,--start-group $(DLMGROOT)/lib/libdlmg.a -qopenmp -Wl,--end-group
LLIBS     +=-Wl,--start-group $(PSPFFTROOT)/lib/libpspfft.a -Wl,--end-group

I am able to match the test result with the given reference value. So, the above modification to the makefile.include is correct. Am I right?

isobestico commented 2 years ago

Yes, you are right. If you compile DL_MG with OpenMP option you should use OpenMP inside the final link procedure of VASP.