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