LCOV - code coverage report
Current view: top level - src - input_cp2k_distribution.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:42dac4a) Lines: 100.0 % 26 26
Test Date: 2025-07-25 12:55:17 Functions: 100.0 % 1 1

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2025 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \brief function that builds the distribution section of the input
      10              : !> \par History
      11              : !>      04.2007 created
      12              : !> \author Joost VandeVondele
      13              : ! **************************************************************************************************
      14              : MODULE input_cp2k_distribution
      15              : 
      16              :    USE input_constants,                 ONLY: model_block_count,&
      17              :                                               model_block_lmax,&
      18              :                                               model_block_surface
      19              :    USE input_keyword_types,             ONLY: keyword_create,&
      20              :                                               keyword_release,&
      21              :                                               keyword_type
      22              :    USE input_section_types,             ONLY: section_add_keyword,&
      23              :                                               section_create,&
      24              :                                               section_type
      25              :    USE string_utilities,                ONLY: s2a
      26              : #include "./base/base_uses.f90"
      27              : 
      28              :    IMPLICIT NONE
      29              :    PRIVATE
      30              : 
      31              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .FALSE.
      32              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_distribution'
      33              : 
      34              :    PUBLIC :: create_distribution_section
      35              : 
      36              : CONTAINS
      37              : 
      38              : ! **************************************************************************************************
      39              : !> \brief Creates the distribution section
      40              : !> \param section the section to create
      41              : !> \author Joost VandeVondele
      42              : ! **************************************************************************************************
      43         9254 :    SUBROUTINE create_distribution_section(section)
      44              :       TYPE(section_type), POINTER                        :: section
      45              : 
      46              :       TYPE(keyword_type), POINTER                        :: keyword
      47              : 
      48         9254 :       CPASSERT(.NOT. ASSOCIATED(section))
      49              :       CALL section_create(section, __LOCATION__, name="DISTRIBUTION", &
      50              :                           description="can be used used to tune the parallel distribution of the data", &
      51         9254 :                           n_keywords=2, n_subsections=2, repeats=.FALSE.)
      52              : 
      53         9254 :       NULLIFY (keyword)
      54              : 
      55              :       CALL keyword_create(keyword, __LOCATION__, name="COST_MODEL", &
      56              :                           description="The cost model that needs to be minimized ", &
      57              :                           usage="COST_MODEL BLOCK_COUNT", &
      58              :                           enum_c_vals=s2a("BLOCK_COUNT", "BLOCK_SURFACE", "BLOCK_LMAX"), &
      59              :                           enum_i_vals=(/model_block_count, model_block_surface, model_block_lmax/), &
      60              :                           enum_desc=s2a("the number of blocks", &
      61              :                                         "the number of blocks weighted by the number elements per block", &
      62              :                                         "the number of blocks weighted by the sum of the lmax"), &
      63         9254 :                           default_i_val=model_block_count)
      64         9254 :       CALL section_add_keyword(section, keyword)
      65         9254 :       CALL keyword_release(keyword)
      66              : 
      67              :       CALL keyword_create(keyword, __LOCATION__, name="2D_MOLECULAR_DISTRIBUTION", &
      68              :                           description="Distribute the atoms so that atoms belonging to a given molecule"// &
      69              :                           " are on the same CPU for the 2D distribution. This might give rise to a"// &
      70              :                           " worse distribution but reduces memory needs of finding the optimal distribution.", &
      71              :                           usage="2D_MOLECULAR_DISTRIBUTION TRUE", &
      72         9254 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      73         9254 :       CALL section_add_keyword(section, keyword)
      74         9254 :       CALL keyword_release(keyword)
      75              : 
      76              :       CALL keyword_create(keyword, __LOCATION__, name="SKIP_OPTIMIZATION", &
      77              :                           description="Do not optimize the distribution, go for something very simple."// &
      78              :                           " Might be useful if the optimization, which scales quadratically in system size, is too expensive.", &
      79              :                           usage="SKIP_OPTIMIZATION TRUE", &
      80         9254 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      81         9254 :       CALL section_add_keyword(section, keyword)
      82         9254 :       CALL keyword_release(keyword)
      83              : 
      84              :       CALL keyword_create(keyword, __LOCATION__, name="BASIC_OPTIMIZATION", &
      85              :                           description="Creates a distribution based on a few heuristics using only minimal memory "// &
      86              :                           "and CPU time.", &
      87              :                           usage="BASIC_OPTIMIZATION TRUE", &
      88         9254 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
      89         9254 :       CALL section_add_keyword(section, keyword)
      90         9254 :       CALL keyword_release(keyword)
      91              : 
      92              :       CALL keyword_create(keyword, __LOCATION__, name="BASIC_SPATIAL_OPTIMIZATION", &
      93              :                           description="Creates a distribution with spatial info, using only minimal memory "// &
      94              :                           "and CPU time.", &
      95              :                           usage="BASIC_SPATIAL_OPTIMIZATION TRUE", &
      96         9254 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      97         9254 :       CALL section_add_keyword(section, keyword)
      98         9254 :       CALL keyword_release(keyword)
      99              : 
     100              :       CALL keyword_create(keyword, __LOCATION__, name="BASIC_CLUSTER_OPTIMIZATION", &
     101              :                           description="Creates a distribution with spatial info, using recursively KMEANS clustering. ", &
     102              :                           usage="BASIC_CLUSTER_OPTIMIZATION TRUE", &
     103         9254 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     104         9254 :       CALL section_add_keyword(section, keyword)
     105         9254 :       CALL keyword_release(keyword)
     106              : 
     107              :       CALL keyword_create(keyword, __LOCATION__, name="SYMMETRIC", &
     108              :                           description="Take the symmetry of the distribution_2d into account.", &
     109              :                           usage="SYMMETRIC TRUE", &
     110         9254 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     111         9254 :       CALL section_add_keyword(section, keyword)
     112         9254 :       CALL keyword_release(keyword)
     113              : 
     114         9254 :    END SUBROUTINE create_distribution_section
     115              : 
     116              : END MODULE input_cp2k_distribution
        

Generated by: LCOV version 2.0-1