LCOV - code coverage report
Current view: top level - src - input_cp2k_global.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:4dc5213) Lines: 100.0 % 238 238
Test Date: 2026-09-08 07:13:59 Functions: 100.0 % 4 4

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2026 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \brief builds the global input section for cp2k
      10              : !> \par History
      11              : !>      06.2004 created [fawzi]
      12              : !>      03.2014 moved to separate file [Ole Schuett]
      13              : !>      10.2016 update seed input [Matthias Krack]
      14              : !> \author fawzi
      15              : ! **************************************************************************************************
      16              : MODULE input_cp2k_global
      17              :    USE bibliography,                    ONLY: Ceriotti2014,&
      18              :                                               Frigo2005,&
      19              :                                               Schonherr2014
      20              :    USE cp_blacs_env,                    ONLY: BLACS_GRID_COL,&
      21              :                                               BLACS_GRID_ROW,&
      22              :                                               BLACS_GRID_SQUARE
      23              :    USE cp_cfm_elpa,                     ONLY: elpa_c_kernel_descriptions,&
      24              :                                               elpa_c_kernel_ids,&
      25              :                                               elpa_c_kernel_names
      26              :    USE cp_dbcsr_cp2k_link,              ONLY: create_dbcsr_section
      27              :    USE cp_fm_cholesky,                  ONLY: FM_CHOLESKY_TYPE_DEFAULT,&
      28              :                                               FM_CHOLESKY_TYPE_DLAF,&
      29              :                                               FM_CHOLESKY_TYPE_SCALAPACK
      30              :    USE cp_fm_diag,                      ONLY: FM_DIAG_TYPE_CUSOLVER,&
      31              :                                               FM_DIAG_TYPE_DEFAULT,&
      32              :                                               FM_DIAG_TYPE_DLAF,&
      33              :                                               FM_DIAG_TYPE_ELPA,&
      34              :                                               FM_DIAG_TYPE_SCALAPACK
      35              :    USE cp_fm_elpa,                      ONLY: elpa_kernel_descriptions,&
      36              :                                               elpa_kernel_ids,&
      37              :                                               elpa_kernel_names,&
      38              :                                               elpa_one_stage,&
      39              :                                               elpa_print,&
      40              :                                               elpa_qr
      41              :    USE cp_fm_struct,                    ONLY: cp_fm_struct_get_ncol_block,&
      42              :                                               cp_fm_struct_get_nrow_block
      43              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      44              :                                               cp_print_key_section_create,&
      45              :                                               debug_print_level,&
      46              :                                               high_print_level,&
      47              :                                               low_print_level,&
      48              :                                               medium_print_level,&
      49              :                                               silent_print_level
      50              :    USE grid_api,                        ONLY: GRID_BACKEND_AUTO,&
      51              :                                               GRID_BACKEND_CPU,&
      52              :                                               GRID_BACKEND_DGEMM,&
      53              :                                               GRID_BACKEND_GPU,&
      54              :                                               GRID_BACKEND_REF
      55              :    USE input_constants,                 ONLY: &
      56              :         bsse_run, callgraph_all, callgraph_master, callgraph_none, cell_opt_run, debug_run, &
      57              :         do_atom, do_band, do_cosma, do_cp2k, do_dgemm_blas, do_dgemm_spla, do_farming, &
      58              :         do_fft_fftw3, do_fft_sg, do_opt_basis, do_optimize_input, do_scalapack, do_swarm, do_tamc, &
      59              :         do_test, do_tree_mc, do_tree_mc_ana, driver_run, ehrenfest, energy_force_run, energy_run, &
      60              :         fftw_plan_estimate, fftw_plan_exhaustive, fftw_plan_measure, fftw_plan_patient, gaussian, &
      61              :         geo_opt_run, linear_response_run, mimic_run, mol_dyn_run, mon_car_run, mtlr_run, negf_run, &
      62              :         none_run, pint_run, real_time_propagation, tree_mc_run, vib_anal
      63              :    USE input_keyword_types,             ONLY: keyword_create,&
      64              :                                               keyword_release,&
      65              :                                               keyword_type
      66              :    USE input_section_types,             ONLY: section_add_keyword,&
      67              :                                               section_add_subsection,&
      68              :                                               section_create,&
      69              :                                               section_release,&
      70              :                                               section_type
      71              :    USE input_val_types,                 ONLY: char_t,&
      72              :                                               integer_t,&
      73              :                                               logical_t
      74              :    USE integral_library_types,          ONLY: default_coulomb_library,&
      75              :                                               library_libint,&
      76              :                                               library_native
      77              :    USE kinds,                           ONLY: dp
      78              :    USE string_utilities,                ONLY: s2a
      79              :    USE timings,                         ONLY: default_timings_level
      80              : #include "./base/base_uses.f90"
      81              : 
      82              :    IMPLICIT NONE
      83              :    PRIVATE
      84              : 
      85              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      86              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_global'
      87              : 
      88              :    PUBLIC :: create_global_section
      89              : 
      90              : CONTAINS
      91              : 
      92              : ! **************************************************************************************************
      93              : !> \brief section to hold global settings for the whole program
      94              : !> \param section the section to be created
      95              : !> \author fawzi
      96              : ! **************************************************************************************************
      97        16805 :    SUBROUTINE create_global_section(section)
      98              :       TYPE(section_type), POINTER                        :: section
      99              : 
     100              :       INTEGER                                            :: default_dgemm
     101              :       TYPE(keyword_type), POINTER                        :: keyword
     102              :       TYPE(section_type), POINTER                        :: print_key, sub_section
     103              : 
     104        16805 :       NULLIFY (print_key)
     105        16805 :       CPASSERT(.NOT. ASSOCIATED(section))
     106              :       CALL section_create(section, __LOCATION__, name="GLOBAL", &
     107              :                           description="Section with general information on which kind "// &
     108              :                           "of simulation to perform and parameters for the whole PROGRAM", &
     109        16805 :                           n_keywords=7, n_subsections=1, repeats=.FALSE.)
     110              : 
     111        16805 :       NULLIFY (keyword)
     112              :       CALL keyword_create(keyword, __LOCATION__, name="BLACS_GRID", &
     113              :                           description="how to distribute the processors on the 2d grid needed "// &
     114              :                           "by BLACS (and thus SCALAPACK)", usage="BLACS_GRID SQUARE", &
     115              :                           default_i_val=BLACS_GRID_SQUARE, enum_c_vals=s2a("SQUARE", "ROW", "COLUMN"), &
     116              :                           enum_desc=s2a("Distribution by matrix blocks", "Distribution by matrix rows", &
     117              :                                         "Distribution by matrix columns"), &
     118        16805 :                           enum_i_vals=[BLACS_GRID_SQUARE, BLACS_GRID_ROW, BLACS_GRID_COL])
     119        16805 :       CALL section_add_keyword(section, keyword)
     120        16805 :       CALL keyword_release(keyword)
     121              : 
     122              :       CALL keyword_create(keyword, __LOCATION__, name="BLACS_REPEATABLE", &
     123              :                           description="Use a topology for BLACS collectives that is guaranteed to be repeatable "// &
     124              :                           "on homogeneous architectures", &
     125              :                           usage="BLACS_REPEATABLE", &
     126        16805 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     127        16805 :       CALL section_add_keyword(section, keyword)
     128        16805 :       CALL keyword_release(keyword)
     129              : 
     130              :       CALL keyword_create(keyword, __LOCATION__, name="PREFERRED_DIAG_LIBRARY", &
     131              :                           description="Specifies the diagonalization library to be used. If not available, "// &
     132              :                           "the ScaLAPACK library is used. Complex (k-point) matrices use ELPA only when it is "// &
     133              :                           "requested explicitly", &
     134              :                           usage="PREFERRED_DIAG_LIBRARY ELPA", &
     135              :                           enum_i_vals=[FM_DIAG_TYPE_ELPA, &
     136              :                                        FM_DIAG_TYPE_SCALAPACK, &
     137              :                                        FM_DIAG_TYPE_SCALAPACK, &
     138              :                                        FM_DIAG_TYPE_CUSOLVER, &
     139              :                                        FM_DIAG_TYPE_DLAF], &
     140              :                           enum_c_vals=s2a("ELPA", "ScaLAPACK", "SL", "CUSOLVER", "DLAF"), &
     141              :                           enum_desc=s2a("ELPA library", &
     142              :                                         "ScaLAPACK library", &
     143              :                                         "ScaLAPACK library (shorthand)", &
     144              :                                         "cuSOLVER (CUDA GPU library)", &
     145              :                                         "DLA-Future (CUDA/HIP GPU library)"), &
     146        16805 :                           default_i_val=FM_DIAG_TYPE_DEFAULT)
     147        16805 :       CALL section_add_keyword(section, keyword)
     148        16805 :       CALL keyword_release(keyword)
     149              : 
     150              :       CALL keyword_create(keyword, __LOCATION__, name="DIRECT_GENERALIZED_DIAGONALIZATION", &
     151              :                           description="Request direct generalized eigenvalue problem diagonalization "// &
     152              :                           "without a CP2K-side Cholesky reduction in supported dense matrix paths. "// &
     153              :                           "The eigensolver is still selected by PREFERRED_DIAG_LIBRARY.", &
     154              :                           usage="DIRECT_GENERALIZED_DIAGONALIZATION", &
     155        16805 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     156        16805 :       CALL section_add_keyword(section, keyword)
     157        16805 :       CALL keyword_release(keyword)
     158              : 
     159              :       CALL keyword_create(keyword, __LOCATION__, name="PREFERRED_CHOLESKY_LIBRARY", &
     160              :                           description="Specifies Cholesky decomposition library to be used. If not available, "// &
     161              :                           "the ScaLAPACK library is used", &
     162              :                           usage="PREFERRED_CHOLESKY_LIBRARY DLAF", &
     163              :                           enum_i_vals=[FM_CHOLESKY_TYPE_SCALAPACK, &
     164              :                                        FM_CHOLESKY_TYPE_SCALAPACK, &
     165              :                                        FM_CHOLESKY_TYPE_DLAF], &
     166              :                           enum_c_vals=s2a("ScaLAPACK", "SL", "DLAF"), &
     167              :                           enum_desc=s2a("ScaLAPACK library", &
     168              :                                         "ScaLAPACK library (shorthand)", &
     169              :                                         "DLA-Future (CUDA/HIP GPU library)"), &
     170        16805 :                           default_i_val=FM_CHOLESKY_TYPE_DEFAULT)
     171        16805 :       CALL section_add_keyword(section, keyword)
     172        16805 :       CALL keyword_release(keyword)
     173              : 
     174              : #if defined(__SPLA) && defined(__OFFLOAD_GEMM)
     175              :       default_dgemm = do_dgemm_spla
     176              : #else
     177        16805 :       default_dgemm = do_dgemm_blas
     178              : #endif
     179              :       CALL keyword_create(keyword, __LOCATION__, name="PREFERRED_DGEMM_LIBRARY", &
     180              :                           description="Specifies the DGEMM library to be used. If not available, "// &
     181              :                           "the BLAS routine is used. This keyword affects some DGEMM calls in the WFC code and turns on their "// &
     182              :                           "acceleration with SpLA. This keyword affects only local DGEMM calls, not the calls to PDGEMM "// &
     183              :                           "(see keyword FM%TYPE_OF_MATRIX_MULTIPLICATION).", &
     184              :                           usage="PREFERRED_DGEMM_LIBRARY SPLA", &
     185              :                           default_i_val=default_dgemm, &
     186              :                           enum_i_vals=[do_dgemm_spla, do_dgemm_blas], &
     187              :                           enum_c_vals=s2a("SPLA", "BLAS"), &
     188        16805 :                           enum_desc=s2a("SPLA library", "BLAS library"))
     189        16805 :       CALL section_add_keyword(section, keyword)
     190        16805 :       CALL keyword_release(keyword)
     191              : 
     192              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CHECK_DIAG", &
     193              :                           description="Check that the orthonormality of the eigenvectors after a diagonalization "// &
     194              :                           "fulfills the specified numerical accuracy. A negative threshold value disables the check.", &
     195              :                           usage="EPS_CHECK_DIAG 1.0E-14", &
     196        16805 :                           default_r_val=-1.0_dp)
     197        16805 :       CALL section_add_keyword(section, keyword)
     198        16805 :       CALL keyword_release(keyword)
     199              : 
     200              :       CALL keyword_create(keyword, __LOCATION__, name="ELPA_KERNEL", &
     201              :                           description="Specifies the kernel to be used when ELPA is in use for real "// &
     202              :                           "symmetric matrices", &
     203              :                           default_i_val=elpa_kernel_ids(1), &
     204              :                           enum_i_vals=elpa_kernel_ids, &
     205              :                           enum_c_vals=elpa_kernel_names, &
     206        16805 :                           enum_desc=elpa_kernel_descriptions)
     207        16805 :       CALL section_add_keyword(section, keyword)
     208        16805 :       CALL keyword_release(keyword)
     209              : 
     210              :       CALL keyword_create(keyword, __LOCATION__, name="ELPA_COMPLEX_KERNEL", &
     211              :                           description="Specifies the kernel to be used when ELPA is in use for complex "// &
     212              :                           "Hermitian matrices (k-points)", &
     213              :                           default_i_val=elpa_c_kernel_ids(1), &
     214              :                           enum_i_vals=elpa_c_kernel_ids, &
     215              :                           enum_c_vals=elpa_c_kernel_names, &
     216        16805 :                           enum_desc=elpa_c_kernel_descriptions)
     217        16805 :       CALL section_add_keyword(section, keyword)
     218        16805 :       CALL keyword_release(keyword)
     219              : 
     220              :       CALL keyword_create(keyword, __LOCATION__, name="ELPA_NEIGVEC_MIN", &
     221              :                           description="Minimum number of eigenvectors for the use of the eigensolver from "// &
     222              :                           "the ELPA library. The eigensolver from the ScaLAPACK library is used as fallback "// &
     223              :                           "for all smaller cases", &
     224              :                           usage="ELPA_NEIGVEC_MIN 32", &
     225        16805 :                           default_i_val=MIN(cp_fm_struct_get_nrow_block(), cp_fm_struct_get_ncol_block()))
     226        16805 :       CALL section_add_keyword(section, keyword)
     227        16805 :       CALL keyword_release(keyword)
     228              : 
     229              :       CALL keyword_create(keyword, __LOCATION__, name="ELPA_QR", &
     230              :                           description="For ELPA, enable a blocked QR step when reducing the input matrix "// &
     231              :                           "to banded form before diagonalization. Requires ELPA version 201505 or newer and "// &
     232              :                           "is automatically deactivated otherwise. QR is activated only when the matrix size "// &
     233              :                           "is suitable. Keyword ELPA_PRINT helps identify suitable cases. Can accelerate "// &
     234              :                           "diagonalization for suitable matrices.", &
     235              :                           usage="ELPA_QR", &
     236        16805 :                           default_l_val=elpa_qr, lone_keyword_l_val=.TRUE.)
     237        16805 :       CALL section_add_keyword(section, keyword)
     238        16805 :       CALL keyword_release(keyword)
     239              : 
     240              :       CALL keyword_create(keyword, __LOCATION__, name="ELPA_ONE_STAGE", &
     241              :                           description="For ELPA, enable the one-stage solver (instead of the two-stage solver). "// &
     242              :                           "Please note, ELPA_QR and ELPA_KERNEL settings may be ignored.", &
     243              :                           usage="ELPA_ONE_STAGE", &
     244        16805 :                           default_l_val=elpa_one_stage, lone_keyword_l_val=.TRUE.)
     245        16805 :       CALL section_add_keyword(section, keyword)
     246        16805 :       CALL keyword_release(keyword)
     247              : 
     248              :       CALL keyword_create(keyword, __LOCATION__, name="ELPA_PRINT", &
     249              :                           description="Controls the printing of ELPA diagonalization information. "// &
     250              :                           "Useful for testing purposes, especially together with keyword ELPA_QR.", &
     251        16805 :                           usage="ELPA_PRINT", default_l_val=elpa_print, lone_keyword_l_val=.TRUE.)
     252        16805 :       CALL section_add_keyword(section, keyword)
     253        16805 :       CALL keyword_release(keyword)
     254              : 
     255              :       CALL keyword_create(keyword, __LOCATION__, name="DLAF_NEIGVEC_MIN", &
     256              :                           description="Minimum number of eigenvectors for the use of the eigensolver from "// &
     257              :                           "the DLA-Future library. The eigensolver from the ScaLAPACK library is used as fallback "// &
     258              :                           "for all smaller cases", &
     259              :                           usage="DLAF_NEIGVEC_MIN 512", &
     260        16805 :                           default_i_val=1024)
     261        16805 :       CALL section_add_keyword(section, keyword)
     262        16805 :       CALL keyword_release(keyword)
     263              : 
     264              :       CALL keyword_create(keyword, __LOCATION__, name="DLAF_CHOLESKY_N_MIN", &
     265              :                           description="Minimum matrix size for the use of the Cholesky decomposition from "// &
     266              :                           "the DLA-Future library. The Cholesky decomposition from the ScaLAPACK library is used as fallback "// &
     267              :                           "for all smaller cases", &
     268              :                           usage="DLAF_CHOLESKY_N_MIN 512", &
     269        16805 :                           default_i_val=1024)
     270        16805 :       CALL section_add_keyword(section, keyword)
     271        16805 :       CALL keyword_release(keyword)
     272              : 
     273              :       CALL keyword_create( &
     274              :          keyword, __LOCATION__, name="PREFERRED_FFT_LIBRARY", &
     275              :          description="Specifies the FFT library which should be preferred. "// &
     276              :          "If it is not available, use FFTW3 if this is linked in, if FFTW3 is not available use FFTSG. "// &
     277              :          "Improved performance with FFTW3 can be obtained specifying a proper value for FFTW_PLAN_TYPE. "// &
     278              :          "Contrary to earlier CP2K versions, all libraries will result in the same grids, "// &
     279              :          "i.e. the subset of grids which all FFT libraries can transform. "// &
     280              :          "FFTW3 is often (close to) optimal, and well tested with CP2K.", &
     281              :          usage="PREFERRED_FFT_LIBRARY FFTW3", &
     282              :          citations=[Frigo2005], &
     283              :          default_i_val=do_fft_fftw3, &
     284              :          enum_i_vals=[do_fft_sg, do_fft_fftw3, do_fft_fftw3], &
     285              :          enum_c_vals=s2a("FFTSG", "FFTW3", "FFTW"), &
     286              :          enum_desc=s2a("Stefan Goedecker's FFT (FFTSG), always available, "// &
     287              :                        "will be used in case a FFT library is specified and not available.", &
     288              :                        "a fast portable FFT library. Recommended. "// &
     289              :                        "See also the FFTW_PLAN_TYPE, and FFTW_WISDOM_FILE_NAME keywords.", &
     290        33610 :                        "Same as FFTW3 (for compatibility with CP2K 2.3)"))
     291        16805 :       CALL section_add_keyword(section, keyword)
     292        16805 :       CALL keyword_release(keyword)
     293              : 
     294        16805 :       NULLIFY (sub_section)
     295              :       CALL section_create(sub_section, __LOCATION__, name="preferred_integral_library", &
     296              :                           description="Selects the implementation of individual Gaussian integral operations.", &
     297        16805 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
     298              : 
     299              :       CALL keyword_create(keyword, __LOCATION__, name="COULOMB_2C", &
     300              :                           description="Preferred library for two-center Coulomb integrals (Coulomb_2c). "// &
     301              :                           "Libint is used by default when available; otherwise the native implementation is used.", &
     302              :                           usage="COULOMB_2C LIBINT", &
     303              :                           enum_c_vals=s2a("NATIVE", "LIBINT"), &
     304              :                           enum_i_vals=[library_native, library_libint], &
     305              :                           enum_desc=s2a("Use CP2K's native implementation.", &
     306              :                                         "Use the Libint implementation."), &
     307        16805 :                           default_i_val=default_coulomb_library)
     308        16805 :       CALL section_add_keyword(sub_section, keyword)
     309        16805 :       CALL keyword_release(keyword)
     310              : 
     311              :       CALL keyword_create(keyword, __LOCATION__, name="COULOMB_3C", &
     312              :                           description="Preferred library for three-center Coulomb integrals (Coulomb_3c). "// &
     313              :                           "Libint is used by default when available; otherwise the native implementation is used.", &
     314              :                           usage="COULOMB_3C LIBINT", &
     315              :                           enum_c_vals=s2a("NATIVE", "LIBINT"), &
     316              :                           enum_i_vals=[library_native, library_libint], &
     317              :                           enum_desc=s2a("Use CP2K's native implementation.", &
     318              :                                         "Use the Libint implementation."), &
     319        16805 :                           default_i_val=default_coulomb_library)
     320        16805 :       CALL section_add_keyword(sub_section, keyword)
     321        16805 :       CALL keyword_release(keyword)
     322              : 
     323        16805 :       CALL section_add_subsection(section, sub_section)
     324        16805 :       CALL section_release(sub_section)
     325              : 
     326              :       CALL keyword_create(keyword, __LOCATION__, name="FFTW_WISDOM_FILE_NAME", &
     327              :                           description="The name of the file that contains wisdom (pre-planned FFTs) for use with FFTW3. "// &
     328              :                           "Using wisdom can significantly speed up the FFTs (see the FFTW homepage for details). "// &
     329              :                           "Note that wisdom is not transferable between different computer (architectures). "// &
     330              :                           "Wisdom can be generated using the fftw-wisdom tool that is part of the fftw installation. "// &
     331              :                           "cp2k/tools/cp2k-wisdom is a script that contains some additional info, and can help "// &
     332              :                           "to generate a useful default for /etc/fftw/wisdom or particular values for a given simulation.", &
     333        16805 :                           usage="FFTW_WISDOM_FILE_NAME wisdom.dat", default_lc_val="/etc/fftw/wisdom")
     334        16805 :       CALL section_add_keyword(section, keyword)
     335        16805 :       CALL keyword_release(keyword)
     336              : 
     337              :       CALL keyword_create(keyword, __LOCATION__, name="FFTW_PLAN_TYPE", &
     338              :                           description="FFTW can have improved performance if it is allowed to plan with "// &
     339              :                           "explicit measurements which strategy is best for a given FFT. "// &
     340              :                           "While a plan based on measurements is generally faster, "// &
     341              :                           "differences in machine load will lead to different plans for the same input file, "// &
     342              :                           "and thus numerics for the FFTs will be slightly different from run to run. "// &
     343              :                           "PATIENT planning is recommended for long ab initio MD runs.", &
     344              :                           usage="FFTW_PLAN_TYPE PATIENT", &
     345              :                           citations=[Frigo2005], &
     346              :                           default_i_val=fftw_plan_estimate, &
     347              :                           enum_i_vals=[fftw_plan_estimate, fftw_plan_measure, fftw_plan_patient, fftw_plan_exhaustive], &
     348              :                           enum_c_vals=s2a("ESTIMATE", &
     349              :                                           "MEASURE", &
     350              :                                           "PATIENT", &
     351              :                                           "EXHAUSTIVE"), &
     352              :                           enum_desc=s2a("Quick estimate, no runtime measurements.", &
     353              :                                         "Quick measurement, somewhat faster FFTs.", &
     354              :                                         "Measurements trying a wider range of possibilities.", &
     355        33610 :                                         "Measurements trying all possibilities - use with caution."))
     356        16805 :       CALL section_add_keyword(section, keyword)
     357        16805 :       CALL keyword_release(keyword)
     358              : 
     359              :       CALL keyword_create(keyword, __LOCATION__, name="FFT_POOL_SCRATCH_LIMIT", &
     360              :                           description="Limits the memory usage of the FFT scratch pool, potentially reducing efficiency a bit", &
     361        16805 :                           usage="FFT_POOL_SCRATCH_LIMIT {INTEGER}", default_i_val=15)
     362        16805 :       CALL section_add_keyword(section, keyword)
     363        16805 :       CALL keyword_release(keyword)
     364              : 
     365              :       CALL keyword_create(keyword, __LOCATION__, name="ALLTOALL_SGL", &
     366              :                           description="All-to-all communication (FFT) should use single precision", &
     367              :                           usage="ALLTOALL_SGL YES", &
     368        16805 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     369        16805 :       CALL section_add_keyword(section, keyword)
     370        16805 :       CALL keyword_release(keyword)
     371              : 
     372              :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_LEVEL", &
     373              :                           variants=["IOLEVEL"], &
     374              :                           description="How much output is written out.", &
     375              :                           usage="PRINT_LEVEL HIGH", &
     376              :                           default_i_val=medium_print_level, enum_c_vals= &
     377              :                           s2a("SILENT", "LOW", "MEDIUM", "HIGH", "DEBUG"), &
     378              :                           enum_desc=s2a("Almost no output", &
     379              :                                         "Little output", "Quite some output", "Lots of output", &
     380              :                                         "Everything is written out, useful for debugging purposes only"), &
     381              :                           enum_i_vals=[silent_print_level, low_print_level, medium_print_level, &
     382        33610 :                                        high_print_level, debug_print_level])
     383        16805 :       CALL section_add_keyword(section, keyword)
     384        16805 :       CALL keyword_release(keyword)
     385              : 
     386              :       CALL keyword_create( &
     387              :          keyword, __LOCATION__, name="PROGRAM_NAME", &
     388              :          variants=["PROGRAM"], &
     389              :          description="Which program should be run", &
     390              :          usage="PROGRAM_NAME {STRING}", &
     391              :          enum_c_vals=s2a("ATOM", "FARMING", "TEST", "CP2K", "OPTIMIZE_INPUT", "OPTIMIZE_BASIS", "TMC", "MC_ANALYSIS", "SWARM"), &
     392              :          enum_desc=s2a("Runs single atom calculations", &
     393              :                        "Runs N independent jobs in a single run", &
     394              :                        "Do some benchmarking and testing", &
     395              :                        "Runs one of the CP2K package", &
     396              :                        "A tool to optimize parameters in a CP2K input", &
     397              :                        "A tool to create a MOLOPT or ADMM basis for a given set"// &
     398              :                        " of training structures", &
     399              :                        "Runs Tree Monte Carlo algorithm using additional input file(s)", &
     400              :                        "Runs (Tree) Monte Carlo trajectory file analysis", &
     401              :                        "Runs swarm based calculation"), &
     402              :          enum_i_vals=[do_atom, do_farming, do_test, do_cp2k, do_optimize_input, &
     403              :                       do_opt_basis, do_tree_mc, do_tree_mc_ana, do_swarm], &
     404        33610 :          default_i_val=do_cp2k)
     405        16805 :       CALL section_add_keyword(section, keyword)
     406        16805 :       CALL keyword_release(keyword)
     407              : 
     408              :       CALL keyword_create(keyword, __LOCATION__, name="PROJECT_NAME", &
     409              :                           variants=["PROJECT"], &
     410              :                           description="Name of the project (used to build the name of the "// &
     411              :                           "trajectory, and other files generated by the program)", &
     412              :                           usage="PROJECT_NAME {STRING}", &
     413        33610 :                           default_c_val="PROJECT")
     414        16805 :       CALL section_add_keyword(section, keyword)
     415        16805 :       CALL keyword_release(keyword)
     416              : 
     417              :       CALL keyword_create(keyword, __LOCATION__, name="OUTPUT_FILE_NAME", &
     418              :                           description="Name of the output file. "// &
     419              :                           "Relevant only if automatically started (through farming for example). "// &
     420              :                           "If empty uses the project name as basis for it.", &
     421        16805 :                           usage="OUTPUT_FILE_NAME {filename}", default_lc_val="")
     422        16805 :       CALL section_add_keyword(section, keyword)
     423        16805 :       CALL keyword_release(keyword)
     424              : 
     425              :       CALL keyword_create( &
     426              :          keyword, __LOCATION__, name="RUN_TYPE", &
     427              :          description="Selects the top-level task CP2K should run, such as an energy, "// &
     428              :          "energy-and-force, molecular dynamics, geometry optimization, or response calculation.", &
     429              :          usage="RUN_TYPE MD", &
     430              :          default_i_val=energy_force_run, &
     431              :          citations=[Ceriotti2014, Schonherr2014], &
     432              :          enum_c_vals=s2a("NONE", "ENERGY", "ENERGY_FORCE", "MD", "GEO_OPT", &
     433              :                          "MC", "DEBUG", "BSSE", "LR", "PINT", "VIBRATIONAL_ANALYSIS", &
     434              :                          "BAND", "CELL_OPT", "WFN_OPT", "WAVEFUNCTION_OPTIMIZATION", &
     435              :                          "MOLECULAR_DYNAMICS", "GEOMETRY_OPTIMIZATION", "MONTECARLO", &
     436              :                          "LINEAR_RESPONSE", "NORMAL_MODES", "RT_PROPAGATION", &
     437              :                          "EHRENFEST_DYN", "TAMC", "TMC", "DRIVER", "NEGF", "MIMIC", "RTP", &
     438              :                          "MTLR"), &
     439              :          enum_i_vals=[none_run, energy_run, energy_force_run, mol_dyn_run, &
     440              :                       geo_opt_run, mon_car_run, debug_run, &
     441              :                       bsse_run, linear_response_run, pint_run, vib_anal, do_band, &
     442              :                       cell_opt_run, energy_run, energy_run, mol_dyn_run, geo_opt_run, &
     443              :                       mon_car_run, linear_response_run, &
     444              :                       vib_anal, real_time_propagation, ehrenfest, do_tamc, tree_mc_run, &
     445              :                       driver_run, negf_run, mimic_run, real_time_propagation, mtlr_run], &
     446              :          enum_desc=s2a("Perform no tasks", "Computes energy", "Computes energy and forces", &
     447              :                        "Molecular Dynamics", "Geometry Optimization", "Monte Carlo", &
     448              :                        "Performs a Debug analysis", "Basis set superposition error", "Linear Response", &
     449              :                        "Path integral", "Vibrational analysis", "Band methods", &
     450              :                        "Cell optimization. Both cell vectors and atomic positions are optimised.", &
     451              :                        "Alias for ENERGY", "Alias for ENERGY", "Alias for MD", "Alias for GEO_OPT", &
     452              :                        "Alias for MC", "Alias for LR", "Alias for VIBRATIONAL_ANALYSIS", &
     453              :                        "Real Time propagation run (fixed ionic positions)", &
     454              :                        "Ehrenfest dynamics (using real time propagation of the wavefunction)", &
     455              :                        "Temperature Accelerated Monte Carlo (TAMC)", &
     456              :                        "Tree Monte Carlo (TMC), a pre-sampling MC algorithm", &
     457              :                        "i-PI driver mode", &
     458              :                        "Non-equilibrium Green's function method", &
     459              :                        "Run as a client in a simulation through the MiMiC framework", &
     460              :                        "Alias for RT_PROPAGATION", &
     461        50415 :                        "Minimum tracking linear response calculation for Hubbard U and Hund's J"))
     462        16805 :       CALL section_add_keyword(section, keyword)
     463        16805 :       CALL keyword_release(keyword)
     464              : 
     465              :       CALL keyword_create(keyword, __LOCATION__, name="WALLTIME", &
     466              :                           variants=["WALLTI"], &
     467              :                           description="Maximum execution time for this run. Time in seconds or in HH:MM:SS.", &
     468        33610 :                           usage="WALLTIME {real} or {HH:MM:SS}", default_lc_val="")
     469        16805 :       CALL section_add_keyword(section, keyword)
     470        16805 :       CALL keyword_release(keyword)
     471              : 
     472              :       CALL keyword_create(keyword, __LOCATION__, name="ECHO_INPUT", &
     473              :                           description="If the input should be echoed to the output with all the "// &
     474              :                           "defaults made explicit", &
     475        16805 :                           usage="ECHO_INPUT NO", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     476        16805 :       CALL section_add_keyword(section, keyword)
     477        16805 :       CALL keyword_release(keyword)
     478              : 
     479              :       CALL keyword_create(keyword, __LOCATION__, name="ECHO_ALL_HOSTS", &
     480              :                           description="Echo a list of hostname and pid for all MPI processes.", &
     481        16805 :                           usage="ECHO_ALL_HOSTS NO", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     482        16805 :       CALL section_add_keyword(section, keyword)
     483        16805 :       CALL keyword_release(keyword)
     484              : 
     485              :       CALL keyword_create(keyword, __LOCATION__, name="ENABLE_MPI_IO", &
     486              :                           description="Enable MPI parallelization for all supported I/O routines "// &
     487              :                           "Currently, only cube file writer/reader routines use MPI I/O. Disabling "// &
     488              :                           "this flag might speed up calculations dominated by I/O.", &
     489        16805 :                           usage="ENABLE_MPI_IO FALSE", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     490        16805 :       CALL section_add_keyword(section, keyword)
     491        16805 :       CALL keyword_release(keyword)
     492              : 
     493              :       CALL keyword_create(keyword, __LOCATION__, name="TRACE", &
     494              :                           description="If a debug trace of the execution of the program should be written", &
     495              :                           usage="TRACE", &
     496        16805 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     497        16805 :       CALL section_add_keyword(section, keyword)
     498        16805 :       CALL keyword_release(keyword)
     499              : 
     500              :       CALL keyword_create(keyword, __LOCATION__, name="TRACE_MASTER", &
     501              :                           description="For parallel TRACEd runs: only the master node writes output.", &
     502              :                           usage="TRACE_MASTER", &
     503        16805 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     504        16805 :       CALL section_add_keyword(section, keyword)
     505        16805 :       CALL keyword_release(keyword)
     506              : 
     507              :       CALL keyword_create( &
     508              :          keyword, __LOCATION__, name="TRACE_MAX", &
     509              :          description="Limit the total number a given subroutine is printed in the trace. Accounting is not influenced.", &
     510        16805 :          usage="TRACE_MAX 100", default_i_val=HUGE(0))
     511        16805 :       CALL section_add_keyword(section, keyword)
     512        16805 :       CALL keyword_release(keyword)
     513              : 
     514              :       CALL keyword_create( &
     515              :          keyword, __LOCATION__, name="TRACE_ROUTINES", &
     516              :          description="A list of routines to trace. If left empty all routines are traced. Accounting is not influenced.", &
     517              :          usage="TRACE_ROUTINES {routine_name1} {routine_name2} ...", type_of_var=char_t, &
     518        16805 :          n_var=-1)
     519        16805 :       CALL section_add_keyword(section, keyword)
     520        16805 :       CALL keyword_release(keyword)
     521              : 
     522              :       CALL keyword_create( &
     523              :          keyword, __LOCATION__, name="FLUSH_SHOULD_FLUSH", &
     524              :          description="Flush output regularly, enabling this option might degrade performance significantly on certain machines.", &
     525              :          usage="FLUSH_SHOULD_FLUSH", &
     526        16805 :          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     527        16805 :       CALL section_add_keyword(section, keyword)
     528        16805 :       CALL keyword_release(keyword)
     529              : 
     530              :       CALL keyword_create(keyword, __LOCATION__, name="CALLGRAPH", &
     531              :                           description="At the end of the run write a callgraph to file, "// &
     532              :                           "which contains detailed timing informations. "// &
     533              :                           "This callgraph can be viewed e.g. with the open-source program kcachegrind.", &
     534              :                           usage="CALLGRAPH {NONE|MASTER|ALL}", &
     535              :                           default_i_val=CALLGRAPH_NONE, lone_keyword_i_val=CALLGRAPH_MASTER, &
     536              :                           enum_c_vals=s2a("NONE", "MASTER", "ALL"), &
     537              :                           enum_desc=s2a("No callgraph gets written", &
     538              :                                         "Only the master process writes his callgraph", &
     539              :                                         "All processes write their callgraph (into a separate files)."), &
     540        16805 :                           enum_i_vals=[CALLGRAPH_NONE, CALLGRAPH_MASTER, CALLGRAPH_ALL])
     541        16805 :       CALL section_add_keyword(section, keyword)
     542        16805 :       CALL keyword_release(keyword)
     543              : 
     544              :       CALL keyword_create(keyword, __LOCATION__, name="CALLGRAPH_FILE_NAME", &
     545              :                           description="Name of the callgraph file, which is written at the end of the run. "// &
     546              :                           "If not specified the project name will be used as filename.", &
     547        16805 :                           usage="CALLGRAPH_FILE_NAME {filename}", default_lc_val="")
     548        16805 :       CALL section_add_keyword(section, keyword)
     549        16805 :       CALL keyword_release(keyword)
     550              : 
     551              :       CALL keyword_create(keyword, __LOCATION__, name="SEED", &
     552              :                           description="Initial seed for the global (pseudo)random number generator "// &
     553              :                           "to create a stream of normally Gaussian distributed random numbers. "// &
     554              :                           "Exactly 1 or 6 positive integer values are expected. A single value is "// &
     555              :                           "replicated to fill up the full seed array with 6 numbers.", &
     556              :                           n_var=-1, &
     557              :                           type_of_var=integer_t, &
     558              :                           usage="SEED {INTEGER} .. {INTEGER}", &
     559        16805 :                           default_i_vals=[2000])
     560        16805 :       CALL section_add_keyword(section, keyword)
     561        16805 :       CALL keyword_release(keyword)
     562              : 
     563              :       CALL keyword_create(keyword, __LOCATION__, name="SAVE_MEM", &
     564              :                           description="Some sections of the input structure are deallocated when not needed,"// &
     565              :                           " and reallocated only when used. This reduces the required maximum memory.", &
     566              :                           usage="SAVE_MEM", &
     567        16805 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     568        16805 :       CALL section_add_keyword(section, keyword)
     569        16805 :       CALL keyword_release(keyword)
     570              : 
     571              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "TIMINGS", description= &
     572              :                                        "Controls the printing of the timing report at the end of CP2K execution", &
     573        16805 :                                        print_level=silent_print_level, filename="__STD_OUT__")
     574              : 
     575              :       CALL keyword_create(keyword, __LOCATION__, name="THRESHOLD", &
     576              :                           description="Specify % of CPUTIME above which the contribution will be inserted in the"// &
     577              :                           " final timing report (e.g. 0.02 = 2%)", &
     578              :                           usage="THRESHOLD {REAL}", &
     579        16805 :                           default_r_val=0.02_dp)
     580        16805 :       CALL section_add_keyword(print_key, keyword)
     581        16805 :       CALL keyword_release(keyword)
     582              : 
     583              :       CALL keyword_create(keyword, __LOCATION__, name="SORT_BY_SELF_TIME", &
     584              :                           description="Sort the final timing report by the average self (exclusive) time instead of the "// &
     585              :                           "total (inclusive) time of a routine", &
     586              :                           usage="SORT_BY_SELF_TIME on", &
     587        16805 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     588        16805 :       CALL section_add_keyword(print_key, keyword)
     589        16805 :       CALL keyword_release(keyword)
     590              : 
     591              :       CALL keyword_create(keyword, __LOCATION__, name="REPORT_MAXLOC", &
     592              :                           description="Report the rank with the slowest maximum self timing."// &
     593              :                           " Can be used to debug hard- or software."// &
     594              :                           " Also enables ECHO_ALL_HOSTS to link rank to hostname.", &
     595              :                           usage="REPORT_MAXLOC on", &
     596        16805 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     597        16805 :       CALL section_add_keyword(print_key, keyword)
     598        16805 :       CALL keyword_release(keyword)
     599              : 
     600              :       CALL keyword_create(keyword, __LOCATION__, name="TIME_MPI", &
     601              :                           description="Include message_passing calls in the timing report (useful with CALLGRAPH).", &
     602              :                           usage="TIME_MPI .FALSE.", &
     603        16805 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     604        16805 :       CALL section_add_keyword(print_key, keyword)
     605        16805 :       CALL keyword_release(keyword)
     606              : 
     607              :       CALL keyword_create(keyword, __LOCATION__, name="TIMINGS_LEVEL", &
     608              :                           description="Specify the level of timings report. "// &
     609              :                           "Possible values are: 0 (report only CP2K root timer), 1 (all timers).", &
     610              :                           usage="TIMINGS_LEVEL 1", &
     611        16805 :                           default_i_val=default_timings_level, lone_keyword_i_val=default_timings_level)
     612        16805 :       CALL section_add_keyword(print_key, keyword)
     613        16805 :       CALL keyword_release(keyword)
     614              : 
     615        16805 :       CALL section_add_subsection(section, print_key)
     616        16805 :       CALL section_release(print_key)
     617              : 
     618              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "REFERENCES", description= &
     619              :                                        "Controls the printing of the references relevant to the calculations performed", &
     620        16805 :                                        print_level=silent_print_level, filename="__STD_OUT__")
     621        16805 :       CALL section_add_subsection(section, print_key)
     622        16805 :       CALL section_release(print_key)
     623              : 
     624              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
     625              :                                        description="controls the printing of  initialization controlled by the global section", &
     626        16805 :                                        print_level=silent_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     627        16805 :       CALL section_add_subsection(section, print_key)
     628        16805 :       CALL section_release(print_key)
     629              : 
     630              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PRINT", description= &
     631              :                                        "controls the printing of physical and mathematical constants", &
     632        16805 :                                        print_level=medium_print_level, filename="__STD_OUT__")
     633              : 
     634              :       CALL keyword_create(keyword, __LOCATION__, name="BASIC_DATA_TYPES", &
     635              :                           description="Controls the printing of the basic data types.", &
     636        16805 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     637        16805 :       CALL section_add_keyword(print_key, keyword)
     638        16805 :       CALL keyword_release(keyword)
     639              :       CALL keyword_create(keyword, __LOCATION__, name="physcon", &
     640              :                           description="if the printkey is active prints the physical constants", &
     641        16805 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     642        16805 :       CALL section_add_keyword(print_key, keyword)
     643        16805 :       CALL keyword_release(keyword)
     644              :       CALL keyword_create(keyword, __LOCATION__, name="SPHERICAL_HARMONICS", &
     645              :                           description="if the printkey is active prints the spherical harmonics", &
     646        16805 :                           default_i_val=-1, type_of_var=integer_t)
     647        16805 :       CALL section_add_keyword(print_key, keyword)
     648        16805 :       CALL keyword_release(keyword)
     649              :       CALL keyword_create(keyword, __LOCATION__, name="RNG_MATRICES", &
     650              :                           description="Prints the transformation matrices used by the  random number generator", &
     651              :                           default_l_val=.FALSE., &
     652        16805 :                           lone_keyword_l_val=.TRUE.)
     653        16805 :       CALL section_add_keyword(print_key, keyword)
     654        16805 :       CALL keyword_release(keyword)
     655              :       CALL keyword_create(keyword, __LOCATION__, name="RNG_CHECK", &
     656              :                           description="Performs a check of the global (pseudo)random "// &
     657              :                           "number generator (RNG) and prints the result", &
     658              :                           default_l_val=.FALSE., &
     659        16805 :                           lone_keyword_l_val=.TRUE.)
     660        16805 :       CALL section_add_keyword(print_key, keyword)
     661        16805 :       CALL keyword_release(keyword)
     662              :       CALL keyword_create(keyword, __LOCATION__, name="GLOBAL_GAUSSIAN_RNG", &
     663              :                           description="Prints the initial status of the global Gaussian "// &
     664              :                           "(pseudo)random number stream which is mostly used for "// &
     665              :                           "the velocity initialization", &
     666              :                           default_l_val=.FALSE., &
     667        16805 :                           lone_keyword_l_val=.TRUE.)
     668        16805 :       CALL section_add_keyword(print_key, keyword)
     669        16805 :       CALL keyword_release(keyword)
     670              : 
     671        16805 :       CALL section_add_subsection(section, print_key)
     672        16805 :       CALL section_release(print_key)
     673        16805 :       NULLIFY (sub_section)
     674              :       ! FM section
     675        16805 :       CALL create_fm_section(sub_section)
     676        16805 :       CALL section_add_subsection(section, sub_section)
     677        16805 :       CALL section_release(sub_section)
     678              :       ! DBCSR options
     679        16805 :       CALL create_dbcsr_section(sub_section)
     680        16805 :       CALL section_add_subsection(section, sub_section)
     681        16805 :       CALL section_release(sub_section)
     682              :       ! FM diagonalization redistribution rules
     683        16805 :       CALL create_fm_diag_rules_section(sub_section)
     684        16805 :       CALL section_add_subsection(section, sub_section)
     685        16805 :       CALL section_release(sub_section)
     686              :       ! Grid library
     687        16805 :       CALL create_grid_section(sub_section)
     688        16805 :       CALL section_add_subsection(section, sub_section)
     689        16805 :       CALL section_release(sub_section)
     690              : 
     691        16805 :    END SUBROUTINE create_global_section
     692              : 
     693              : ! **************************************************************************************************
     694              : !> \brief   Creates the dbcsr section for configuring FM
     695              : !> \param section ...
     696              : !> \date    2011-04-05
     697              : !> \author  Florian Schiffmann
     698              : ! **************************************************************************************************
     699        16805 :    SUBROUTINE create_fm_section(section)
     700              :       TYPE(section_type), POINTER                        :: section
     701              : 
     702              :       INTEGER                                            :: default_matmul
     703              :       TYPE(keyword_type), POINTER                        :: keyword
     704              : 
     705        16805 :       CPASSERT(.NOT. ASSOCIATED(section))
     706              :       CALL section_create(section, __LOCATION__, name="FM", &
     707              :                           description="Configuration options for the full matrices.", &
     708        16805 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     709              : 
     710        16805 :       NULLIFY (keyword)
     711              : 
     712              :       CALL keyword_create(keyword, __LOCATION__, name="NROW_BLOCKS", &
     713              :                           description="Defines the number of rows per scalapack block in "// &
     714              :                           "the creation of block cyclic dense matrices. "// &
     715              :                           "Use an internal default if zero or negative.", &
     716        16805 :                           default_i_val=cp_fm_struct_get_nrow_block())
     717        16805 :       CALL section_add_keyword(section, keyword)
     718        16805 :       CALL keyword_release(keyword)
     719              : 
     720              :       CALL keyword_create(keyword, __LOCATION__, name="NCOL_BLOCKS", &
     721              :                           description="Defines the number of columns per scalapack block in "// &
     722              :                           "the creation of vlock cyclic dense matrices. "// &
     723              :                           "Use an internal default if zero or negative.", &
     724        16805 :                           default_i_val=cp_fm_struct_get_ncol_block())
     725        16805 :       CALL section_add_keyword(section, keyword)
     726        16805 :       CALL keyword_release(keyword)
     727              : 
     728              :       CALL keyword_create(keyword, __LOCATION__, name="FORCE_BLOCK_SIZE", &
     729              :                           description="Ensure for small matrices that the layout is compatible "// &
     730              :                           "with bigger ones, i.e. no subdivision is performed (can break LAPACK).", &
     731              :                           usage="FORCE_BLOCK_SIZE", &
     732        16805 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     733        16805 :       CALL section_add_keyword(section, keyword)
     734        16805 :       CALL keyword_release(keyword)
     735              : 
     736              : #if defined(__COSMA)
     737        16805 :       default_matmul = do_cosma
     738              : #else
     739              :       default_matmul = do_scalapack
     740              : #endif
     741              : 
     742              :       CALL keyword_create(keyword, __LOCATION__, name="TYPE_OF_MATRIX_MULTIPLICATION", &
     743              :                           description="Allows to switch between scalapack pxgemm and COSMA pxgemm. "// &
     744              :                           "COSMA reduces the communication costs but increases the memory demands. "// &
     745              :                           "The performance of Scalapack's pxgemm on GPU's depends "// &
     746              :                           "crucially on the BLOCK_SIZES. Make sure optimized kernels are available.", &
     747              :                           default_i_val=default_matmul, &
     748              :                           enum_i_vals=[do_scalapack, do_scalapack, do_cosma], &
     749              :                           enum_c_vals=s2a("SCALAPACK", "PDGEMM", "COSMA"), &
     750              :                           enum_desc=s2a("Standard ScaLAPACK pdgemm", &
     751              :                                         "Alias for ScaLAPACK", &
     752        16805 :                                         "COSMA is employed. See <https://github.com/eth-cscs/COSMA>."))
     753        16805 :       CALL section_add_keyword(section, keyword)
     754        16805 :       CALL keyword_release(keyword)
     755              : 
     756              :       !
     757        16805 :    END SUBROUTINE create_fm_section
     758              : ! **************************************************************************************************
     759              : !> \brief   Creates the input section used to define the heuristic rules which determine if
     760              : !>          a FM matrix should be redistributed before diagonalizing it.
     761              : !> \param section the input section to create
     762              : !> \author Nico Holmberg [01.2018]
     763              : ! **************************************************************************************************
     764        16805 :    SUBROUTINE create_fm_diag_rules_section(section)
     765              :       TYPE(section_type), POINTER                        :: section
     766              : 
     767              :       TYPE(keyword_type), POINTER                        :: keyword
     768              : 
     769        16805 :       CPASSERT(.NOT. ASSOCIATED(section))
     770              :       CALL section_create(section, __LOCATION__, name="FM_DIAG_SETTINGS", &
     771              :                           description="This section defines a set of heuristic rules which are "// &
     772              :                           "used to calculate the optimal number of CPUs, M, needed to diagonalize a "// &
     773              :                           "full matrix distributed on N processors (FM type). If M &lt N, the matrix "// &
     774              :                           "is redistributed onto M processors before it is diagonalized. "// &
     775              :                           "The optimal value is calculate according to M = ((K+a*x-1)/(a*x))*a, "// &
     776              :                           "where K is the size of the matrix, and {a, x} are integers defined below. "// &
     777              :                           "The default values have been selected based on timings on a Cray XE6. "// &
     778              :                           "Supports diagonalization libraries SL and ELPA (see keyword ELPA_FORCE_REDISTRIBUTE).", &
     779        16805 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
     780              : 
     781        16805 :       NULLIFY (keyword)
     782              : 
     783              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER_A", &
     784              :                           description="Parameter used for defining the rule which determines the optimal "// &
     785              :                           "number of CPUs needed to diagonalize a full distributed matrix. The optimal "// &
     786              :                           "number of CPUs will be an integer multiple of this variable.", &
     787              :                           usage="PARAMETER_A 4", type_of_var=integer_t, &
     788        16805 :                           default_i_val=4)
     789        16805 :       CALL section_add_keyword(section, keyword)
     790        16805 :       CALL keyword_release(keyword)
     791              : 
     792              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER_X", &
     793              :                           description="Parameter used for defining the rule which determines the optimal "// &
     794              :                           "number of CPUs needed to diagonalize a full distributed matrix. The optimal "// &
     795              :                           "number of CPUs will be roughly proportional to this value.", &
     796              :                           usage="PARAMETER_X 60", type_of_var=integer_t, &
     797        16805 :                           default_i_val=60)
     798        16805 :       CALL section_add_keyword(section, keyword)
     799        16805 :       CALL keyword_release(keyword)
     800              : 
     801              :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_FM_REDISTRIBUTE", &
     802              :                           description="Controls printing of information related to this section. For each "// &
     803              :                           "diagonalized matrix, prints the size of the matrix, the optimal number of CPUs, "// &
     804              :                           "as well as notifies if the matrix was redistributed. Useful for testing.", &
     805              :                           usage="PRINT_FM_REDISTRIBUTE", type_of_var=logical_t, &
     806        16805 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     807        16805 :       CALL section_add_keyword(section, keyword)
     808        16805 :       CALL keyword_release(keyword)
     809              : 
     810              :       CALL keyword_create(keyword, __LOCATION__, name="ELPA_FORCE_REDISTRIBUTE", &
     811              :                           description="Controls how to perform redistribution when ELPA is used for diagonalization. "// &
     812              :                           "By default, redistribution is always performed using the defined rules. "// &
     813              :                           "By turning off this keyword, matrices are redistributed only to prevent crashes in the ELPA "// &
     814              :                           "library which happens when the original matrix is distributed over too many processors.", &
     815              :                           usage="ELPA_FORCE_REDISTRIBUTE", type_of_var=logical_t, &
     816        16805 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     817        16805 :       CALL section_add_keyword(section, keyword)
     818        16805 :       CALL keyword_release(keyword)
     819              : 
     820        16805 :    END SUBROUTINE create_fm_diag_rules_section
     821              : 
     822              : ! **************************************************************************************************
     823              : !> \brief Creates the section for configuring the grid library
     824              : !> \param section ...
     825              : !> \author Ole Schuett
     826              : ! **************************************************************************************************
     827        16805 :    SUBROUTINE create_grid_section(section)
     828              :       TYPE(section_type), POINTER                        :: section
     829              : 
     830              :       TYPE(keyword_type), POINTER                        :: keyword
     831              : 
     832        16805 :       CPASSERT(.NOT. ASSOCIATED(section))
     833              :       CALL section_create(section, __LOCATION__, name="GRID", &
     834              :                           description="Configuration options for the grid library, "// &
     835              :                           "which performs e.g. the collocate and integrate of the GPW method.", &
     836        16805 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     837              : 
     838        16805 :       NULLIFY (keyword)
     839              :       CALL keyword_create(keyword, __LOCATION__, name="BACKEND", &
     840              :                           description="Selects the backed used by the grid library.", &
     841              :                           default_i_val=GRID_BACKEND_AUTO, &
     842              :                           enum_i_vals=[GRID_BACKEND_AUTO, GRID_BACKEND_REF, GRID_BACKEND_CPU, &
     843              :                                        GRID_BACKEND_DGEMM, GRID_BACKEND_GPU], &
     844              :                           enum_c_vals=s2a("AUTO", "REFERENCE", "CPU", "DGEMM", "GPU"), &
     845              :                           enum_desc=s2a("Let the grid library pick the backend automatically", &
     846              :                                         "Reference backend implementation", &
     847              :                                         "Optimized CPU backend", &
     848              :                                         "Alternative CPU backend based on DGEMM", &
     849        16805 :                                         "GPU backend optimized for NVIDIA and AMD GPU"))
     850        16805 :       CALL section_add_keyword(section, keyword)
     851        16805 :       CALL keyword_release(keyword)
     852              : 
     853              :       CALL keyword_create(keyword, __LOCATION__, name="VALIDATE", &
     854              :                           description="When enabled the reference backend is run in shadow mode "// &
     855              :                           "and its results are compared with those from the selected backend. "// &
     856              :                           "If the two results differ by too much then the calculation is aborted.", &
     857        16805 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     858        16805 :       CALL section_add_keyword(section, keyword)
     859        16805 :       CALL keyword_release(keyword)
     860              : 
     861              :       CALL keyword_create(keyword, __LOCATION__, name="APPLY_CUTOFF", &
     862              :                           description="When enabled the cpu backend "// &
     863              :                           "apply a spherical cutoff on the top of the cube. "// &
     864              :                           "There is a performance penalty using it in "// &
     865              :                           "combination with the cpu backend but it is on by "// &
     866              :                           "default for the regtests", default_l_val=.TRUE., &
     867        16805 :                           lone_keyword_l_val=.TRUE.)
     868        16805 :       CALL section_add_keyword(section, keyword)
     869        16805 :       CALL keyword_release(keyword)
     870              : 
     871        16805 :    END SUBROUTINE create_grid_section
     872              : 
     873              : END MODULE input_cp2k_global
        

Generated by: LCOV version 2.0-1