(git:58e3e09)
input_cp2k_distribution.F
Go to the documentation of this file.
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 !> \brief function that builds the distribution section of the input
10 !> \par History
11 !> 04.2007 created
12 !> \author Joost VandeVondele
13 ! **************************************************************************************************
15 
21  keyword_type
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 
35 
36 CONTAINS
37 
38 ! **************************************************************************************************
39 !> \brief Creates the distribution section
40 !> \param section the section to create
41 !> \author Joost VandeVondele
42 ! **************************************************************************************************
43  SUBROUTINE create_distribution_section(section)
44  TYPE(section_type), POINTER :: section
45 
46  TYPE(keyword_type), POINTER :: keyword
47 
48  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  n_keywords=2, n_subsections=2, repeats=.false.)
52 
53  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"), &
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  default_i_val=model_block_count)
64  CALL section_add_keyword(section, keyword)
65  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  default_l_val=.false., lone_keyword_l_val=.true.)
73  CALL section_add_keyword(section, keyword)
74  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  default_l_val=.false., lone_keyword_l_val=.true.)
81  CALL section_add_keyword(section, keyword)
82  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  default_l_val=.true., lone_keyword_l_val=.true.)
89  CALL section_add_keyword(section, keyword)
90  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  default_l_val=.false., lone_keyword_l_val=.true.)
97  CALL section_add_keyword(section, keyword)
98  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  default_l_val=.false., lone_keyword_l_val=.true.)
104  CALL section_add_keyword(section, keyword)
105  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  default_l_val=.true., lone_keyword_l_val=.true.)
111  CALL section_add_keyword(section, keyword)
112  CALL keyword_release(keyword)
113 
114  END SUBROUTINE create_distribution_section
115 
116 END MODULE input_cp2k_distribution
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public model_block_count
integer, parameter, public model_block_lmax
integer, parameter, public model_block_surface
function that builds the distribution section of the input
subroutine, public create_distribution_section(section)
Creates the distribution section.
represents keywords in an input
subroutine, public keyword_release(keyword)
releases the given keyword (see doc/ReferenceCounting.html)
subroutine, public keyword_create(keyword, location, name, description, usage, type_of_var, n_var, repeats, variants, default_val, default_l_val, default_r_val, default_lc_val, default_c_val, default_i_val, default_l_vals, default_r_vals, default_c_vals, default_i_vals, lone_keyword_val, lone_keyword_l_val, lone_keyword_r_val, lone_keyword_c_val, lone_keyword_i_val, lone_keyword_l_vals, lone_keyword_r_vals, lone_keyword_c_vals, lone_keyword_i_vals, enum_c_vals, enum_i_vals, enum, enum_strict, enum_desc, unit_str, citations, deprecation_notice, removed)
creates a keyword object
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_create(section, location, name, description, n_keywords, n_subsections, repeats, citations)
creates a list of keywords
subroutine, public section_add_keyword(section, keyword)
adds a keyword to the given section
Utilities for string manipulations.