LCOV - code coverage report
Current view: top level - src/base - base_uses.f90 (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:936074a) Lines: 100.0 % 1 1
Test Date: 2025-12-04 06:27:48 Functions: 100.0 % 1 1

            Line data    Source code
       1              : ! Basic use statements and preprocessor macros
       2              : ! should be included in the use statements
       3              : 
       4            2 :   USE base_hooks,                      ONLY: cp__a,&
       5              :                                              cp__b,&
       6              :                                              cp__w,&
       7              :                                              cp__h,&
       8              :                                              cp__l,&
       9              :                                              cp_abort,&
      10              :                                              cp_warn,&
      11              :                                              cp_hint,&
      12              :                                              timeset,&
      13              :                                              timestop
      14              : 
      15              : #if defined(__OFFLOAD_CUDA) || defined(__OFFLOAD_HIP)
      16              : #define __OFFLOAD
      17              : #endif
      18              : 
      19              : ! Check for OpenMP early on - ideally before the compiler fails with a cryptic message.
      20              : #if !defined(_OPENMP)
      21              :    "OpenMP is required. Please add the corresponding flag (eg. -fopenmp for GFortran) to your Fortran compiler flags."
      22              : #endif
      23              : 
      24              : #if !defined(__SHORT_FILE__)
      25              :    "The preprocessor macro __SHORT_FILE__ is required but has not been defined."
      26              : #endif
      27              : 
      28              : #define __LOCATION__ cp__l(__SHORT_FILE__,__LINE__)
      29              : #define CPABORT(MSG) CALL cp__b(__SHORT_FILE__,__LINE__,MSG)
      30              : 
      31              : ! Issue a warning; warnings are summarized globally.
      32              : ! For conditional warnings see CPWARN_IF.
      33              : #define CPWARN(MSG) CALL cp__w(__SHORT_FILE__,__LINE__,MSG)
      34              : 
      35              : ! Like CPWARN but only if CONDition is true.
      36              : #define CPWARN_IF(COND, MSG) IF(COND)CPWARN(MSG)
      37              : 
      38              : ! In contrast to CPWARN, the warning counter is not increased
      39              : #define CPHINT(MSG) CALL cp__h(__SHORT_FILE__,__LINE__,MSG)
      40              : 
      41              : # define CPASSERT(COND) IF(.NOT.(COND))CALL cp__a(__SHORT_FILE__,__LINE__)
      42              : 
      43              : ! The MARK_USED macro can be used to mark an argument/variable as used. It is intended to make
      44              : ! it possible to switch on -Werror=unused-dummy-argument, but deal elegantly with, e.g.,
      45              : ! library wrapper routines that take arguments only used if the library is linked in.
      46              : ! This code should be valid for any Fortran variable, is always standard conforming,
      47              : ! and will be optimized away completely by the compiler
      48              : #define MARK_USED(FOO) IF(.FALSE.)THEN;DO;IF(SIZE(SHAPE(FOO))==-1) EXIT;ENDDO;ENDIF
      49              : 
      50              : ! Calculate version number from 2 or 3 components. Can be used for comparison, e.g.,
      51              : ! CPVERSION3(4, 9, 0) <= CPVERSION3(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
      52              : ! CPVERSION(8, 0) <= CPVERSION(__GNUC__, __GNUC_MINOR__)
      53              : #define CPVERSION2(MAJOR, MINOR) ((MAJOR) * 10000 + (MINOR) * 100)
      54              : #define CPVERSION3(MAJOR, MINOR, UPDATE) (CPVERSION2(MAJOR, MINOR) + (UPDATE))
      55              : #define CPVERSION CPVERSION2
      56              : 
      57              : ! On top of CPVERSION macro, test if MAJOR_TEST and MINOR_TEST are defined.
      58              : ! Usage:  #if CPVERSION_CHECK(9, 5, >, __GNUC__, __GNUC_MINOR__)
      59              : ! Perform actual comparison according to COMP argument.
      60              : ! Note: defined(MAJOR_TEST) and defined(MINOR_TEST) is avoided in macro
      61              : !       definition due to issues handling it in certain compilers.
      62              : #define CPVERSION_CHECK(MAJOR_BASE, MINOR_BASE, COMP, MAJOR_TEST, MINOR_TEST) ((MAJOR_TEST) && \
      63              :   (CPVERSION2(MAJOR_BASE, MINOR_BASE) COMP CPVERSION2(MAJOR_TEST, MINOR_TEST)))
      64              : 
      65              : ! Avoid to default initialize type-components (default c'tor)
      66              : #if CPVERSION_CHECK(9, 5, >, __GNUC__, __GNUC_MINOR__) || defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)
      67              : #define FTN_NO_DEFAULT_INIT
      68              : #endif
      69              : 
      70              : ! gfortran before 8.3 complains about internal symbols not being specified in
      71              : ! any data clause when using DEFAULT(NONE) and OOP procedures are called from
      72              : ! within the parallel region.
      73              : #if CPVERSION_CHECK(8, 3, >, __GNUC__, __GNUC_MINOR__)
      74              : #define OMP_DEFAULT_NONE_WITH_OOP SHARED
      75              : #else
      76              : #define OMP_DEFAULT_NONE_WITH_OOP NONE
      77              : #endif
      78              : 
      79              : #if defined (__MKL)
      80              : ! Preprocessing is enabled by default, and below header is not language specific
      81              : ! Defines __INTEL_MKL__ (2025), __INTEL_MKL_MINOR__ (0), __INTEL_MKL_UPDATE__ (2),
      82              : ! and __INTEL_MKL_PATCH__ (0) as well INTEL_MKL_VERSION, e.g., 20250200.
      83              : #include <mkl_version.h>
      84              : #endif
        

Generated by: LCOV version 2.0-1