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