(git:c641773)
Loading...
Searching...
No Matches
environment.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Sets up and terminates the global environment variables
10!> \par History
11!> - Merged with Quickstep MODULE start_program_run (17.01.2002,MK)
12!> - Compile information added (16.01.2002,MK)
13!> - Merged with MODULE cp2k_input, some rearrangements (30.10.2002,MK)
14!> - Update seed input (24.10.2016,MK)
15!> \author JGH,MK
16! **************************************************************************************************
18 USE bibliography, ONLY: frigo2005,&
19 marek2014,&
20 solca2024,&
21 cite_reference
22 USE cp2k_info, ONLY: &
27 USE cp_files, ONLY: close_file,&
35 USE cp_fm_diag, ONLY: &
43 USE cp_iter_types, ONLY: iter_notice,&
46 USE cp_log_handling, ONLY: &
58 USE fft_tools, ONLY: fwfft,&
59 fft3d,&
65 USE grid_api, ONLY: grid_backend_auto,&
70 USE header, ONLY: cp2k_footer,&
72 USE input_constants, ONLY: &
81 USE input_section_types, ONLY: &
86 USE kinds, ONLY: default_path_length,&
88 dp,&
89 int_8,&
92 USE machine, ONLY: &
97 USE mp_perf_env, ONLY: add_mp_perf_env,&
104 USE parallel_rng_types, ONLY: gaussian,&
105 check_rng,&
108 USE physcon, ONLY: write_physcon
114 USE timings, ONLY: add_timer_env,&
125
126!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads
127#include "./base/base_uses.f90"
128
129 IMPLICIT NONE
130
131 PRIVATE
132
133 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'environment'
134
135 ! Public subroutines
136
138
139CONTAINS
140
141! **************************************************************************************************
142!> \brief Initializes a CP2K run (setting of the global environment variables)
143!> \param para_env ...
144!> \param output_unit ...
145!> \param globenv ...
146!> \param input_file_name ...
147!> \param wdir ...
148!> \par History
149!> JGH (28.11.2001) : default for pp_library_path
150!> - print keys added (17.01.2002, MK)
151!> - merged with cp2k_input (30.10.2002,MK)
152!> \author JGH,MK
153! **************************************************************************************************
154 SUBROUTINE cp2k_init(para_env, output_unit, globenv, input_file_name, wdir)
155
156 TYPE(mp_para_env_type), POINTER :: para_env
157 INTEGER :: output_unit
158 TYPE(global_environment_type), POINTER :: globenv
159 CHARACTER(LEN=*) :: input_file_name
160 CHARACTER(LEN=*), OPTIONAL :: wdir
161
162 CHARACTER(LEN=10*default_string_length) :: cp_flags
163 CHARACTER(LEN=default_path_length) :: path
164 INTEGER :: i, ilen, my_output_unit
165 TYPE(cp_logger_type), POINTER :: logger
166
167#if defined(__FAST_MATH__)
168 CALL cp_abort(__location__, &
169 "During compilation, one of the following flags was active: "// &
170 "`-ffast-math` (GCC) or `-hfpN` (Cray, N > 0, default N=2). "// &
171 "This can lead to wrong results and numerical instabilities "// &
172 "and is therefore no longer supported.")
173#endif
174
175#if defined(NDEBUG)
176 CALL cp_abort(__location__, &
177 "Please do not build CP2K with NDEBUG. There is no "// &
178 "performance advantage and asserts will save your neck. "// &
179 "See also <https://github.com/cp2k/cp2k/pull/3172>.")
180#endif
181
182 ! create a timer_env
183
184 CALL add_timer_env()
185
186 ! Message passing performance
187 CALL add_mp_perf_env()
188
189 ! Init the default logger
190 IF (para_env%is_source()) THEN
191 my_output_unit = output_unit
192 ELSE
193 my_output_unit = -1
194 END IF
195 NULLIFY (logger)
196 CALL cp_logger_create(logger, para_env=para_env, &
197 default_global_unit_nr=output_unit, &
198 close_global_unit_on_dealloc=.false.)
199 CALL cp_add_default_logger(logger)
200 CALL cp_logger_release(logger)
201
202 ! Initialize timing
203 CALL timeset(root_cp2k_name, globenv%handle)
204
205 ! Print header
206 CALL cp2k_header(my_output_unit, wdir)
207
208 IF (my_output_unit > 0) THEN
209 WRITE (unit=my_output_unit, fmt="(/,T2,A,T31,A50)") &
210 "CP2K| version string: ", adjustr(trim(cp2k_version))
211 WRITE (unit=my_output_unit, fmt="(T2,A,T41,A40)") &
212 "CP2K| source code revision number:", &
213 adjustr(compile_revision)
214 cp_flags = cp2k_flags()
215 ilen = len_trim(cp_flags)
216 WRITE (unit=my_output_unit, fmt="(T2,A)") &
217 "CP2K| "//cp_flags(1:73)
218 IF (ilen > 73) THEN
219 DO i = 0, (ilen - 75)/61
220 WRITE (unit=my_output_unit, fmt="(T2,A)") &
221 "CP2K| "//trim(cp_flags(74 + i*61:min(74 + (i + 1)*61, ilen)))
222 END DO
223 END IF
224 WRITE (unit=my_output_unit, fmt="(T2,A,T41,A40)") &
225 "CP2K| is freely available from ", &
226 adjustr(trim(cp2k_home))
227 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
228 "CP2K| Program compiled at", &
229 adjustr(compile_date(1:min(50, len(compile_date))))
230 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
231 "CP2K| Program compiled on", &
232 adjustr(compile_host(1:min(50, len(compile_host))))
233 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
234 "CP2K| Program compiled with", &
235 adjustr(compile_with(1:min(50, len(compile_with))))
236 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
237 "CP2K| Program compiled for", &
238 adjustr(compile_arch(1:min(50, len(compile_arch))))
239 path = get_compile_dir()
240 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
241 "CP2K| Program compiled in", adjustr(path(1:50))
242 DO i = 51, len_trim(path), 50
243 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A)") "CP2K|", path(i:min(len_trim(path), i + 49))
244 END DO
245 CALL m_getexe(path)
246 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
247 "CP2K| Program executable", adjustr(path(1:50))
248 DO i = 51, len_trim(path), 50
249 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A)") "CP2K|", path(i:min(len_trim(path), i + 49))
250 END DO
251 path = get_data_dir()
252 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
253 "CP2K| Data directory path", adjustr(path(1:50))
254 DO i = 51, len_trim(path), 50
255 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A)") "CP2K|", path(i:min(len_trim(path), i + 49))
256 END DO
257 path = input_file_name
258 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
259 "CP2K| Input file name", adjustr(path(1:50))
260 DO i = 51, len_trim(path), 50
261 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A)") "CP2K|", path(i:min(len_trim(path), i + 49))
262 END DO
263 FLUSH (my_output_unit) ! ignore &GLOBAL / FLUSH_SHOULD_FLUSH
264 END IF
265
266 END SUBROUTINE cp2k_init
267
268! **************************************************************************************************
269!> \brief echoes the list of host names and pids
270!> \param para_env ...
271!> \param output_unit ...
272! **************************************************************************************************
273 SUBROUTINE echo_all_hosts(para_env, output_unit)
274 TYPE(mp_para_env_type), POINTER :: para_env
275 INTEGER, INTENT(IN) :: output_unit
276
277 CHARACTER(LEN=default_string_length) :: string
278 INTEGER :: ipe
279 INTEGER, ALLOCATABLE, DIMENSION(:) :: all_pid
280 INTEGER, ALLOCATABLE, DIMENSION(:, :) :: all_host
281
282 ! Print a list of all started processes
283
284 ALLOCATE (all_pid(para_env%num_pe), source=0)
285 all_pid(para_env%mepos + 1) = r_pid
286
287 CALL para_env%sum(all_pid)
288 ALLOCATE (all_host(30, para_env%num_pe), source=0)
289
290 CALL string_to_ascii(r_host_name, all_host(:, para_env%mepos + 1))
291 CALL para_env%sum(all_host)
292 IF (output_unit > 0) THEN
293 WRITE (unit=output_unit, fmt="(T2,A)") ""
294 DO ipe = 1, para_env%num_pe
295 CALL ascii_to_string(all_host(:, ipe), string)
296 WRITE (unit=output_unit, fmt="(T2,A,T63,I8,T71,I10)") &
297 trim(r_user_name)//"@"//trim(string)// &
298 " has created rank and process ", ipe - 1, all_pid(ipe)
299 END DO
300 END IF
301
302 DEALLOCATE (all_pid)
303 DEALLOCATE (all_host)
304
305 END SUBROUTINE echo_all_hosts
306
307! **************************************************************************************************
308!> \brief echoes the list the number of process per host
309!> \param para_env ...
310!> \param output_unit ...
311!> \param node_count Count number of distributed systems (nodes)
312! **************************************************************************************************
313 SUBROUTINE echo_all_process_host(para_env, output_unit, node_count)
314 TYPE(mp_para_env_type), POINTER :: para_env
315 INTEGER, INTENT(IN) :: output_unit
316 INTEGER, INTENT(OUT), OPTIONAL :: node_count
317
318 CHARACTER(LEN=default_string_length) :: string, string_sec
319 INTEGER :: ipe, jpe, nr_dist, nr_occu
320 INTEGER, ALLOCATABLE, DIMENSION(:) :: all_pid
321 INTEGER, ALLOCATABLE, DIMENSION(:, :) :: all_host
322
323 ALLOCATE (all_host(30, para_env%num_pe), source=0)
324 ALLOCATE (all_pid(para_env%num_pe), source=0)
325
326 IF (m_procrun(r_pid) == 1) THEN
327 CALL string_to_ascii(r_host_name, all_host(:, para_env%mepos + 1))
328 CALL para_env%sum(all_host)
329 END IF
330
331 nr_dist = 0
332 IF (output_unit > 0) WRITE (unit=output_unit, fmt="(T2,A)") ""
333 DO ipe = 1, para_env%num_pe
334 nr_occu = 0
335 IF (all_pid(ipe) /= -1) THEN
336 CALL ascii_to_string(all_host(:, ipe), string)
337 DO jpe = 1, para_env%num_pe
338 CALL ascii_to_string(all_host(:, jpe), string_sec)
339 IF (string == string_sec) THEN
340 nr_occu = nr_occu + 1
341 all_pid(jpe) = -1
342 END IF
343 END DO
344 IF (output_unit > 0) THEN
345 WRITE (unit=output_unit, fmt="(T2,A,T63,I8,A)") &
346 trim(r_user_name)//"@"//trim(string)// &
347 " is running ", nr_occu, " processes"
348 END IF
349 nr_dist = nr_dist + 1
350 END IF
351 END DO
352
353 DEALLOCATE (all_pid)
354 DEALLOCATE (all_host)
355
356 cpassert(0 < nr_dist)
357 IF (PRESENT(node_count)) node_count = nr_dist
358
359 END SUBROUTINE echo_all_process_host
360
361! **************************************************************************************************
362!> \brief read part of cp2k_init
363!> \param root_section ...
364!> \param para_env ...
365!> \param globenv the globenv
366!> \author fawzi
367!> \note
368!> The following routines need to be synchronized wrt. adding/removing
369!> of the default environments (logging, performance,error):
370!> environment:cp2k_init, environment:cp2k_finalize,
371!> f77_interface:f_env_add_defaults, f77_interface:f_env_rm_defaults,
372!> f77_interface:create_force_env, f77_interface:destroy_force_env
373! **************************************************************************************************
374 SUBROUTINE cp2k_read(root_section, para_env, globenv)
375
376 TYPE(section_vals_type), POINTER :: root_section
377 TYPE(mp_para_env_type), POINTER :: para_env
378 TYPE(global_environment_type), POINTER :: globenv
379
380 CHARACTER(LEN=default_string_length) :: c_val
381 INTEGER :: i, iter_print, iw, print_level
382 LOGICAL :: explicit
383 TYPE(cp_logger_type), POINTER :: logger
384
385 ! Read the input/output section
386
387 ! Set verbosity for printing information about iteration levels.
388 ! Note that at this point there are at least two loggers in the stack
389 ! (first one created in init_cp2k of f77_interface.F, second one created
390 ! in cp2k_init of environment.F) and each logger has an iter_info that
391 ! can carry iteration levels. But cp2k_init does not have access to input
392 ! sections, and also cannot be adjusted to receive them because of the
393 ! fragile initialization order in create_force_env in f77_interface.
394 ! GLOBAL%ITER_LEVEL_VERBOSITY configures the second one like
395 ! GLOBAL%PRINT_LEVEL does.
396 CALL section_vals_val_get(root_section, "GLOBAL%ITER_LEVEL_VERBOSITY", explicit=explicit)
397 IF (explicit) THEN
398 CALL section_vals_val_get(root_section, "GLOBAL%ITER_LEVEL_VERBOSITY", i_val=iter_print)
399 ELSE
400 CALL section_vals_val_get(root_section, "GLOBAL%PRINT_LEVEL", i_val=print_level)
401 IF (print_level >= debug_print_level) THEN
402 iter_print = iter_stack
403 ELSE IF (print_level == high_print_level) THEN
404 iter_print = iter_notice
405 ELSE
406 iter_print = iter_silent
407 END IF
408 END IF
409
410 logger => cp_get_default_logger()
411 logger%iter_info%iter_print = iter_print
412
413 ! try to use better names for the local log if it is not too late
414 CALL section_vals_val_get(root_section, "GLOBAL%OUTPUT_FILE_NAME", &
415 c_val=c_val)
416 IF (c_val /= "") THEN
417 CALL cp_logger_set(logger, &
418 local_filename=trim(c_val)//"_localLog")
419 END IF
420
421 ! Process project name
422 CALL section_vals_val_get(root_section, "GLOBAL%PROJECT", c_val=c_val)
423 IF (index(c_val(:len_trim(c_val)), " ") > 0) THEN
424 CALL cp_warn(__location__, &
425 "Project name <"//trim(c_val)//"> contains one or more "// &
426 "whitespaces; replacing them with underscores to reset "// &
427 "the project name for better file naming practices now.")
428 DO i = 1, len_trim(c_val)
429 ! Replace space with underscore
430 IF (c_val(i:i) == " ") c_val(i:i) = "_"
431 END DO
432 CALL section_vals_val_set(root_section, "GLOBAL%PROJECT", c_val=trim(c_val))
433 END IF
434 IF (c_val /= "") THEN
435 CALL cp_logger_set(logger, local_filename=trim(c_val)//"_localLog")
436 END IF
437 logger%iter_info%project_name = c_val
438
439 CALL section_vals_val_get(root_section, "GLOBAL%PRINT_LEVEL", &
440 i_val=logger%iter_info%print_level)
441
442 ! Read the CP2K section
443 CALL read_cp2k_section(root_section, para_env, globenv)
444
445 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT/BASIC_DATA_TYPES", &
446 extension=".Log")
447 IF (iw > 0) CALL print_kind_info(iw)
448 CALL cp_print_key_finished_output(iw, logger, root_section, &
449 "GLOBAL%PRINT/BASIC_DATA_TYPES")
450
451 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT/PHYSCON", &
452 extension=".Log")
453 IF (iw > 0) CALL write_physcon(iw)
454 CALL cp_print_key_finished_output(iw, logger, root_section, &
455 "GLOBAL%PRINT/PHYSCON")
456
457 END SUBROUTINE cp2k_read
458
459! **************************************************************************************************
460!> \brief globenv initializations that need the input and error
461!> \param root_section ...
462!> \param para_env ...
463!> \param globenv the global environment to initialize
464!> \author fawzi
465!> \note
466!> if possible do the initializations here as the environment
467!> (error,...) is setup, instead of cp2k_init
468! **************************************************************************************************
469 SUBROUTINE cp2k_setup(root_section, para_env, globenv)
470
471 TYPE(section_vals_type), POINTER :: root_section
472 TYPE(mp_para_env_type), POINTER :: para_env
473 TYPE(global_environment_type), POINTER :: globenv
474
475 INTEGER :: iw, maxl
476 INTEGER, DIMENSION(:), POINTER :: seed_vals
477 REAL(kind=dp), DIMENSION(3, 2) :: initial_seed
478 TYPE(cp_logger_type), POINTER :: logger
479
480 NULLIFY (logger)
481 logger => cp_get_default_logger()
482
483 ! Initialize the parallel random number generator
484
485 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT/RNG_MATRICES", &
486 extension=".Log")
487 IF (iw > 0) THEN
488 CALL write_rng_matrices(iw)
489 END IF
490
491 CALL cp_print_key_finished_output(iw, logger, root_section, &
492 "GLOBAL%PRINT/RNG_MATRICES")
493
494 ! Initialize a global normally Gaussian distributed (pseudo)random number stream
495
496 CALL section_vals_val_get(root_section, "GLOBAL%SEED", i_vals=seed_vals)
497 IF (SIZE(seed_vals) == 1) THEN
498 initial_seed(:, :) = real(seed_vals(1), kind=dp)
499 ELSE IF (SIZE(seed_vals) == 6) THEN
500 initial_seed(1:3, 1:2) = reshape(real(seed_vals(:), kind=dp), [3, 2])
501 ELSE
502 cpabort("Supply exactly 1 or 6 arguments for SEED in &GLOBAL only!")
503 END IF
504
505 globenv%gaussian_rng_stream = rng_stream_type( &
506 name="Global Gaussian random numbers", &
507 distribution_type=gaussian, &
508 seed=initial_seed, &
509 extended_precision=.true.)
510
511 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT/RNG_CHECK", &
512 extension=".Log")
513 IF (iw > 0) THEN
514 CALL check_rng(iw, para_env%is_source())
515 END IF
516
517 CALL cp_print_key_finished_output(iw, logger, root_section, &
518 "GLOBAL%PRINT/RNG_CHECK")
519
520 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT/GLOBAL_GAUSSIAN_RNG", &
521 extension=".Log")
522 IF (iw > 0) THEN
523 CALL globenv%gaussian_rng_stream%write(iw, write_all=.true.)
524 END IF
525
526 CALL cp_print_key_finished_output(iw, logger, root_section, &
527 "GLOBAL%PRINT/GLOBAL_GAUSSIAN_RNG")
528
529 CALL section_vals_val_get(root_section, "GLOBAL%PRINT%SPHERICAL_HARMONICS", i_val=maxl)
530 IF (maxl >= 0) THEN
531 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT", &
532 extension=".Log")
533 CALL init_orbital_pointers(maxl)
534 CALL init_spherical_harmonics(maxl, iw)
537 CALL cp_print_key_finished_output(iw, logger, root_section, &
538 "GLOBAL%PRINT")
539 END IF
540
541 END SUBROUTINE cp2k_setup
542
543! **************************************************************************************************
544!> \brief read the global section of new input
545!> \param root_section ...
546!> \param para_env ...
547!> \param globenv ...
548!> \par History
549!> 06-2005 [created]
550!> \author MI
551!> \note
552!> Should not be required anymore once everything is converted
553!> to get information directly from the input structure
554! **************************************************************************************************
555 SUBROUTINE read_global_section(root_section, para_env, globenv)
556
557 TYPE(section_vals_type), POINTER :: root_section
558 TYPE(mp_para_env_type), POINTER :: para_env
559 TYPE(global_environment_type), POINTER :: globenv
560
561 CHARACTER(LEN=6), PARAMETER :: start_section_label = "GLOBAL"
562
563 CHARACTER(LEN=13) :: omp_stacksize, tracing_string
564 CHARACTER(LEN=6) :: print_level_string
565 CHARACTER(LEN=default_path_length) :: basis_set_file_name, coord_file_name, &
566 mm_potential_file_name, &
567 potential_file_name
568 CHARACTER(LEN=default_string_length) :: env_num, model_name, project_name
569 CHARACTER(LEN=default_string_length), &
570 DIMENSION(:), POINTER :: trace_routines
571 INTEGER :: cpuid, cpuid_static, i_cholesky, i_dgemm, i_diag, i_fft, i_grid_backend, &
572 iforce_eval, method_name_id, n_rep_val, nforce_eval, node_count, num_threads, &
573 output_unit, print_level, trace_max, unit_nr
574 INTEGER(kind=int_8) :: buffers, buffers_avr, buffers_max, buffers_min, cached, cached_avr, &
575 cached_max, cached_min, memfree, memfree_avr, memfree_max, memfree_min, memlikelyfree, &
576 memlikelyfree_avr, memlikelyfree_max, memlikelyfree_min, memtotal, memtotal_avr, &
577 memtotal_max, memtotal_min, slab, slab_avr, slab_max, slab_min, sreclaimable, &
578 sreclaimable_avr, sreclaimable_max, sreclaimable_min
579 INTEGER, DIMENSION(:), POINTER :: i_force_eval
580 LOGICAL :: ata, do_echo_all_hosts, explicit, flag, &
581 report_maxloc, trace, trace_master
582 TYPE(cp_logger_type), POINTER :: logger
583 TYPE(enumeration_type), POINTER :: enum1, enum2
584 TYPE(keyword_type), POINTER :: keyword
585 TYPE(section_type), POINTER :: section
586 TYPE(section_vals_type), POINTER :: dft_section, force_env_sections, &
587 global_section, qmmm_section, &
588 subsys_section
589
590 NULLIFY (dft_section, global_section, i_force_eval)
591
592 logger => cp_get_default_logger()
593 global_section => section_vals_get_subs_vals(root_section, "GLOBAL")
594 CALL section_vals_val_get(global_section, "BLACS_GRID", i_val=globenv%blacs_grid_layout)
595 CALL section_vals_val_get(global_section, "BLACS_REPEATABLE", l_val=globenv%blacs_repeatable)
596 CALL section_vals_val_get(global_section, "PREFERRED_DIAG_LIBRARY", i_val=i_diag)
597 CALL section_vals_val_get(global_section, "DIRECT_GENERALIZED_DIAGONALIZATION", &
598 l_val=globenv%direct_generalized_diagonalization)
599 CALL section_vals_val_get(global_section, "PREFERRED_CHOLESKY_LIBRARY", i_val=i_cholesky)
600 CALL section_vals_val_get(global_section, "PREFERRED_DGEMM_LIBRARY", i_val=i_dgemm)
601 CALL section_vals_val_get(global_section, "EPS_CHECK_DIAG", r_val=globenv%eps_check_diag)
602 CALL section_vals_val_get(global_section, "ENABLE_MPI_IO", l_val=flag)
603 CALL cp_mpi_io_set(flag)
604 CALL section_vals_val_get(global_section, "ELPA_KERNEL", i_val=globenv%k_elpa)
605 CALL section_vals_val_get(global_section, "ELPA_COMPLEX_KERNEL", i_val=globenv%k_elpa_c)
606 CALL section_vals_val_get(global_section, "ELPA_NEIGVEC_MIN", i_val=globenv%elpa_neigvec_min)
607 CALL section_vals_val_get(global_section, "ELPA_QR", l_val=globenv%elpa_qr)
608 CALL section_vals_val_get(global_section, "ELPA_ONE_STAGE", l_val=globenv%elpa_one_stage)
609 CALL section_vals_val_get(global_section, "ELPA_PRINT", l_val=globenv%elpa_print)
610 CALL section_vals_val_get(global_section, "DLAF_NEIGVEC_MIN", i_val=globenv%dlaf_neigvec_min)
611 CALL section_vals_val_get(global_section, "DLAF_CHOLESKY_N_MIN", i_val=globenv%dlaf_cholesky_n_min)
612 CALL section_vals_val_get(global_section, "PREFERRED_FFT_LIBRARY", i_val=i_fft)
613 CALL section_vals_val_get(global_section, "PRINT_LEVEL", i_val=print_level)
614 CALL section_vals_val_get(global_section, "PROGRAM_NAME", i_val=globenv%prog_name_id)
615 CALL section_vals_val_get(global_section, "FFT_POOL_SCRATCH_LIMIT", i_val=globenv%fft_pool_scratch_limit)
616 CALL section_vals_val_get(global_section, "FFTW_PLAN_TYPE", i_val=globenv%fftw_plan_type)
617 CALL section_vals_val_get(global_section, "PROJECT_NAME", c_val=project_name)
618 CALL section_vals_val_get(global_section, "FFTW_WISDOM_FILE_NAME", c_val=globenv%fftw_wisdom_file_name, &
619 explicit=globenv%fftw_wisdom_file_explicit)
620 CALL section_vals_val_get(global_section, "RUN_TYPE", i_val=globenv%run_type_id)
621 CALL cp2k_get_walltime(section=global_section, keyword_name="WALLTIME", &
622 walltime=globenv%cp2k_target_time)
623 CALL section_vals_val_get(global_section, "TRACE", l_val=trace)
624 CALL section_vals_val_get(global_section, "TRACE_MASTER", l_val=trace_master)
625 CALL section_vals_val_get(global_section, "TRACE_MAX", i_val=trace_max)
626 CALL section_vals_val_get(global_section, "TRACE_ROUTINES", explicit=explicit)
627 IF (explicit) THEN
628 CALL section_vals_val_get(global_section, "TRACE_ROUTINES", c_vals=trace_routines)
629 ELSE
630 NULLIFY (trace_routines)
631 END IF
632 CALL section_vals_val_get(global_section, "FLUSH_SHOULD_FLUSH", l_val=flush_should_flush)
633 CALL section_vals_val_get(global_section, "ECHO_ALL_HOSTS", l_val=do_echo_all_hosts)
634 report_maxloc = section_get_lval(global_section, "TIMINGS%REPORT_MAXLOC")
635 global_timings_level = section_get_ival(global_section, "TIMINGS%TIMINGS_LEVEL")
636 do_echo_all_hosts = do_echo_all_hosts .OR. report_maxloc
637 force_env_sections => section_vals_get_subs_vals(root_section, "FORCE_EVAL")
638 CALL section_vals_get(force_env_sections, n_repetition=nforce_eval)
639 output_unit = cp_print_key_unit_nr(logger, global_section, "PROGRAM_RUN_INFO", &
640 extension=".log")
641
642 CALL fm_setup(global_section)
643 CALL fm_diag_rules_setup(global_section)
644 CALL dgemm_setup(global_section)
645
646 IF (trace .AND. (.NOT. trace_master .OR. para_env%mepos == 0)) THEN
647 unit_nr = -1
648 IF (logger%para_env%is_source() .OR. .NOT. trace_master) THEN
649 unit_nr = cp_logger_get_default_unit_nr(logger, local=.true.)
650 END IF
651 WRITE (tracing_string, "(I6.6,A1,I6.6)") para_env%mepos, ":", para_env%num_pe
652 IF (ASSOCIATED(trace_routines)) THEN
653 CALL timings_setup_tracing(trace_max, unit_nr, tracing_string, trace_routines)
654 ELSE
655 CALL timings_setup_tracing(trace_max, unit_nr, tracing_string)
656 END IF
657 END IF
658
659 CALL section_vals_val_get(global_section, "TIMINGS%TIME_MPI", l_val=mp_collect_timings)
660
661 SELECT CASE (i_diag)
663 globenv%diag_library = "ScaLAPACK"
664 CASE (fm_diag_type_elpa)
665 globenv%diag_library = "ELPA"
668 globenv%diag_library = "cuSOLVER"
669 CASE (fm_diag_type_dlaf)
670 globenv%diag_library = "DLAF"
672 CASE DEFAULT
673 cpabort("Unknown diagonalization library specified")
674 END SELECT
675
676 SELECT CASE (i_cholesky)
678 globenv%cholesky_library = "ScaLAPACK"
681 globenv%cholesky_library = "DLAF"
683 dlaf_cholesky_n_min = globenv%dlaf_cholesky_n_min
685 CASE DEFAULT
686 cpabort("Unknown Cholesky decomposition library specified")
687 END SELECT
688
689 SELECT CASE (i_fft)
690 CASE (do_fft_sg)
691 globenv%default_fft_library = "FFTSG"
692 CASE (do_fft_fftw3)
693 globenv%default_fft_library = "FFTW3"
695 CASE DEFAULT
696 cpabort("Unknown FFT library specified")
697 END SELECT
698
699 SELECT CASE (i_dgemm)
700 CASE (do_dgemm_spla)
701 globenv%default_dgemm_library = "SPLA"
702 CASE (do_dgemm_blas)
703 globenv%default_dgemm_library = "BLAS"
704 CASE DEFAULT
705 cpabort("Unknown DGEMM library specified")
706 END SELECT
707
708 IF (globenv%run_type_id == 0) THEN
709 SELECT CASE (globenv%prog_name_id)
710 CASE (do_farming, do_test)
711 globenv%run_type_id = none_run
712 CASE (do_cp2k)
713 IF (nforce_eval /= 1) THEN
714 ! multiple force_eval corresponds at the moment to RESPA calculations only
715 ! default MD
716 globenv%run_type_id = mol_dyn_run
717 ELSE
718 CALL section_vals_val_get(force_env_sections, "METHOD", i_val=method_name_id)
719 SELECT CASE (method_name_id)
720 CASE (do_fist)
721 globenv%run_type_id = mol_dyn_run
722 CASE (do_eip)
723 globenv%run_type_id = mol_dyn_run
724 CASE (do_qs)
725 globenv%run_type_id = energy_run
726 CASE (do_sirius)
727 globenv%run_type_id = energy_run
728 END SELECT
729 END IF
730 END SELECT
731 END IF
732
733 IF (globenv%prog_name_id == do_farming .AND. globenv%run_type_id /= none_run) THEN
734 cpabort("FARMING program supports only NONE as run type")
735 END IF
736
737 IF (globenv%prog_name_id == do_test .AND. globenv%run_type_id /= none_run) THEN
738 cpabort("TEST program supports only NONE as run type")
739 END IF
740
741 CALL m_memory_details(memtotal, memfree, buffers, cached, slab, sreclaimable, memlikelyfree)
742 memtotal_avr = memtotal
743 memfree_avr = memfree
744 buffers_avr = buffers
745 cached_avr = cached
746 slab_avr = slab
747 sreclaimable_avr = sreclaimable
748 memlikelyfree_avr = memlikelyfree
749 CALL para_env%sum(memtotal_avr); memtotal_avr = memtotal_avr/para_env%num_pe/1024
750 CALL para_env%sum(memfree_avr); memfree_avr = memfree_avr/para_env%num_pe/1024
751 CALL para_env%sum(buffers_avr); buffers_avr = buffers_avr/para_env%num_pe/1024
752 CALL para_env%sum(cached_avr); cached_avr = cached_avr/para_env%num_pe/1024
753 CALL para_env%sum(slab_avr); slab_avr = slab_avr/para_env%num_pe/1024
754 CALL para_env%sum(sreclaimable_avr); sreclaimable_avr = sreclaimable_avr/para_env%num_pe/1024
755 CALL para_env%sum(memlikelyfree_avr); memlikelyfree_avr = memlikelyfree_avr/para_env%num_pe/1024
756
757 memtotal_min = -memtotal
758 memfree_min = -memfree
759 buffers_min = -buffers
760 cached_min = -cached
761 slab_min = -slab
762 sreclaimable_min = -sreclaimable
763 memlikelyfree_min = -memlikelyfree
764 CALL para_env%max(memtotal_min); memtotal_min = -memtotal_min/1024
765 CALL para_env%max(memfree_min); memfree_min = -memfree_min/1024
766 CALL para_env%max(buffers_min); buffers_min = -buffers_min/1024
767 CALL para_env%max(cached_min); cached_min = -cached_min/1024
768 CALL para_env%max(slab_min); slab_min = -slab_min/1024
769 CALL para_env%max(sreclaimable_min); sreclaimable_min = -sreclaimable_min/1024
770 CALL para_env%max(memlikelyfree_min); memlikelyfree_min = -memlikelyfree_min/1024
771
772 memtotal_max = memtotal
773 memfree_max = memfree
774 buffers_max = buffers
775 cached_max = cached
776 slab_max = slab
777 sreclaimable_max = sreclaimable
778 memlikelyfree_max = memlikelyfree
779 CALL para_env%max(memtotal_max); memtotal_max = memtotal_max/1024
780 CALL para_env%max(memfree_max); memfree_max = memfree_max/1024
781 CALL para_env%max(buffers_max); buffers_max = buffers_max/1024
782 CALL para_env%max(cached_max); cached_max = cached_max/1024
783 CALL para_env%max(slab_max); slab_max = slab_max/1024
784 CALL para_env%max(sreclaimable_max); sreclaimable_max = sreclaimable_max/1024
785 CALL para_env%max(memlikelyfree_max); memlikelyfree_max = memlikelyfree_max/1024
786
787 memtotal = memtotal/1024
788 memfree = memfree/1024
789 buffers = buffers/1024
790 cached = cached/1024
791 slab = slab/1024
792 sreclaimable = sreclaimable/1024
793 memlikelyfree = memlikelyfree/1024
794
795 node_count = 1
796 ! Print a list of all started processes
797 IF (do_echo_all_hosts) THEN
798 CALL echo_all_hosts(para_env, output_unit)
799
800 ! Print the number of processes per host
801 CALL echo_all_process_host(para_env, output_unit, node_count)
802 ELSE ! no echo
803 CALL echo_all_process_host(para_env, 0, node_count)
804 END IF
805
806 num_threads = 1
807!$ num_threads = omp_get_max_threads()
808 IF (output_unit > 0) THEN
809 WRITE (unit=output_unit, fmt=*)
810 CALL multiple_fe_list(force_env_sections, root_section, i_force_eval, nforce_eval)
811 DO iforce_eval = 1, nforce_eval
812 dft_section => section_vals_get_subs_vals3(force_env_sections, "DFT", &
813 i_rep_section=i_force_eval(iforce_eval))
814 qmmm_section => section_vals_get_subs_vals3(force_env_sections, "QMMM", &
815 i_rep_section=i_force_eval(iforce_eval))
816 CALL section_vals_val_get(dft_section, "BASIS_SET_FILE_NAME", &
817 c_val=basis_set_file_name)
818 CALL section_vals_val_get(dft_section, "POTENTIAL_FILE_NAME", &
819 c_val=potential_file_name)
820
821 CALL section_vals_val_get(qmmm_section, "MM_POTENTIAL_FILE_NAME", &
822 c_val=mm_potential_file_name)
823 ! SUBSYS - If any
824 subsys_section => section_vals_get_subs_vals3(force_env_sections, "SUBSYS", &
825 i_rep_section=i_force_eval(iforce_eval))
826 CALL section_vals_get(subsys_section, explicit=explicit)
827 coord_file_name = "__STD_INPUT__"
828 IF (explicit) THEN
829 CALL section_vals_val_get(subsys_section, "TOPOLOGY%COORD_FILE_NAME", &
830 n_rep_val=n_rep_val)
831 IF (n_rep_val == 1) THEN
832 CALL section_vals_val_get(subsys_section, "TOPOLOGY%COORD_FILE_NAME", &
833 c_val=coord_file_name)
834 END IF
835 END IF
836 CALL integer_to_string(i_force_eval(iforce_eval), env_num)
837
838 WRITE (unit=output_unit, fmt="(T2,A,T41,A)") &
839 start_section_label//"| Force Environment number", &
840 adjustr(env_num(:40)), &
841 start_section_label//"| Basis set file name", &
842 adjustr(basis_set_file_name(:40)), &
843 start_section_label//"| Potential file name", &
844 adjustr(potential_file_name(:40)), &
845 start_section_label//"| MM Potential file name", &
846 adjustr(mm_potential_file_name(:40)), &
847 start_section_label//"| Coordinate file name", &
848 adjustr(coord_file_name(:40))
849 END DO
850 DEALLOCATE (i_force_eval)
851
852 NULLIFY (enum1, enum2, keyword, section)
853 CALL create_global_section(section)
854 keyword => section_get_keyword(section, "PROGRAM_NAME")
855 CALL keyword_get(keyword, enum=enum1)
856 keyword => section_get_keyword(section, "RUN_TYPE")
857 CALL keyword_get(keyword, enum=enum2)
858
859 WRITE (unit=output_unit, fmt="(T2,A,T41,A40)") &
860 start_section_label//"| Method name", &
861 adjustr(trim(enum_i2c(enum1, globenv%prog_name_id))), &
862 start_section_label//"| Project name", &
863 adjustr(project_name(:40)), &
864 start_section_label//"| Run type", &
865 adjustr(trim(enum_i2c(enum2, globenv%run_type_id))), &
866 start_section_label//"| FFT library", &
867 adjustr(globenv%default_fft_library(:40)), &
868 start_section_label//"| Diagonalization library", &
869 adjustr(globenv%diag_library(:40)), &
870 start_section_label//"| Cholesky decomposition library", &
871 adjustr(globenv%cholesky_library(:40)), &
872 start_section_label//"| DGEMM library", &
873 adjustr(globenv%default_dgemm_library(:40))
874
875 IF (globenv%diag_library == "ELPA") THEN
876 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
877 start_section_label//"| Minimum number of eigenvectors for ELPA usage", &
878 globenv%elpa_neigvec_min
879 END IF
880
881 IF (globenv%diag_library == "DLAF") THEN
882 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
883 start_section_label//"| Minimum number of eigenvectors for DLAF usage", &
884 globenv%dlaf_neigvec_min
885 END IF
886
887 IF (globenv%diag_library == "cuSOLVER" .OR. globenv%diag_library == "ScaLAPACK" .OR. &
888 globenv%diag_library == "DLAF") THEN
889 WRITE (unit=output_unit, fmt="(T2,A,T71,L10)") &
890 start_section_label//"| Direct generalized diagonalization requested", &
891 globenv%direct_generalized_diagonalization
892 END IF
893
894 IF (globenv%diag_library == "cuSOLVER") THEN
895 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
896 start_section_label//"| Minimum matrix size for cuSOLVER diagonalization", &
898 END IF
899
900 IF (globenv%cholesky_library == "DLAF") THEN
901 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
902 start_section_label//"| Minimum matrix size for Cholesky decomposition with DLAF", &
903 globenv%dlaf_cholesky_n_min
904 END IF
905
906#if defined(__CHECK_DIAG)
907 ! Perform default check if no threshold value has been specified explicitly
908 IF (globenv%eps_check_diag < 0.0_dp) THEN
909 WRITE (unit=output_unit, fmt="(T2,A,T71,ES10.3)") &
910 start_section_label//"| Orthonormality check for eigenvectors enabled", &
912 ELSE
913 WRITE (unit=output_unit, fmt="(T2,A,T71,ES10.3)") &
914 start_section_label//"| Orthonormality check for eigenvectors enabled", &
915 globenv%eps_check_diag
916 END IF
917#else
918 IF (globenv%eps_check_diag < 0.0_dp) THEN
919 WRITE (unit=output_unit, fmt="(T2,A,T73,A)") &
920 start_section_label//"| Orthonormality check for eigenvectors", &
921 "DISABLED"
922 ELSE
923 WRITE (unit=output_unit, fmt="(T2,A,T71,ES10.3)") &
924 start_section_label//"| Orthonormality check for eigenvectors enabled", &
925 globenv%eps_check_diag
926 END IF
927#endif
928 CALL section_release(section)
929
930 SELECT CASE (cp_fm_get_mm_type())
931 CASE (do_scalapack)
932 WRITE (unit=output_unit, fmt="(T2,A,T72,A)") &
933 start_section_label//"| Matrix multiplication library", "ScaLAPACK"
934 CASE (do_cosma)
935 WRITE (unit=output_unit, fmt="(T2,A,T76,A)") &
936 start_section_label//"| Matrix multiplication library", "COSMA"
937 END SELECT
938
939 CALL section_vals_val_get(global_section, "ALLTOALL_SGL", l_val=ata)
940 WRITE (unit=output_unit, fmt="(T2,A,T80,L1)") &
941 start_section_label//"| All-to-all communication in single precision", ata
942
943 SELECT CASE (print_level)
944 CASE (silent_print_level)
945 print_level_string = "SILENT"
946 CASE (low_print_level)
947 print_level_string = " LOW"
948 CASE (medium_print_level)
949 print_level_string = "MEDIUM"
950 CASE (high_print_level)
951 print_level_string = " HIGH"
952 CASE (debug_print_level)
953 print_level_string = " DEBUG"
954 CASE DEFAULT
955 cpabort("Unknown print_level")
956 END SELECT
957
958 CALL section_vals_val_get(global_section, "GRID%BACKEND", i_val=i_grid_backend)
959 SELECT CASE (i_grid_backend)
960 CASE (grid_backend_auto)
961 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
962 start_section_label//"| Grid backend", "AUTO"
963 CASE (grid_backend_cpu)
964 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
965 start_section_label//"| Grid backend", "CPU"
966 CASE (grid_backend_dgemm)
967 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
968 start_section_label//"| Grid backend", "DGEMM"
969 CASE (grid_backend_gpu)
970 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
971 start_section_label//"| Grid backend", "GPU"
972 CASE (grid_backend_ref)
973 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
974 start_section_label//"| Grid backend", "REF"
975 END SELECT
976
977 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
978 start_section_label//"| Global print level", print_level_string
979 WRITE (unit=output_unit, fmt="(T2,A,T75,L6)") &
980 start_section_label//"| MPI I/O enabled", flag
981 WRITE (unit=output_unit, fmt="(T2,A,T75,I6)") &
982 start_section_label//"| Total number of message passing processes", &
983 para_env%num_pe, &
984 start_section_label//"| Number of distributed systems (nodes)", &
985 node_count, &
986 start_section_label//"| Number of threads for this process", &
987 num_threads, &
988 start_section_label//"| This output is from process", para_env%mepos
989
990 CALL m_omp_get_stacksize(omp_stacksize)
991 WRITE (unit=output_unit, fmt="(T2,A,T68,A13)") &
992 start_section_label//"| OpenMP stack size per thread (OMP_STACKSIZE)", &
993 adjustr(omp_stacksize)
994
995 IF (0 <= m_omp_trace_issues()) THEN ! only show in header if enabled
996 WRITE (unit=output_unit, fmt="(T2,A,T68,A13)") &
997 start_section_label//"| OpenMP issue trace (CP2K_OMP_TRACE)", &
998 "enabled"
999 END IF
1000
1001 CALL m_cpuinfo(model_name)
1002 WRITE (unit=output_unit, fmt="(T2,A,T30,A51)") &
1003 start_section_label//"| CPU model name", adjustr(trim(model_name))
1004
1005 cpuid = m_cpuid()
1006 cpuid_static = m_cpuid_static()
1007
1008 IF ((cpuid > 0) .OR. (cpuid_static > 0)) THEN
1009 WRITE (unit=output_unit, fmt="(T2,A,T75,I6)") &
1010 start_section_label//"| CPUID", cpuid
1011 IF (cpuid /= cpuid_static) THEN
1012 WRITE (unit=output_unit, fmt="(T2,A,T75,I6)") &
1013 start_section_label//"| Compiled for CPUID", cpuid_static
1014 END IF
1015 END IF
1016
1017 ! filter cpuids by vlen to show more relevant information
1018 IF (m_cpuid_vlen(cpuid_static) < m_cpuid_vlen(cpuid)) THEN
1019 ! base/machine_cpuid.c relies on the (same) target flags as the Fortran code
1020 CALL cp_hint(__location__, "The compiler target ("// &
1021 trim(m_cpuid_name(cpuid_static))//") used to build this binary does "// &
1022 "not enable all instruction-set extensions available on this CPU ("// &
1023 trim(m_cpuid_name(cpuid))//"). Consider reconfiguring and rebuilding "// &
1024 "CP2K for this target system to enable them.")
1025 END IF
1026
1027 WRITE (unit=output_unit, fmt="(/,T2,A)") &
1028 "MEMORY| system memory details [Kb]"
1029 WRITE (unit=output_unit, fmt="(T2,A23,4A14)") &
1030 "MEMORY| ", "rank 0", "min", "max", "average"
1031 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") &
1032 "MEMORY| MemTotal ", memtotal, memtotal_min, memtotal_max, memtotal_avr
1033 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") &
1034 "MEMORY| MemFree ", memfree, memfree_min, memfree_max, memfree_avr
1035 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") &
1036 "MEMORY| Buffers ", buffers, buffers_min, buffers_max, buffers_avr
1037 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") &
1038 "MEMORY| Cached ", cached, cached_min, cached_max, cached_avr
1039 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") &
1040 "MEMORY| Slab ", slab, slab_min, slab_max, slab_avr
1041 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") &
1042 "MEMORY| SReclaimable ", sreclaimable, sreclaimable_min, sreclaimable_max, &
1043 sreclaimable_avr
1044 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") &
1045 "MEMORY| MemLikelyFree ", memlikelyfree, memlikelyfree_min, memlikelyfree_max, &
1046 memlikelyfree_avr
1047 WRITE (unit=output_unit, fmt='()')
1048
1049 END IF
1050
1051 CALL cp_print_key_finished_output(output_unit, logger, global_section, &
1052 "PROGRAM_RUN_INFO")
1053
1054 END SUBROUTINE read_global_section
1055
1056! **************************************************************************************************
1057!> \brief ...
1058!> \param root_section ...
1059!> \param para_env ...
1060!> \param globenv ...
1061!> \par History
1062!> 2-Dec-2000 (JGH) added default fft library
1063!> \author JGH,MK
1064! **************************************************************************************************
1065 SUBROUTINE read_cp2k_section(root_section, para_env, globenv)
1066
1067 TYPE(section_vals_type), POINTER :: root_section
1068 TYPE(mp_para_env_type), POINTER :: para_env
1069 TYPE(global_environment_type), POINTER :: globenv
1070
1071 INTEGER :: output_unit
1072 TYPE(cp_logger_type), POINTER :: logger
1073 TYPE(section_vals_type), POINTER :: global_section
1074
1075 global_section => section_vals_get_subs_vals(root_section, "GLOBAL")
1076 CALL read_global_section(root_section, para_env, globenv)
1077 logger => cp_get_default_logger()
1078 output_unit = cp_print_key_unit_nr(logger, global_section, "PROGRAM_RUN_INFO", &
1079 extension=".log")
1080
1081 CALL integral_setup_library(global_section)
1082 CALL fft_setup_library(globenv, global_section)
1083 CALL diag_setup_library(globenv, global_section)
1084
1085 ! Run a one-time correctness check of the ELPA complex kernels if they may be used.
1087 CALL check_elpa_c_kernel_correctness(para_env)
1088 END IF
1089
1090 CALL cp_print_key_finished_output(output_unit, logger, global_section, &
1091 "PROGRAM_RUN_INFO")
1092
1093 END SUBROUTINE read_cp2k_section
1094
1095! **************************************************************************************************
1096!> \brief Resolve preferred integral libraries against the compiled-in backends.
1097!> \param global_section ...
1098! **************************************************************************************************
1099 SUBROUTINE integral_setup_library(global_section)
1100 TYPE(section_vals_type), POINTER :: global_section
1101
1102 INTEGER :: coulomb2_library, coulomb3_library
1103 LOGICAL :: fallback_applied
1104
1105 CALL section_vals_val_get(global_section, "PREFERRED_INTEGRAL_LIBRARY%COULOMB_2C", &
1106 i_val=coulomb2_library)
1107 CALL section_vals_val_get(global_section, "PREFERRED_INTEGRAL_LIBRARY%COULOMB_3C", &
1108 i_val=coulomb3_library)
1109 CALL integral_library_init(coulomb2_library, coulomb3_library, fallback_applied)
1110
1111 IF (fallback_applied) THEN
1112 CALL cp_warn(__location__, &
1113 "Integral library Libint is not available. "// &
1114 "The native integral library is used as fallback.")
1115 END IF
1116
1117 END SUBROUTINE integral_setup_library
1118
1119! **************************************************************************************************
1120!> \brief check FFT preferred library availability, if not switch
1121!> \param globenv ...
1122!> \param global_section ...
1123!> \par History
1124!> 2-Dec-2000 (JGH) added default fft library
1125!> Nov-2013 (MI) refactoring
1126!> \author JGH,MK
1127! **************************************************************************************************
1128 SUBROUTINE fft_setup_library(globenv, global_section)
1129
1130 TYPE(global_environment_type), POINTER :: globenv
1131 TYPE(section_vals_type), POINTER :: global_section
1132
1133 CHARACTER(LEN=3*default_string_length) :: message
1134 COMPLEX(KIND=dp), DIMENSION(4, 4, 4) :: zz
1135 INTEGER :: stat
1136 INTEGER, DIMENSION(3) :: n
1137 LOGICAL :: try_fftw
1138
1139 n(:) = 4
1140 zz(:, :, :) = 0.0_dp
1141
1142 ! Setup the FFT library
1143 ! If the user has specified PREFERRED_FFT_LIBRARY try that first (default FFTW3)
1144 ! If that one is not available, try FFTW3 (unless it has been tried already)
1145 ! If FFTW3 is not available use FFTSG
1146
1147 IF (globenv%default_fft_library == "FFTW3") THEN
1148 try_fftw = .false.
1149 ELSE
1150 try_fftw = .true.
1151 END IF
1152
1153 ! Initialize FFT library with the user's preferred FFT library
1154 CALL init_fft(fftlib=trim(globenv%default_fft_library), &
1155 alltoall=section_get_lval(global_section, "ALLTOALL_SGL"), &
1156 pool_limit=globenv%fft_pool_scratch_limit, &
1157 wisdom_file=globenv%fftw_wisdom_file_name, &
1158 plan_style=globenv%fftw_plan_type)
1159
1160 ! Check for FFT library
1161 CALL fft3d(fwfft, n, zz, status=stat)
1162 IF (stat /= 0) THEN
1163 IF (try_fftw) THEN
1164 message = "FFT library "//trim(globenv%default_fft_library)// &
1165 " is not available. Trying FFT library FFTW3."
1166 cpwarn(trim(message))
1167 globenv%default_fft_library = "FFTW3"
1168 CALL init_fft(fftlib=trim(globenv%default_fft_library), &
1169 alltoall=section_get_lval(global_section, "ALLTOALL_SGL"), &
1170 pool_limit=globenv%fft_pool_scratch_limit, &
1171 wisdom_file=globenv%fftw_wisdom_file_name, &
1172 plan_style=globenv%fftw_plan_type)
1173
1174 CALL fft3d(fwfft, n, zz, status=stat)
1175 END IF
1176 IF (stat /= 0) THEN
1177 message = "FFT library "//trim(globenv%default_fft_library)// &
1178 " is not available. Trying FFT library FFTSG."
1179 cpwarn(trim(message))
1180 globenv%default_fft_library = "FFTSG"
1181 CALL init_fft(fftlib=trim(globenv%default_fft_library), &
1182 alltoall=section_get_lval(global_section, "ALLTOALL_SGL"), &
1183 pool_limit=globenv%fft_pool_scratch_limit, &
1184 wisdom_file=globenv%fftw_wisdom_file_name, &
1185 plan_style=globenv%fftw_plan_type)
1186
1187 CALL fft3d(fwfft, n, zz, status=stat)
1188 IF (stat /= 0) THEN
1189 cpabort("FFT library FFTSG does not work. No FFT library available.")
1190 END IF
1191 END IF
1192 END IF
1193
1194 END SUBROUTINE fft_setup_library
1195
1196! **************************************************************************************************
1197!> \brief availability diagonalizatioon library
1198!>
1199!> \param globenv ...
1200!> \param global_section ...
1201!> \author MI
1202! **************************************************************************************************
1203 SUBROUTINE diag_setup_library(globenv, global_section)
1204 TYPE(global_environment_type), POINTER :: globenv
1205 TYPE(section_vals_type), POINTER :: global_section
1206
1207 LOGICAL :: diag_lib_explicit, fallback_applied
1208
1209 CALL section_vals_val_get(global_section, "PREFERRED_DIAG_LIBRARY", explicit=diag_lib_explicit)
1210
1211 CALL diag_init(diag_lib=trim(globenv%diag_library), &
1212 fallback_applied=fallback_applied, &
1213 diag_lib_explicit_input=diag_lib_explicit, &
1214 elpa_kernel=globenv%k_elpa, &
1215 elpa_c_kernel=globenv%k_elpa_c, &
1216 elpa_neigvec_min_input=globenv%elpa_neigvec_min, &
1217 elpa_qr=globenv%elpa_qr, &
1218 elpa_print=globenv%elpa_print, &
1219 elpa_one_stage=globenv%elpa_one_stage, &
1220 dlaf_neigvec_min_input=globenv%dlaf_neigvec_min, &
1221 eps_check_diag_input=globenv%eps_check_diag, &
1222 direct_generalized_diagonalization_input= &
1223 globenv%direct_generalized_diagonalization)
1224
1225 IF (fallback_applied) THEN
1226 CALL cp_warn(__location__, &
1227 "Diagonalization library "//trim(globenv%diag_library)//" is "// &
1228 "not available. The ScaLAPACK library is used as fallback.")
1229 END IF
1230
1231 END SUBROUTINE diag_setup_library
1232
1233! **************************************************************************************************
1234!> \brief ...
1235!> \param glob_section ...
1236! **************************************************************************************************
1237 SUBROUTINE fm_setup(glob_section)
1238 TYPE(section_vals_type), POINTER :: glob_section
1239
1240 INTEGER :: mm_type, ncb, nrb
1241 LOGICAL :: force_me
1242 TYPE(section_vals_type), POINTER :: fm_section
1243
1244 fm_section => section_vals_get_subs_vals(glob_section, "FM")
1245
1246 CALL section_vals_val_get(fm_section, "NROW_BLOCKS", i_val=nrb)
1247 CALL section_vals_val_get(fm_section, "NCOL_BLOCKS", i_val=ncb)
1248 CALL section_vals_val_get(fm_section, "FORCE_BLOCK_SIZE", l_val=force_me)
1249 CALL cp_fm_struct_config(nrow_block=nrb, ncol_block=ncb, force_block=force_me)
1250
1251 CALL section_vals_val_get(fm_section, "TYPE_OF_MATRIX_MULTIPLICATION", i_val=mm_type)
1252 CALL cp_fm_setup(mm_type)
1253
1254 END SUBROUTINE fm_setup
1255
1256! **************************************************************************************************
1257!> \brief ...
1258!> \param glob_section ...
1259! **************************************************************************************************
1260 SUBROUTINE dgemm_setup(glob_section)
1261 TYPE(section_vals_type), POINTER :: glob_section
1262
1263 INTEGER :: dgemm_type
1264
1265 CALL section_vals_val_get(glob_section, "PREFERRED_DGEMM_LIBRARY", i_val=dgemm_type)
1266
1267 CALL local_gemm_set_library(dgemm_type)
1268
1269 END SUBROUTINE dgemm_setup
1270
1271! **************************************************************************************************
1272!> \brief Parses the input section used to define the heuristic rules which determine if
1273!> a FM matrix should be redistributed before diagonalizing it.
1274!> \param glob_section the global input section
1275!> \author Nico Holmberg [01.2018]
1276! **************************************************************************************************
1277 SUBROUTINE fm_diag_rules_setup(glob_section)
1278 TYPE(section_vals_type), POINTER :: glob_section
1279
1280 INTEGER :: a, x
1281 LOGICAL :: elpa_force_redistribute, should_print
1282 TYPE(section_vals_type), POINTER :: section
1283
1284 section => section_vals_get_subs_vals(glob_section, "FM_DIAG_SETTINGS")
1285
1286 CALL section_vals_val_get(section, "PARAMETER_A", i_val=a)
1287 CALL section_vals_val_get(section, "PARAMETER_X", i_val=x)
1288 CALL section_vals_val_get(section, "PRINT_FM_REDISTRIBUTE", l_val=should_print)
1289 CALL section_vals_val_get(section, "ELPA_FORCE_REDISTRIBUTE", l_val=elpa_force_redistribute)
1290
1291 CALL cp_fm_redistribute_init(a, x, should_print, elpa_force_redistribute)
1292
1293 END SUBROUTINE fm_diag_rules_setup
1294! **************************************************************************************************
1295!> \brief reads the Walltime also in format HH:MM:SS
1296!> \param section ...
1297!> \param keyword_name ...
1298!> \param walltime ...
1299!> \par History
1300!> none
1301!> \author Mandes
1302! **************************************************************************************************
1303 SUBROUTINE cp2k_get_walltime(section, keyword_name, walltime)
1304 TYPE(section_vals_type), POINTER :: section
1305 CHARACTER(LEN=*), INTENT(in) :: keyword_name
1306 REAL(kind=dp), INTENT(out) :: walltime
1307
1308 CHARACTER(LEN=1) :: c1, c2
1309 CHARACTER(LEN=100) :: txt
1310 INTEGER :: hours, ierr, minutes, n, seconds
1311
1312 CALL section_vals_val_get(section, keyword_name, c_val=txt)
1313 n = len_trim(txt)
1314
1315 IF (n == 0) THEN
1316 walltime = -1.0_dp
1317 ELSE IF (index(txt, ":") == 0) THEN
1318 READ (txt(1:n), fmt=*, iostat=ierr) walltime
1319 IF (ierr /= 0) cpabort('Could not parse WALLTIME: "'//txt(1:n)//'"')
1320 ELSE
1321 READ (txt(1:n), fmt="(I2,A1,I2,A1,I2)", iostat=ierr) hours, c1, minutes, c2, seconds
1322 IF (n /= 8 .OR. ierr /= 0 .OR. c1 /= ":" .OR. c2 /= ":") THEN
1323 cpabort('Could not parse WALLTIME: "'//txt(1:n)//'"')
1324 END IF
1325 walltime = 3600.0_dp*real(hours, dp) + 60.0_dp*real(minutes, dp) + real(seconds, dp)
1326 END IF
1327 END SUBROUTINE cp2k_get_walltime
1328
1329! **************************************************************************************************
1330!> \brief Writes final timings and banner for CP2K
1331!> \param root_section ...
1332!> \param para_env ...
1333!> \param globenv ...
1334!> \param wdir ...
1335!> \param q_finalize ...
1336!> \par History
1337!> none
1338!> \author JGH,MK
1339!> \note
1340!> The following routines need to be synchronized wrt. adding/removing
1341!> of the default environments (logging, performance,error):
1342!> environment:cp2k_init, environment:cp2k_finalize,
1343!> f77_interface:f_env_add_defaults, f77_interface:f_env_rm_defaults,
1344!> f77_interface:create_force_env, f77_interface:destroy_force_env
1345! **************************************************************************************************
1346 SUBROUTINE cp2k_finalize(root_section, para_env, globenv, wdir, q_finalize)
1347
1348 TYPE(section_vals_type), POINTER :: root_section
1349 TYPE(mp_para_env_type), POINTER :: para_env
1350 TYPE(global_environment_type), POINTER :: globenv
1351 CHARACTER(LEN=*), OPTIONAL :: wdir
1352 LOGICAL, INTENT(IN), OPTIONAL :: q_finalize
1353
1354 CHARACTER(LEN=default_path_length) :: cg_filename
1355 INTEGER :: cg_mode, iw, unit_exit
1356 LOGICAL :: delete_it, do_finalize, report_maxloc, &
1357 sort_by_self_time
1358 REAL(kind=dp) :: r_timings
1359 TYPE(cp_logger_type), POINTER :: logger
1360
1361 ! Look if we inherited a failure, more care is needed if so
1362 ! i.e. the input is most likely not available
1363 ! Set flag if this is a development version
1364
1365 do_finalize = .true.
1366 IF (PRESENT(q_finalize)) do_finalize = q_finalize
1367 ! Clean up
1368 NULLIFY (logger)
1369 logger => cp_get_default_logger()
1370 IF (do_finalize) THEN
1374 CALL diag_finalize()
1375 ! the LibXC functional objects are kept alive across calculations
1377 ! finalize the fft (i.e. writes the wisdom if FFTW3 and a wisdom file was specified)
1378 CALL finalize_fft(para_env, globenv%fftw_wisdom_file_name, &
1379 export_wisdom=globenv%fftw_wisdom_file_explicit)
1380 CALL finalize_libvori()
1381 END IF
1382
1383 ! Write message passing performance info
1384
1385 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PROGRAM_RUN_INFO", &
1386 extension=".log")
1387 CALL describe_mp_perf_env(iw)
1388 CALL cp_print_key_finished_output(iw, logger, root_section, &
1389 "GLOBAL%PROGRAM_RUN_INFO")
1390
1391 CALL collect_citations_from_ranks(para_env)
1392 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%REFERENCES", &
1393 extension=".Log")
1394 IF (iw > 0) THEN
1395 WRITE (unit=iw, fmt="(/,T2,A)") repeat("-", 79)
1396 WRITE (unit=iw, fmt="(T2,A,T80,A)") "-", "-"
1397 WRITE (unit=iw, fmt="(T2,A,T30,A,T80,A)") "-", "R E F E R E N C E S", "-"
1398 WRITE (unit=iw, fmt="(T2,A,T80,A)") "-", "-"
1399 WRITE (unit=iw, fmt="(T2,A)") repeat("-", 79)
1400 WRITE (unit=iw, fmt="(T2,A)") ""
1401 WRITE (unit=iw, fmt="(T2,A)") trim(cp2k_version)//", the CP2K developers group ("//trim(cp2k_year)//")."
1402 WRITE (unit=iw, fmt="(T2,A)") "CP2K is freely available from "//trim(cp2k_home)//" ."
1403 WRITE (unit=iw, fmt="(T2,A)") ""
1404 CALL print_cited_references(unit=iw)
1405 END IF
1406 CALL cp_print_key_finished_output(iw, logger, root_section, &
1407 "GLOBAL%REFERENCES")
1408
1409 CALL timestop(globenv%handle) ! corresponding the "CP2K" in cp2k_init
1410
1411 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%TIMINGS", &
1412 extension=".Log")
1413 r_timings = section_get_rval(root_section, "GLOBAL%TIMINGS%THRESHOLD")
1414 sort_by_self_time = section_get_lval(root_section, "GLOBAL%TIMINGS%SORT_BY_SELF_TIME")
1415 report_maxloc = section_get_lval(root_section, "GLOBAL%TIMINGS%REPORT_MAXLOC")
1416 IF (m_energy() /= 0.0_dp) THEN
1417 CALL timings_report_print(iw, r_timings, sort_by_self_time, cost_type_energy, report_maxloc, para_env)
1418 END IF
1419 CALL timings_report_print(iw, r_timings, sort_by_self_time, cost_type_time, report_maxloc, para_env)
1420
1421 ! Write the callgraph, if desired by user
1422 CALL section_vals_val_get(root_section, "GLOBAL%CALLGRAPH", i_val=cg_mode)
1423 IF (cg_mode /= callgraph_none) THEN
1424 CALL section_vals_val_get(root_section, "GLOBAL%CALLGRAPH_FILE_NAME", c_val=cg_filename)
1425 IF (len_trim(cg_filename) == 0) cg_filename = trim(logger%iter_info%project_name)
1426 IF (cg_mode == callgraph_all) THEN
1427 !incorporate mpi-rank into filename
1428 cg_filename = trim(cg_filename)//"_"//trim(adjustl(cp_to_string(para_env%mepos)))
1429 END IF
1430 IF (iw > 0) THEN
1431 WRITE (unit=iw, fmt="(T2,3X,A)") &
1432 "Writing callgraph to: "//trim(cg_filename)//".callgraph"
1433 WRITE (unit=iw, fmt="(/,T2,A)") &
1434 "-------------------------------------------------------------------------------"
1435 END IF
1436 IF (cg_mode == callgraph_all .OR. para_env%is_source()) THEN
1437 CALL timings_report_callgraph(trim(cg_filename)//".callgraph")
1438 END IF
1439 END IF
1440
1441 CALL cp_print_key_finished_output(iw, logger, root_section, &
1442 "GLOBAL%TIMINGS")
1443
1444 CALL rm_mp_perf_env()
1445 CALL rm_timer_env()
1446
1447 IF (para_env%is_source()) THEN
1448 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PROGRAM_RUN_INFO", &
1449 extension=".log")
1450
1451 ! Deleting (if existing) the external EXIT files
1452 delete_it = .false.
1453 INQUIRE (file="EXIT", exist=delete_it)
1454 IF (delete_it) THEN
1455 CALL open_file(file_name="EXIT", unit_number=unit_exit)
1456 CALL close_file(unit_number=unit_exit, file_status="DELETE")
1457 END IF
1458
1459 delete_it = .false.
1460 INQUIRE (file=trim(logger%iter_info%project_name)//".EXIT", exist=delete_it)
1461 IF (delete_it) THEN
1462 CALL open_file(file_name=trim(logger%iter_info%project_name)//".EXIT", unit_number=unit_exit)
1463 CALL close_file(unit_number=unit_exit, file_status="DELETE")
1464 END IF
1465
1466 ! Print OpenMP issue counter and number of warnings for this workload
1467 IF (iw > 0) THEN
1468 IF (0 <= m_omp_trace_issues()) THEN
1469 WRITE (iw, "(T2,A,I0)") "The number of traced issues for OpenMP : ", m_omp_trace_issues()
1470 END IF
1471 WRITE (iw, "(T2,A,I0)") "The number of warnings for this run is : ", warning_counter
1472 WRITE (iw, *) ""
1473 WRITE (unit=iw, fmt="(T2,A)") repeat("-", 79)
1474 END IF
1475
1476 ! Update the runtime environment variables
1477 CALL get_runtime_info()
1478
1479 ! Just a choice, do not print the CP2K footer if there is a failure
1480 CALL cp2k_footer(iw, wdir)
1481 IF (iw > 0) FLUSH (iw) ! ignore &GLOBAL / FLUSH_SHOULD_FLUSH
1482
1483 CALL cp_print_key_finished_output(iw, logger, root_section, &
1484 "GLOBAL%PROGRAM_RUN_INFO")
1485 END IF
1486
1487 ! Release message passing environment
1489
1490 END SUBROUTINE cp2k_finalize
1491
1492END MODULE environment
Target architecture or instruction set extension according to compiler target flags.
Definition machine.F:93
Trace OpenMP constructs if ennvironment variable CP2K_OMP_TRACE=1.
Definition machine.F:104
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public marek2014
integer, save, public solca2024
integer, save, public frigo2005
some minimal info about CP2K, including its version and license
Definition cp2k_info.F:22
character(len=default_string_length), save, public compile_date
Definition cp2k_info.F:65
character(len=default_string_length), public r_host_name
Definition cp2k_info.F:76
character(len= *), parameter, public cp2k_home
Definition cp2k_info.F:52
character(len= *), parameter, public compile_host
Definition cp2k_info.F:71
character(len= *), parameter, public compile_arch
Definition cp2k_info.F:59
integer, public r_pid
Definition cp2k_info.F:78
character(len= *), parameter, public compile_with
Definition cp2k_info.F:55
character(len= *), parameter, public compile_revision
Definition cp2k_info.F:46
character(len= *), parameter, public cp2k_year
Definition cp2k_info.F:51
character(len=10 *default_string_length) function, public cp2k_flags()
list all compile time options that influence the capabilities of cp2k. All new flags should be added ...
Definition cp2k_info.F:89
character(len= *), parameter, public cp2k_version
Definition cp2k_info.F:50
subroutine, public get_runtime_info()
...
Definition cp2k_info.F:400
character(len=default_string_length), public r_user_name
Definition cp2k_info.F:76
Wrapper for ELPA (complex matrices, i.e. cp_cfm_type).
Definition cp_cfm_elpa.F:11
subroutine, public check_elpa_c_kernel_correctness(para_env)
One-time runtime correctness check for ELPA complex BLOCK2 kernels. A small deterministic eigenproble...
Module that contains the routines for error handling.
integer, save, public warning_counter
Utility routines to open and close files.
Definition cp_files.F:22
character(len=default_path_length) function, public get_compile_dir()
Returns the build directory.
Definition cp_files.F:606
subroutine, public open_file(file_name, unit_number, file_status, file_form, file_action, file_position, file_pad, file_access, debug)
Opens a file and returns its logical unit number.
Definition cp_files.F:197
subroutine, public close_file(unit_number, file_status)
Closes an open file given by its logical unit number.
Definition cp_files.F:64
character(len=default_path_length) function, public get_data_dir()
Returns path of data directory if set, otherwise an empty string.
Definition cp_files.F:575
various cholesky decomposition related routines
integer, parameter, public fm_cholesky_type_dlaf
integer, parameter, public fm_cholesky_type_scalapack
integer, save, public dlaf_cholesky_n_min
integer, save, public cholesky_type
Auxiliary tools to redistribute cp_fm_type and cp_cfm_type matrices before and after diagonalization....
subroutine, public cp_fm_redistribute_init(a, x, should_print, elpa_force_redistribute)
Initializes the parameters that determine how to calculate the optimal number of CPUs for diagonalizi...
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
Definition cp_fm_diag.F:17
real(kind=dp), parameter, public eps_check_diag_default
Definition cp_fm_diag.F:85
integer, parameter, public fm_diag_type_cusolver
Definition cp_fm_diag.F:112
integer, parameter, public fm_diag_type_dlaf
Definition cp_fm_diag.F:112
integer, parameter, public fm_diag_type_scalapack
Definition cp_fm_diag.F:112
subroutine, public diag_finalize()
Finalize the diagonalization library.
Definition cp_fm_diag.F:238
subroutine, public diag_init(diag_lib, fallback_applied, elpa_kernel, elpa_c_kernel, elpa_neigvec_min_input, elpa_qr, elpa_print, elpa_one_stage, dlaf_neigvec_min_input, eps_check_diag_input, direct_generalized_diagonalization_input, diag_lib_explicit_input)
Setup the diagonalization library to be used.
Definition cp_fm_diag.F:164
integer, save, public diag_type
Definition cp_fm_diag.F:93
integer, parameter, public fm_diag_type_elpa
Definition cp_fm_diag.F:112
integer, parameter, public cusolver_n_min
Definition cp_fm_diag.F:102
logical, save, public diag_lib_explicit
Definition cp_fm_diag.F:96
represent the structure of a full matrix
subroutine, public cp_fm_struct_config(nrow_block, ncol_block, force_block)
allows to modify the default settings for matrix creation
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
integer function, public cp_fm_get_mm_type()
...
subroutine, public cp_fm_setup(mm_type)
...
Collection of routines to handle the iteration info.
integer, parameter, public iter_silent
integer, parameter, public iter_stack
integer, parameter, public iter_notice
various routines to log and control the output. The idea is that decisions about where to log should ...
recursive integer function, public cp_logger_get_default_unit_nr(logger, local, skip_not_ionode)
asks the default unit number of the given logger. try to use cp_logger_get_unit_nr
subroutine, public cp_logger_set(logger, local_filename, global_filename)
sets various attributes of the given logger
subroutine, public cp_rm_default_logger()
the cousin of cp_add_default_logger, decrements the stack, so that the default logger is what it has ...
subroutine, public cp_logger_release(logger)
releases this logger
subroutine, public cp_logger_create(logger, para_env, print_level, default_global_unit_nr, default_local_unit_nr, global_filename, local_filename, close_global_unit_on_dealloc, iter_info, close_local_unit_on_dealloc, suffix, template_logger)
initializes a logger
subroutine, public cp_add_default_logger(logger)
adds a default logger. MUST be called before logging occours
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
subroutine, public cp_mpi_io_set(flag)
Sets flag which determines whether or not to use MPI I/O for I/O routines that have been parallized w...
integer, parameter, public debug_print_level
integer, parameter, public low_print_level
integer, parameter, public medium_print_level
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer, parameter, public high_print_level
integer, parameter, public silent_print_level
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout, file_access)
...
Sets up and terminates the global environment variables.
Definition environment.F:17
subroutine, public cp2k_finalize(root_section, para_env, globenv, wdir, q_finalize)
Writes final timings and banner for CP2K.
subroutine, public cp2k_read(root_section, para_env, globenv)
read part of cp2k_init
subroutine, public cp2k_get_walltime(section, keyword_name, walltime)
reads the Walltime also in format HH:MM:SS
subroutine, public cp2k_init(para_env, output_unit, globenv, input_file_name, wdir)
Initializes a CP2K run (setting of the global environment variables).
subroutine, public cp2k_setup(root_section, para_env, globenv)
globenv initializations that need the input and error
subroutine, public finalize_fft(para_env, wisdom_file, export_wisdom)
does whatever is needed to finalize the current fft setup
Definition fft_tools.F:209
subroutine, public init_fft(fftlib, alltoall, pool_limit, wisdom_file, plan_style)
...
Definition fft_tools.F:181
integer, parameter, public fwfft
Definition fft_tools.F:146
Interface for the force calculations.
subroutine, public multiple_fe_list(force_env_sections, root_section, i_force_eval, nforce_eval)
returns the order of the multiple force_env
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
Definition gamma.F:15
subroutine, public deallocate_md_ftable()
Deallocate the table of F_n(t) values.
Definition gamma.F:121
Define type storing the global information of a run. Keep the amount of stored data small....
Fortran API for the grid package, which is written in C.
Definition grid_api.F:12
integer, parameter, public grid_backend_auto
Definition grid_api.F:64
integer, parameter, public grid_backend_gpu
Definition grid_api.F:68
integer, parameter, public grid_backend_dgemm
Definition grid_api.F:67
integer, parameter, public grid_backend_cpu
Definition grid_api.F:66
integer, parameter, public grid_backend_ref
Definition grid_api.F:65
subroutine, public cp2k_header(iw, wdir)
...
Definition header.F:40
subroutine, public cp2k_footer(iw, wdir)
...
Definition header.F:69
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public energy_run
integer, parameter, public do_fft_sg
integer, parameter, public callgraph_all
integer, parameter, public do_farming
integer, parameter, public do_cosma
integer, parameter, public do_cp2k
integer, parameter, public do_scalapack
integer, parameter, public do_eip
integer, parameter, public do_test
integer, parameter, public do_fist
integer, parameter, public do_sirius
integer, parameter, public do_dgemm_blas
integer, parameter, public callgraph_none
integer, parameter, public mol_dyn_run
integer, parameter, public do_fft_fftw3
integer, parameter, public none_run
integer, parameter, public do_qs
integer, parameter, public do_dgemm_spla
builds the global input section for cp2k
subroutine, public create_global_section(section)
section to hold global settings for the whole program
represents an enumeration, i.e. a mapping between integers and strings
character(len=default_string_length) function, public enum_i2c(enum, i)
maps an integer to a string
represents keywords in an input
subroutine, public keyword_get(keyword, names, usage, description, type_of_var, n_var, default_value, lone_keyword_value, repeats, enum, citations)
...
objects that represent the structure of input sections and the data contained in an input section
real(kind=dp) function, public section_get_rval(section_vals, keyword_name)
...
subroutine, public section_vals_val_set(section_vals, keyword_name, i_rep_section, i_rep_val, val, l_val, i_val, r_val, c_val, l_vals_ptr, i_vals_ptr, r_vals_ptr, c_vals_ptr)
sets the requested value
integer function, public section_get_ival(section_vals, keyword_name)
...
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
recursive subroutine, public section_release(section)
releases the given keyword list (see doc/ReferenceCounting.html)
recursive type(keyword_type) function, pointer, public section_get_keyword(section, keyword_name)
returns the requested keyword
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
type(section_vals_type) function, pointer, public section_vals_get_subs_vals3(section_vals, subsection_name, i_rep_section)
returns the values of the n-th non default subsection (null if no such section exists (not so many no...
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
logical function, public section_get_lval(section_vals, keyword_name)
...
Library choices for electronic integral APIs.
subroutine, public integral_library_init(coulomb2_library, coulomb3_library, fallback_applied)
Resolves requested Coulomb integral libraries against the compiled-in backends.
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public int_8
Definition kinds.F:54
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
integer, parameter, public default_path_length
Definition kinds.F:58
subroutine, public print_kind_info(iw)
Print informations about the used data types.
Definition kinds.F:72
subroutine, public local_gemm_set_library(dgemm_library)
Select the backend for subsequent local GEMM calls and context creation.
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
logical, save, public flush_should_flush
Definition machine.F:112
integer function, public m_procrun(pid)
Returns if a process is running on the local machine 1 if yes and 0 if not.
Definition machine.F:414
subroutine, public m_memory_details(memtotal, memfree, buffers, cached, slab, sreclaimable, memlikelyfree)
get more detailed memory info, all units are bytes. the only 'useful' option is MemLikelyFree which i...
Definition machine.F:513
pure integer function, public m_cpuid()
Target architecture or instruction set extension according to CPU-check at runtime.
Definition machine.F:191
pure integer function, public m_cpuid_vlen(cpuid, typesize)
Determine vector-length for a given CPUID.
Definition machine.F:280
real(kind=dp) function, public m_energy()
returns the energy used since some time in the past. The precise meaning depends on the infrastructur...
Definition machine.F:332
subroutine, public m_cpuinfo(model_name)
reads /proc/cpuinfo if it exists (i.e. Linux) to return relevant info
Definition machine.F:158
pure character(len=default_string_length) function, public m_cpuid_name(cpuid)
Determine name of target architecture for a given CPUID.
Definition machine.F:236
subroutine, public m_getexe(exe_path)
Returns the path of the running executable.
Definition machine.F:640
subroutine, public m_omp_get_stacksize(omp_stacksize)
Retrieve environment variable OMP_STACKSIZE.
Definition machine.F:795
Interface to the message passing library MPI.
logical, save, public mp_collect_timings
Defines all routines to deal with the performance of MPI routines.
Definition mp_perf_env.F:11
subroutine, public rm_mp_perf_env()
...
subroutine, public describe_mp_perf_env(scr)
...
subroutine, public add_mp_perf_env(perf_env)
start and stop the performance indicators for every call to start there has to be (exactly) one call ...
Definition mp_perf_env.F:78
Provides Cartesian and spherical orbital pointers and indices.
subroutine, public init_orbital_pointers(maxl)
Initialize or update the orbital pointers.
subroutine, public deallocate_orbital_pointers()
Deallocate the orbital pointers.
Calculation of the spherical harmonics and the corresponding orbital transformation matrices.
subroutine, public init_spherical_harmonics(maxl, output_unit)
Initialize or update the orbital transformation matrices.
subroutine, public deallocate_spherical_harmonics()
Deallocate the orbital transformation matrices.
Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers.
subroutine, public check_rng(output_unit, ionode)
...
subroutine, public write_rng_matrices(output_unit)
Write the transformation matrices of the two MRG components (raised to the specified output).
integer, parameter, public gaussian
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public seconds
Definition physcon.F:150
subroutine, public write_physcon(output_unit)
Write all basic physical constants used by CP2K to a logical output unit.
Definition physcon.F:217
provides a uniform framework to add references to CP2K cite and output these
subroutine, public collect_citations_from_ranks(para_env)
Checks for each reference if any mpi-rank has marked it for citation.
subroutine, public cite_reference(key)
marks a given reference as cited.
subroutine, public print_cited_references(unit)
printout of all cited references in the journal format sorted by publication year
Utilities for string manipulations.
subroutine, public integer_to_string(inumber, string)
Converts an integer number to a string. The WRITE statement will return an error message,...
subroutine, public string_to_ascii(string, nascii)
Convert a string to sequence of integer numbers.
subroutine, public ascii_to_string(nascii, string)
Convert a sequence of integer numbers (ASCII code) to a string. Blanks are inserted for invalid ASCII...
Timing routines for accounting.
integer, parameter, public cost_type_energy
subroutine, public timings_report_callgraph(filename)
Write accumulated callgraph information as cachegrind-file. http://kcachegrind.sourceforge....
integer, parameter, public cost_type_time
subroutine, public timings_report_print(iw, r_timings, sort_by_self_time, cost_type, report_maxloc, para_env)
Print accumulated information on timers.
Timing routines for accounting.
Definition timings.F:17
integer, save, public global_timings_level
Definition timings.F:68
subroutine, public timings_setup_tracing(trace_max, unit_nr, trace_str, routine_names)
Set routine tracer.
Definition timings.F:403
subroutine, public add_timer_env(timer_env)
adds the given timer_env to the top of the stack
Definition timings.F:93
subroutine, public rm_timer_env()
removes the current timer env from the stack
Definition timings.F:135
character(len=default_string_length), parameter, public root_cp2k_name
Definition timings.F:70
Interface for Voronoi Integration and output of BQB files.
subroutine, public finalize_libvori()
Call libvori's finalize if support is compiled in.
calculates a functional from libxc and its derivatives
Definition xc_libxc.F:29
subroutine, public libxc_release_workers()
Reads the external parameters of a LibXC functional from its input section.
Definition xc_libxc.F:851
type of a logger, at the moment it contains just a print level starting at which level it should be l...
contains the initially parsed file and the initial parallel environment
represent a keyword in the input
represent a section of the input file
stores all the informations relevant to an mpi environment