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