Build failure of CP2K v2024.1 with GCC 10.2 due to unexpected inability to handle default initialization of derived types with allocatable components

45 views
Skip to first unread message

Arno

unread,
Jun 17, 2024, 8:42:03 AMJun 17
to cp2k
Hello, 

I am running into the following compilation error when trying to build CP2K v2024.1 with GCC 10.2.0:

/mnt/lustre/e1000/home/z04/shared/cp2k/cp2k-2024.1/src/cp_eri_mme_interface.F:25:7:

   25 |    USE eri_mme_test,                    ONLY: eri_mme_2c_perf_acc_test,&
      |       1
Error: The rank of the element in the structure constructor at (1) does not match that of the component (0/1)

I believe this relates to the following in cp_eri_mme_interface.F:

TYPE cp_eri_mme_param
  TYPE(cp_logger_type), POINTER :: logger => NULL()

  ! There is a bug with some older compilers preventing a default initialization of derived types with allocatable components 
#if __GNUC__ < 9 || (__GNUC__ == 9 && __GNUC_MINOR__ < 5)
    TYPE(eri_mme_param)  :: par
#else
    TYPE(eri_mme_param) :: par = eri_mme_param()
#endif

Based on this and your successful builds of CP2K v2024.1 with GCC 9.5 and 10.5 in the dashboard I would not expect this to fail.

Would you be able to advise on how to resolve this, short of using another version of GCC?  Is GCC 10.2.0 perhaps an edge case of a version that has the same bug that is not caught by the above workaround?  

The full compilation command is as follows (I have checked that the mpifort command is indeed using GCC 10.2.0): 

/work/y07/shared/cirrus-software/openmpi/4.1.6/bin/mpifort -c -fno-omit-frame-pointer -fopenmp -g -mtune=native  -O3 -funroll-loops   -I/work/y07/shared/cirrus-software/openmpi/4.1.6/include -pthread  -m64 -I/mnt/lustre/e1000/home/y07/shared/cirrus-software/oneapi/mkl/2024.0/include -I'/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/fftw-3.3.10/include' -I'/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/libint-v2.6.0-cp2k-lmax-5/include' -I'/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/libxc-6.2.2/include' -I'/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/libgrpp-main-20231215/include' -I'/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/libxsmm-1.17/include' -I'/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/COSMA-2.6.6/include' -I'/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/elpa-2023.05.001/cpu/include/elpa_openmp-2023.05.001/modules' -I'/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/elpa-2023.05.001/cpu/include/elpa_openmp-2023.05.001/elpa' -I'/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/gsl-2.7/include' -I/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/hdf5-1.14.2/include -I/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/libvdwxc-0.4.0/include -I/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/spglib-1.16.2/include -I'/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/SpFFT-1.0.6/include' -I'/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/SpLA-1.5.5/include/spla' -I/work/z04/shared/cp2k/cp2k-2024.1/tools/toolchain/install/sirius-7.4.3/include -fbacktrace -ffree-form -fimplicit-none -std=f2008  -Werror=aliasing -Werror=ampersand -Werror=c-binding-type -Werror=intrinsic-shadow -Werror=intrinsics-std -Werror=line-truncation -Werror=tabs -Werror=target-lifetime -Werror=underflow -Werror=unused-but-set-variable -Werror=unused-variable -Werror=unused-dummy-argument -Werror=unused-parameter -Werror=unused-label -Werror=conversion -Werror=zerotrip -Wno-maybe-uninitialized -Wuninitialized -Wuse-without-only  -D__LIBXSMM  -D__parallel -D__MPI_F08 -D__MKL -D__FFTW3  -D__SCALAPACK -D__FFTW3  -D__LIBINT -D__LIBXC -D__LIBGRPP -D__COSMA -D__ELPA  -D__GSL -D__PLUMED2 -D__HDF5 -D__LIBVDWXC -D__SPGLIB -D__LIBVORI -D__SPFFT    -D__SPLA -D__SIRIUS   -fallow-argument-mismatch -D__COMPILE_ARCH="\"local\"" -D__COMPILE_DATE="\"Thu May  9 17:32:33 BST 2024\"" -D__COMPILE_HOST="\"cirrus-login1\"" -D__COMPILE_REVISION="\"git:b4a17a5\"" -D__DATA_DIR="\"/mnt/lustre/e1000/home/z04/shared/cp2k/cp2k-2024.1/data\"" -D__SHORT_FILE__="\"cp_eri_mme_interface.F\"" -I'/mnt/lustre/e1000/home/z04/shared/cp2k/cp2k-2024.1/src/' -I'/mnt/lustre/e1000/home/z04/shared/cp2k/cp2k-2024.1/obj/local/psmp/exts/dbcsr' cp_eri_mme_interface.F90

This follows a toolchain build of the dependencies using the following command:

./install_cp2k_toolchain.sh -j 18 --with-gcc=system --mpi-mode=openmpi --with-openmpi=system --math-mode=mkl --with-mkl=system --with-openblas=no --with-plumed 

For completeness I have attached attached the ARCH file and toolchain-installed setup file that I am sourcing prior to the CP2K build.

Many thanks in advance, 

Arno



setup
local.psmp
Message has been deleted

Frederick Stein

unread,
Jun 17, 2024, 9:32:29 AMJun 17
to cp2k
Dear Arno,
Could you add an exception for the older GCC compilers of version (append " || (__GNUC__ == 10 && __GNUC_MINOR__ < 5)" to the condition of the preprocessor)? Does this issue vanish? If the same error occurs at other spots but in the same context, try to add this fix as well.
Best,
Frederick

Arno

unread,
Jun 24, 2024, 7:16:45 AM (9 days ago) Jun 24
to cp2k
Hello Frederick, 

Thank you for your quick response and suggestion, that's worked!   Although to be precise I didn't *actually* expand the exception clause based on GCC version but rather simply commented out the if statement to force the same effect (this was prior to your message). And did the same in the one other place where the same thing came up as an issue, namely in src/mp2_types.F (line 310, in the definition of mp2_type). 

Leading to the very pleasing regtest result:

------------------------------- Summary --------------------------------

Number of FAILED  tests 0
Number of WRONG   tests 0
Number of CORRECT tests 4171
Total number of   tests 4171

Summary: correct: 4171 / 4171; 270min

Status: OK


Best wishes!

Arno
Reply all
Reply to author
Forward
0 new messages