LCOV - code coverage report
Current view: top level - src - input_cp2k_rsgrid.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:1f285aa) Lines: 23 23 100.0 %
Date: 2024-04-23 06:49:27 Functions: 1 1 100.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2024 CP2K developers group <https://cp2k.org>                                   !
       4             : !                                                                                                  !
       5             : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6             : !--------------------------------------------------------------------------------------------------!
       7             : 
       8             : ! **************************************************************************************************
       9             : !> \par History
      10             : !>      01.2008 Created
      11             : !> \author Joost
      12             : ! **************************************************************************************************
      13             : MODULE input_cp2k_rsgrid
      14             : 
      15             :    USE input_keyword_types,             ONLY: keyword_create,&
      16             :                                               keyword_release,&
      17             :                                               keyword_type
      18             :    USE input_section_types,             ONLY: section_add_keyword,&
      19             :                                               section_create,&
      20             :                                               section_type
      21             :    USE kinds,                           ONLY: dp
      22             :    USE realspace_grid_types,            ONLY: rsgrid_automatic,&
      23             :                                               rsgrid_distributed,&
      24             :                                               rsgrid_replicated
      25             :    USE string_utilities,                ONLY: s2a
      26             : #include "./base/base_uses.f90"
      27             : 
      28             :    IMPLICIT NONE
      29             :    PRIVATE
      30             : 
      31             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_rsgrid'
      32             : 
      33             :    PUBLIC :: create_rsgrid_section
      34             : 
      35             : !***
      36             : CONTAINS
      37             : 
      38             : ! **************************************************************************************************
      39             : !> \brief ...
      40             : !> \param section ...
      41             : !> \author Joost
      42             : ! **************************************************************************************************
      43       43896 :    SUBROUTINE create_rsgrid_section(section)
      44             :       TYPE(section_type), POINTER                        :: section
      45             : 
      46             :       TYPE(keyword_type), POINTER                        :: keyword
      47             : 
      48       43896 :       CPASSERT(.NOT. ASSOCIATED(section))
      49             :       CALL section_create(section, __LOCATION__, name="RS_GRID", &
      50             :                          description="Set options that influence how the realspace grids are being distributed in parallel runs.", &
      51       43896 :                           n_keywords=5, n_subsections=0, repeats=.TRUE.)
      52             : 
      53       43896 :       NULLIFY (keyword)
      54             :       CALL keyword_create(keyword, __LOCATION__, name="DISTRIBUTION_TYPE", &
      55             :                           description="Parallelization strategy.", &
      56             :                           usage="DISTRIBUTION_TYPE DISTRIBUTED", &
      57             :                           enum_c_vals=s2a("AUTOMATIC", "DISTRIBUTED", "REPLICATED"), &
      58             :                           enum_i_vals=(/rsgrid_automatic, rsgrid_distributed, rsgrid_replicated/), &
      59             :                           enum_desc=s2a("Use heuristic rules to decide between distributed and replicated", &
      60             :                                         "Force a distributed setup if possible", &
      61             :                                         "Force a replicated setup"), &
      62       43896 :                           default_i_val=rsgrid_automatic)
      63       43896 :       CALL section_add_keyword(section, keyword)
      64       43896 :       CALL keyword_release(keyword)
      65             : 
      66             :       CALL keyword_create(keyword, __LOCATION__, name="DISTRIBUTION_LAYOUT", &
      67             :                           description="Specifies the number of slices in the x, y and z directions. "// &
      68             :                           "-1 specifies that any number of slices is OK. "// &
      69             :                           "If a given distribution can not be satisfied, a replicated grid will result. "// &
      70             :                           "Also see LOCK_DISTRIBUTION.", &
      71             :                           usage="DISTRIBUTION_LAYOUT", &
      72             :                           repeats=.FALSE., n_var=3, &
      73       43896 :                           default_i_vals=(/-1, -1, -1/))
      74       43896 :       CALL section_add_keyword(section, keyword)
      75       43896 :       CALL keyword_release(keyword)
      76             : 
      77             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_DISTRIBUTED_LEVEL", &
      78             :                           description="If the multigrid-level of a grid is larger than the parameter,"// &
      79             :                           " it will not be distributed in the automatic scheme.", &
      80             :                           usage="MAX_DISTRIBUTED_LEVEL 1", &
      81       43896 :                           default_i_val=2)
      82       43896 :       CALL section_add_keyword(section, keyword)
      83       43896 :       CALL keyword_release(keyword)
      84             : 
      85             :       CALL keyword_create(keyword, __LOCATION__, name="LOCK_DISTRIBUTION", &
      86             :                           description="Expert use only, only basic QS deals correctly with a non-default value. "// &
      87             :                           "If the distribution is locked, a grid will have the same distribution as "// &
      88             :                           "the next finer multigrid (provided it is distributed). "// &
      89             :                           "If unlocked, all grids can be distributed freely.", &
      90             :                           usage="LOCK_DISTRIBUTION TRUE", &
      91       43896 :                           default_l_val=.TRUE.)
      92       43896 :       CALL section_add_keyword(section, keyword)
      93       43896 :       CALL keyword_release(keyword)
      94             : 
      95             :       CALL keyword_create(keyword, __LOCATION__, name="MEMORY_FACTOR", &
      96             :                           description="A grid will only be distributed if the memory usage for that grid (including halo) "// &
      97             :                           "is smaller than a replicated grid by this parameter.", &
      98             :                           usage="MEMORY_FACTOR 4.0", &
      99       43896 :                           default_r_val=2.0_dp)
     100       43896 :       CALL section_add_keyword(section, keyword)
     101       43896 :       CALL keyword_release(keyword)
     102             : 
     103             :       CALL keyword_create(keyword, __LOCATION__, name="HALO_REDUCTION_FACTOR", &
     104             :                           description="Can be used to reduce the halo of the distributed grid (experimental features).", &
     105             :                           usage="HALO_REDUCTION_FACTOR 0.5", &
     106       43896 :                           default_r_val=1.0_dp)
     107       43896 :       CALL section_add_keyword(section, keyword)
     108       43896 :       CALL keyword_release(keyword)
     109       43896 :    END SUBROUTINE create_rsgrid_section
     110             : 
     111             : END MODULE input_cp2k_rsgrid

Generated by: LCOV version 1.15