(git:495eafe)
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: &
26 USE cp_files, ONLY: close_file,&
39 diag_init,&
45 USE cp_log_handling, ONLY: &
57 USE fft_tools, ONLY: fwfft,&
58 fft3d,&
64 USE grid_api, ONLY: grid_backend_auto,&
70 USE header, ONLY: cp2k_footer,&
72 USE input_constants, ONLY: &
81 USE input_section_types, ONLY: &
85 USE kinds, ONLY: default_path_length,&
87 dp,&
88 int_8,&
91 USE machine, ONLY: &
96 USE mp_perf_env, ONLY: add_mp_perf_env,&
103 USE parallel_rng_types, ONLY: gaussian,&
104 check_rng,&
107 USE physcon, ONLY: write_physcon
113 USE timings, ONLY: add_timer_env,&
123
124!$ USE OMP_LIB, ONLY: omp_get_max_threads, omp_get_thread_num, omp_get_num_threads
125#include "./base/base_uses.f90"
126
127 IMPLICIT NONE
128
129 PRIVATE
130
131 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'environment'
132
133 ! Public subroutines
134
136
137CONTAINS
138
139! **************************************************************************************************
140!> \brief Initializes a CP2K run (setting of the global environment variables)
141!> \param para_env ...
142!> \param output_unit ...
143!> \param globenv ...
144!> \param input_file_name ...
145!> \param wdir ...
146!> \par History
147!> JGH (28.11.2001) : default for pp_library_path
148!> - print keys added (17.01.2002, MK)
149!> - merged with cp2k_input (30.10.2002,MK)
150!> \author JGH,MK
151! **************************************************************************************************
152 SUBROUTINE cp2k_init(para_env, output_unit, globenv, input_file_name, wdir)
153
154 TYPE(mp_para_env_type), POINTER :: para_env
155 INTEGER :: output_unit
156 TYPE(global_environment_type), POINTER :: globenv
157 CHARACTER(LEN=*) :: input_file_name
158 CHARACTER(LEN=*), OPTIONAL :: wdir
159
160 CHARACTER(LEN=10*default_string_length) :: cp_flags
161 INTEGER :: i, ilen, my_output_unit
162 TYPE(cp_logger_type), POINTER :: logger
163
164 ! create a timer_env
165
166 CALL add_timer_env()
167
168 ! Message passing performance
169 CALL add_mp_perf_env()
170
171 ! Init the default logger
172 IF (para_env%is_source()) THEN
173 my_output_unit = output_unit
174 ELSE
175 my_output_unit = -1
176 END IF
177 NULLIFY (logger)
178 CALL cp_logger_create(logger, para_env=para_env, &
179 default_global_unit_nr=output_unit, &
180 close_global_unit_on_dealloc=.false.)
181 CALL cp_add_default_logger(logger)
182 CALL cp_logger_release(logger)
183
184 ! Initialize timing
185 CALL timeset(root_cp2k_name, globenv%handle)
186
187 ! Print header
188 CALL cp2k_header(my_output_unit, wdir)
189
190 IF (my_output_unit > 0) THEN
191 WRITE (unit=my_output_unit, fmt="(/,T2,A,T31,A50)") &
192 "CP2K| version string: ", adjustr(trim(cp2k_version))
193 WRITE (unit=my_output_unit, fmt="(T2,A,T41,A40)") &
194 "CP2K| source code revision number:", &
195 adjustr(compile_revision)
196 cp_flags = cp2k_flags()
197 ilen = len_trim(cp_flags)
198 WRITE (unit=my_output_unit, fmt="(T2,A)") &
199 "CP2K| "//cp_flags(1:73)
200 IF (ilen > 73) THEN
201 DO i = 0, (ilen - 75)/61
202 WRITE (unit=my_output_unit, fmt="(T2,A)") &
203 "CP2K| "//trim(cp_flags(74 + i*61:min(74 + (i + 1)*61, ilen)))
204 END DO
205 END IF
206 WRITE (unit=my_output_unit, fmt="(T2,A,T41,A40)") &
207 "CP2K| is freely available from ", &
208 adjustr(trim(cp2k_home))
209 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
210 "CP2K| Program compiled at", &
211 adjustr(compile_date(1:min(50, len(compile_date))))
212 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
213 "CP2K| Program compiled on", &
214 adjustr(compile_host(1:min(50, len(compile_host))))
215 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
216 "CP2K| Program compiled for", &
217 adjustr(compile_arch(1:min(50, len(compile_arch))))
218 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
219 "CP2K| Data directory path", &
220 adjustr(trim(get_data_dir()))
221 WRITE (unit=my_output_unit, fmt="(T2,A,T31,A50)") &
222 "CP2K| Input file name", &
223 adjustr(trim(input_file_name))
224 FLUSH (my_output_unit) ! ignore &GLOBAL / FLUSH_SHOULD_FLUSH
225 END IF
226
227#if defined(__FAST_MATH__)
228 CALL cp_warn(__location__, &
229 "During compilation one of the following flags was active:"// &
230 " `-ffast-math` (GCC)"// &
231 " `-hfpN` (Cray, N > 0, default N=2)"// &
232 " This can lead to wrong results and numerical instabilities"// &
233 " and is therefore no longer supported.")
234
235#if !defined(__FORCE_USE_FAST_MATH)
236#error "-ffast-math (GCC) or -hfpN (N>0, Cray) can lead to wrong results and numerical instabilities and are therefore no longer supported"
237#endif
238#endif
239
240#if defined(NDEBUG)
241#error "Please do not build CP2K with NDEBUG. There is no performance advantage and asserts will save your neck."
242#endif
243
244 END SUBROUTINE cp2k_init
245
246! **************************************************************************************************
247!> \brief echoes the list of host names and pids
248!> \param para_env ...
249!> \param output_unit ...
250! **************************************************************************************************
251 SUBROUTINE echo_all_hosts(para_env, output_unit)
252 TYPE(mp_para_env_type), POINTER :: para_env
253 INTEGER, INTENT(IN) :: output_unit
254
255 CHARACTER(LEN=default_string_length) :: string
256 INTEGER :: ipe
257 INTEGER, ALLOCATABLE, DIMENSION(:) :: all_pid
258 INTEGER, ALLOCATABLE, DIMENSION(:, :) :: all_host
259
260 ! Print a list of all started processes
261
262 ALLOCATE (all_pid(para_env%num_pe), source=0)
263 all_pid(para_env%mepos + 1) = r_pid
264
265 CALL para_env%sum(all_pid)
266 ALLOCATE (all_host(30, para_env%num_pe), source=0)
267
268 CALL string_to_ascii(r_host_name, all_host(:, para_env%mepos + 1))
269 CALL para_env%sum(all_host)
270 IF (output_unit > 0) THEN
271 WRITE (unit=output_unit, fmt="(T2,A)") ""
272 DO ipe = 1, para_env%num_pe
273 CALL ascii_to_string(all_host(:, ipe), string)
274 WRITE (unit=output_unit, fmt="(T2,A,T63,I8,T71,I10)") &
275 trim(r_user_name)//"@"//trim(string)// &
276 " has created rank and process ", ipe - 1, all_pid(ipe)
277 END DO
278 END IF
279
280 DEALLOCATE (all_pid)
281 DEALLOCATE (all_host)
282
283 END SUBROUTINE echo_all_hosts
284
285! **************************************************************************************************
286!> \brief echoes the list the number of process per host
287!> \param para_env ...
288!> \param output_unit ...
289!> \param node_count Count number of distributed systems (nodes)
290! **************************************************************************************************
291 SUBROUTINE echo_all_process_host(para_env, output_unit, node_count)
292 TYPE(mp_para_env_type), POINTER :: para_env
293 INTEGER, INTENT(IN) :: output_unit
294 INTEGER, INTENT(OUT), OPTIONAL :: node_count
295
296 CHARACTER(LEN=default_string_length) :: string, string_sec
297 INTEGER :: ipe, jpe, nr_dist, nr_occu
298 INTEGER, ALLOCATABLE, DIMENSION(:) :: all_pid
299 INTEGER, ALLOCATABLE, DIMENSION(:, :) :: all_host
300
301 ALLOCATE (all_host(30, para_env%num_pe), source=0)
302 ALLOCATE (all_pid(para_env%num_pe), source=0)
303
304 IF (m_procrun(r_pid) == 1) THEN
305 CALL string_to_ascii(r_host_name, all_host(:, para_env%mepos + 1))
306 CALL para_env%sum(all_host)
307 END IF
308
309 nr_dist = 0
310 IF (output_unit > 0) WRITE (unit=output_unit, fmt="(T2,A)") ""
311 DO ipe = 1, para_env%num_pe
312 nr_occu = 0
313 IF (all_pid(ipe) /= -1) THEN
314 CALL ascii_to_string(all_host(:, ipe), string)
315 DO jpe = 1, para_env%num_pe
316 CALL ascii_to_string(all_host(:, jpe), string_sec)
317 IF (string == string_sec) THEN
318 nr_occu = nr_occu + 1
319 all_pid(jpe) = -1
320 END IF
321 END DO
322 IF (output_unit > 0) THEN
323 WRITE (unit=output_unit, fmt="(T2,A,T63,I8,A)") &
324 trim(r_user_name)//"@"//trim(string)// &
325 " is running ", nr_occu, " processes"
326 END IF
327 nr_dist = nr_dist + 1
328 END IF
329 END DO
330
331 DEALLOCATE (all_pid)
332 DEALLOCATE (all_host)
333
334 cpassert(0 < nr_dist)
335 IF (PRESENT(node_count)) node_count = nr_dist
336
337 END SUBROUTINE echo_all_process_host
338
339! **************************************************************************************************
340!> \brief read part of cp2k_init
341!> \param root_section ...
342!> \param para_env ...
343!> \param globenv the globenv
344!> \author fawzi
345!> \note
346!> The following routines need to be synchronized wrt. adding/removing
347!> of the default environments (logging, performance,error):
348!> environment:cp2k_init, environment:cp2k_finalize,
349!> f77_interface:f_env_add_defaults, f77_interface:f_env_rm_defaults,
350!> f77_interface:create_force_env, f77_interface:destroy_force_env
351! **************************************************************************************************
352 SUBROUTINE cp2k_read(root_section, para_env, globenv)
353
354 TYPE(section_vals_type), POINTER :: root_section
355 TYPE(mp_para_env_type), POINTER :: para_env
356 TYPE(global_environment_type), POINTER :: globenv
357
358 CHARACTER(LEN=3*default_string_length) :: message
359 CHARACTER(LEN=default_string_length) :: c_val
360 INTEGER :: i, iw
361 TYPE(cp_logger_type), POINTER :: logger
362
363 ! Read the input/output section
364
365 logger => cp_get_default_logger()
366
367 ! try to use better names for the local log if it is not too late
368 CALL section_vals_val_get(root_section, "GLOBAL%OUTPUT_FILE_NAME", &
369 c_val=c_val)
370 IF (c_val /= "") THEN
371 CALL cp_logger_set(logger, &
372 local_filename=trim(c_val)//"_localLog")
373 END IF
374
375 ! Process project name
376 CALL section_vals_val_get(root_section, "GLOBAL%PROJECT", c_val=c_val)
377 IF (index(c_val(:len_trim(c_val)), " ") > 0) THEN
378 message = "Project name <"//trim(c_val)// &
379 "> contains spaces which will be replaced with underscores"
380 cpwarn(trim(message))
381 DO i = 1, len_trim(c_val)
382 ! Replace space with underscore
383 IF (c_val(i:i) == " ") c_val(i:i) = "_"
384 END DO
385 CALL section_vals_val_set(root_section, "GLOBAL%PROJECT", c_val=trim(c_val))
386 END IF
387 IF (c_val /= "") THEN
388 CALL cp_logger_set(logger, local_filename=trim(c_val)//"_localLog")
389 END IF
390 logger%iter_info%project_name = c_val
391
392 CALL section_vals_val_get(root_section, "GLOBAL%PRINT_LEVEL", i_val=logger%iter_info%print_level)
393
394 ! Read the CP2K section
395 CALL read_cp2k_section(root_section, para_env, globenv)
396
397 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT/BASIC_DATA_TYPES", &
398 extension=".Log")
399 IF (iw > 0) CALL print_kind_info(iw)
400 CALL cp_print_key_finished_output(iw, logger, root_section, &
401 "GLOBAL%PRINT/BASIC_DATA_TYPES")
402
403 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT/PHYSCON", &
404 extension=".Log")
405 IF (iw > 0) CALL write_physcon(iw)
406 CALL cp_print_key_finished_output(iw, logger, root_section, &
407 "GLOBAL%PRINT/PHYSCON")
408
409 END SUBROUTINE cp2k_read
410
411! **************************************************************************************************
412!> \brief globenv initializations that need the input and error
413!> \param root_section ...
414!> \param para_env ...
415!> \param globenv the global environment to initialize
416!> \author fawzi
417!> \note
418!> if possible do the initializations here as the environment
419!> (error,...) is setup, instead of cp2k_init
420! **************************************************************************************************
421 SUBROUTINE cp2k_setup(root_section, para_env, globenv)
422
423 TYPE(section_vals_type), POINTER :: root_section
424 TYPE(mp_para_env_type), POINTER :: para_env
425 TYPE(global_environment_type), POINTER :: globenv
426
427 INTEGER :: iw, maxl
428 INTEGER, DIMENSION(:), POINTER :: seed_vals
429 REAL(kind=dp), DIMENSION(3, 2) :: initial_seed
430 TYPE(cp_logger_type), POINTER :: logger
431
432 NULLIFY (logger)
433 logger => cp_get_default_logger()
434
435 ! Initialize the parallel random number generator
436
437 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT/RNG_MATRICES", &
438 extension=".Log")
439 IF (iw > 0) THEN
440 CALL write_rng_matrices(iw)
441 END IF
442
443 CALL cp_print_key_finished_output(iw, logger, root_section, &
444 "GLOBAL%PRINT/RNG_MATRICES")
445
446 ! Initialize a global normally Gaussian distributed (pseudo)random number stream
447
448 CALL section_vals_val_get(root_section, "GLOBAL%SEED", i_vals=seed_vals)
449 IF (SIZE(seed_vals) == 1) THEN
450 initial_seed(:, :) = real(seed_vals(1), kind=dp)
451 ELSE IF (SIZE(seed_vals) == 6) THEN
452 initial_seed(1:3, 1:2) = reshape(real(seed_vals(:), kind=dp), [3, 2])
453 ELSE
454 cpabort("Supply exactly 1 or 6 arguments for SEED in &GLOBAL only!")
455 END IF
456
457 globenv%gaussian_rng_stream = rng_stream_type( &
458 name="Global Gaussian random numbers", &
459 distribution_type=gaussian, &
460 seed=initial_seed, &
461 extended_precision=.true.)
462
463 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT/RNG_CHECK", &
464 extension=".Log")
465 IF (iw > 0) THEN
466 CALL check_rng(iw, para_env%is_source())
467 END IF
468
469 CALL cp_print_key_finished_output(iw, logger, root_section, &
470 "GLOBAL%PRINT/RNG_CHECK")
471
472 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT/GLOBAL_GAUSSIAN_RNG", &
473 extension=".Log")
474 IF (iw > 0) &
475 CALL globenv%gaussian_rng_stream%write(iw, write_all=.true.)
476
477 CALL cp_print_key_finished_output(iw, logger, root_section, &
478 "GLOBAL%PRINT/GLOBAL_GAUSSIAN_RNG")
479
480 CALL section_vals_val_get(root_section, "GLOBAL%PRINT%SPHERICAL_HARMONICS", i_val=maxl)
481 IF (maxl >= 0) THEN
482 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PRINT", &
483 extension=".Log")
484 CALL init_orbital_pointers(maxl)
485 CALL init_spherical_harmonics(maxl, iw)
488 CALL cp_print_key_finished_output(iw, logger, root_section, &
489 "GLOBAL%PRINT")
490 END IF
491
492 END SUBROUTINE cp2k_setup
493
494! **************************************************************************************************
495!> \brief read the global section of new input
496!> \param root_section ...
497!> \param para_env ...
498!> \param globenv ...
499!> \par History
500!> 06-2005 [created]
501!> \author MI
502!> \note
503!> Should not be required anymore once everything is converted
504!> to get information directly from the input structure
505! **************************************************************************************************
506 SUBROUTINE read_global_section(root_section, para_env, globenv)
507
508 TYPE(section_vals_type), POINTER :: root_section
509 TYPE(mp_para_env_type), POINTER :: para_env
510 TYPE(global_environment_type), POINTER :: globenv
511
512 CHARACTER(LEN=6), PARAMETER :: start_section_label = "GLOBAL"
513
514 CHARACTER(LEN=13) :: omp_stacksize, tracing_string
515 CHARACTER(LEN=6) :: print_level_string
516 CHARACTER(LEN=default_path_length) :: basis_set_file_name, coord_file_name, &
517 mm_potential_file_name, &
518 potential_file_name
519 CHARACTER(LEN=default_string_length) :: env_num, model_name, project_name
520 CHARACTER(LEN=default_string_length), &
521 DIMENSION(:), POINTER :: trace_routines
522 INTEGER :: cpuid, cpuid_static, i_cholesky, i_dgemm, i_diag, i_fft, i_grid_backend, &
523 iforce_eval, method_name_id, n_rep_val, nforce_eval, node_count, num_threads, &
524 output_unit, print_level, trace_max, unit_nr
525 INTEGER(kind=int_8) :: buffers, buffers_avr, buffers_max, buffers_min, cached, cached_avr, &
526 cached_max, cached_min, memfree, memfree_avr, memfree_max, memfree_min, memlikelyfree, &
527 memlikelyfree_avr, memlikelyfree_max, memlikelyfree_min, memtotal, memtotal_avr, &
528 memtotal_max, memtotal_min, slab, slab_avr, slab_max, slab_min, sreclaimable, &
529 sreclaimable_avr, sreclaimable_max, sreclaimable_min
530 INTEGER, DIMENSION(:), POINTER :: i_force_eval
531 LOGICAL :: ata, do_echo_all_hosts, efl, explicit, &
532 flag, report_maxloc, trace, &
533 trace_master
534 TYPE(cp_logger_type), POINTER :: logger
535 TYPE(enumeration_type), POINTER :: enum1, enum2
536 TYPE(keyword_type), POINTER :: keyword
537 TYPE(section_type), POINTER :: section
538 TYPE(section_vals_type), POINTER :: dft_section, force_env_sections, &
539 global_section, qmmm_section, &
540 subsys_section
541
542 NULLIFY (dft_section, global_section, i_force_eval)
543
544 logger => cp_get_default_logger()
545 global_section => section_vals_get_subs_vals(root_section, "GLOBAL")
546 CALL section_vals_val_get(global_section, "BLACS_GRID", i_val=globenv%blacs_grid_layout)
547 CALL section_vals_val_get(global_section, "BLACS_REPEATABLE", l_val=globenv%blacs_repeatable)
548 CALL section_vals_val_get(global_section, "PREFERRED_DIAG_LIBRARY", i_val=i_diag)
549 CALL section_vals_val_get(global_section, "DIRECT_GENERALIZED_DIAGONALIZATION", &
550 l_val=globenv%direct_generalized_diagonalization)
551 CALL section_vals_val_get(global_section, "PREFERRED_CHOLESKY_LIBRARY", i_val=i_cholesky)
552 CALL section_vals_val_get(global_section, "PREFERRED_DGEMM_LIBRARY", i_val=i_dgemm)
553 CALL section_vals_val_get(global_section, "EPS_CHECK_DIAG", r_val=globenv%eps_check_diag)
554 CALL section_vals_val_get(global_section, "ENABLE_MPI_IO", l_val=flag)
555 CALL cp_mpi_io_set(flag)
556 CALL section_vals_val_get(global_section, "ELPA_KERNEL", i_val=globenv%k_elpa)
557 CALL section_vals_val_get(global_section, "ELPA_NEIGVEC_MIN", i_val=globenv%elpa_neigvec_min)
558 CALL section_vals_val_get(global_section, "ELPA_QR", l_val=globenv%elpa_qr)
559 CALL section_vals_val_get(global_section, "ELPA_ONE_STAGE", l_val=globenv%elpa_one_stage)
560 CALL section_vals_val_get(global_section, "ELPA_PRINT", l_val=globenv%elpa_print)
561 CALL section_vals_val_get(global_section, "DLAF_NEIGVEC_MIN", i_val=globenv%dlaf_neigvec_min)
562 CALL section_vals_val_get(global_section, "DLAF_CHOLESKY_N_MIN", i_val=globenv%dlaf_cholesky_n_min)
563 CALL section_vals_val_get(global_section, "PREFERRED_FFT_LIBRARY", i_val=i_fft)
564 CALL section_vals_val_get(global_section, "PRINT_LEVEL", i_val=print_level)
565 CALL section_vals_val_get(global_section, "PROGRAM_NAME", i_val=globenv%prog_name_id)
566 CALL section_vals_val_get(global_section, "FFT_POOL_SCRATCH_LIMIT", i_val=globenv%fft_pool_scratch_limit)
567 CALL section_vals_val_get(global_section, "FFTW_PLAN_TYPE", i_val=globenv%fftw_plan_type)
568 CALL section_vals_val_get(global_section, "PROJECT_NAME", c_val=project_name)
569 CALL section_vals_val_get(global_section, "FFTW_WISDOM_FILE_NAME", c_val=globenv%fftw_wisdom_file_name)
570 CALL section_vals_val_get(global_section, "RUN_TYPE", i_val=globenv%run_type_id)
571 CALL cp2k_get_walltime(section=global_section, keyword_name="WALLTIME", &
572 walltime=globenv%cp2k_target_time)
573 CALL section_vals_val_get(global_section, "TRACE", l_val=trace)
574 CALL section_vals_val_get(global_section, "TRACE_MASTER", l_val=trace_master)
575 CALL section_vals_val_get(global_section, "TRACE_MAX", i_val=trace_max)
576 CALL section_vals_val_get(global_section, "TRACE_ROUTINES", explicit=explicit)
577 IF (explicit) THEN
578 CALL section_vals_val_get(global_section, "TRACE_ROUTINES", c_vals=trace_routines)
579 ELSE
580 NULLIFY (trace_routines)
581 END IF
582 CALL section_vals_val_get(global_section, "FLUSH_SHOULD_FLUSH", l_val=flush_should_flush)
583 CALL section_vals_val_get(global_section, "ECHO_ALL_HOSTS", l_val=do_echo_all_hosts)
584 report_maxloc = section_get_lval(global_section, "TIMINGS%REPORT_MAXLOC")
585 global_timings_level = section_get_ival(global_section, "TIMINGS%TIMINGS_LEVEL")
586 do_echo_all_hosts = do_echo_all_hosts .OR. report_maxloc
587 force_env_sections => section_vals_get_subs_vals(root_section, "FORCE_EVAL")
588 CALL section_vals_get(force_env_sections, n_repetition=nforce_eval)
589 output_unit = cp_print_key_unit_nr(logger, global_section, "PROGRAM_RUN_INFO", &
590 extension=".log")
591
592 CALL fm_setup(global_section)
593 CALL fm_diag_rules_setup(global_section)
594 CALL dgemm_setup(global_section)
595
596 IF (trace .AND. (.NOT. trace_master .OR. para_env%mepos == 0)) THEN
597 unit_nr = -1
598 IF (logger%para_env%is_source() .OR. .NOT. trace_master) &
599 unit_nr = cp_logger_get_default_unit_nr(logger, local=.true.)
600 WRITE (tracing_string, "(I6.6,A1,I6.6)") para_env%mepos, ":", para_env%num_pe
601 IF (ASSOCIATED(trace_routines)) THEN
602 CALL timings_setup_tracing(trace_max, unit_nr, tracing_string, trace_routines)
603 ELSE
604 CALL timings_setup_tracing(trace_max, unit_nr, tracing_string)
605 END IF
606 END IF
607
608 CALL section_vals_val_get(global_section, "TIMINGS%TIME_MPI", l_val=mp_collect_timings)
609
610 SELECT CASE (i_diag)
612 globenv%diag_library = "ScaLAPACK"
613 CASE (fm_diag_type_elpa)
614 globenv%diag_library = "ELPA"
617 globenv%diag_library = "cuSOLVER"
618 CASE (fm_diag_type_dlaf)
619 globenv%diag_library = "DLAF"
621 CASE DEFAULT
622 cpabort("Unknown diagonalization library specified")
623 END SELECT
624
625 SELECT CASE (i_cholesky)
627 globenv%cholesky_library = "ScaLAPACK"
630 globenv%cholesky_library = "DLAF"
632 dlaf_cholesky_n_min = globenv%dlaf_cholesky_n_min
634 CASE DEFAULT
635 cpabort("Unknown Cholesky decomposition library specified")
636 END SELECT
637
638 SELECT CASE (i_fft)
639 CASE (do_fft_sg)
640 globenv%default_fft_library = "FFTSG"
641 CASE (do_fft_fftw3)
642 globenv%default_fft_library = "FFTW3"
644 CASE DEFAULT
645 cpabort("Unknown FFT library specified")
646 END SELECT
647
648 SELECT CASE (i_dgemm)
649 CASE (do_dgemm_spla)
650 globenv%default_dgemm_library = "SPLA"
651 CASE (do_dgemm_blas)
652 globenv%default_dgemm_library = "BLAS"
653 CASE DEFAULT
654 cpabort("Unknown DGEMM library specified")
655 END SELECT
656
657 IF (globenv%run_type_id == 0) THEN
658 SELECT CASE (globenv%prog_name_id)
659 CASE (do_farming, do_test)
660 globenv%run_type_id = none_run
661 CASE (do_cp2k)
662 IF (nforce_eval /= 1) THEN
663 ! multiple force_eval corresponds at the moment to RESPA calculations only
664 ! default MD
665 globenv%run_type_id = mol_dyn_run
666 ELSE
667 CALL section_vals_val_get(force_env_sections, "METHOD", i_val=method_name_id)
668 SELECT CASE (method_name_id)
669 CASE (do_fist)
670 globenv%run_type_id = mol_dyn_run
671 CASE (do_eip)
672 globenv%run_type_id = mol_dyn_run
673 CASE (do_qs)
674 globenv%run_type_id = energy_run
675 CASE (do_sirius)
676 globenv%run_type_id = energy_run
677 END SELECT
678 END IF
679 END SELECT
680 END IF
681
682 IF (globenv%prog_name_id == do_farming .AND. globenv%run_type_id /= none_run) THEN
683 cpabort("FARMING program supports only NONE as run type")
684 END IF
685
686 IF (globenv%prog_name_id == do_test .AND. globenv%run_type_id /= none_run) &
687 cpabort("TEST program supports only NONE as run type")
688
689 CALL m_memory_details(memtotal, memfree, buffers, cached, slab, sreclaimable, memlikelyfree)
690 memtotal_avr = memtotal
691 memfree_avr = memfree
692 buffers_avr = buffers
693 cached_avr = cached
694 slab_avr = slab
695 sreclaimable_avr = sreclaimable
696 memlikelyfree_avr = memlikelyfree
697 CALL para_env%sum(memtotal_avr); memtotal_avr = memtotal_avr/para_env%num_pe/1024
698 CALL para_env%sum(memfree_avr); memfree_avr = memfree_avr/para_env%num_pe/1024
699 CALL para_env%sum(buffers_avr); buffers_avr = buffers_avr/para_env%num_pe/1024
700 CALL para_env%sum(cached_avr); cached_avr = cached_avr/para_env%num_pe/1024
701 CALL para_env%sum(slab_avr); slab_avr = slab_avr/para_env%num_pe/1024
702 CALL para_env%sum(sreclaimable_avr); sreclaimable_avr = sreclaimable_avr/para_env%num_pe/1024
703 CALL para_env%sum(memlikelyfree_avr); memlikelyfree_avr = memlikelyfree_avr/para_env%num_pe/1024
704
705 memtotal_min = -memtotal
706 memfree_min = -memfree
707 buffers_min = -buffers
708 cached_min = -cached
709 slab_min = -slab
710 sreclaimable_min = -sreclaimable
711 memlikelyfree_min = -memlikelyfree
712 CALL para_env%max(memtotal_min); memtotal_min = -memtotal_min/1024
713 CALL para_env%max(memfree_min); memfree_min = -memfree_min/1024
714 CALL para_env%max(buffers_min); buffers_min = -buffers_min/1024
715 CALL para_env%max(cached_min); cached_min = -cached_min/1024
716 CALL para_env%max(slab_min); slab_min = -slab_min/1024
717 CALL para_env%max(sreclaimable_min); sreclaimable_min = -sreclaimable_min/1024
718 CALL para_env%max(memlikelyfree_min); memlikelyfree_min = -memlikelyfree_min/1024
719
720 memtotal_max = memtotal
721 memfree_max = memfree
722 buffers_max = buffers
723 cached_max = cached
724 slab_max = slab
725 sreclaimable_max = sreclaimable
726 memlikelyfree_max = memlikelyfree
727 CALL para_env%max(memtotal_max); memtotal_max = memtotal_max/1024
728 CALL para_env%max(memfree_max); memfree_max = memfree_max/1024
729 CALL para_env%max(buffers_max); buffers_max = buffers_max/1024
730 CALL para_env%max(cached_max); cached_max = cached_max/1024
731 CALL para_env%max(slab_max); slab_max = slab_max/1024
732 CALL para_env%max(sreclaimable_max); sreclaimable_max = sreclaimable_max/1024
733 CALL para_env%max(memlikelyfree_max); memlikelyfree_max = memlikelyfree_max/1024
734
735 memtotal = memtotal/1024
736 memfree = memfree/1024
737 buffers = buffers/1024
738 cached = cached/1024
739 slab = slab/1024
740 sreclaimable = sreclaimable/1024
741 memlikelyfree = memlikelyfree/1024
742
743 node_count = 1
744 ! Print a list of all started processes
745 IF (do_echo_all_hosts) THEN
746 CALL echo_all_hosts(para_env, output_unit)
747
748 ! Print the number of processes per host
749 CALL echo_all_process_host(para_env, output_unit, node_count)
750 ELSE ! no echo
751 CALL echo_all_process_host(para_env, 0, node_count)
752 END IF
753
754 num_threads = 1
755!$ num_threads = omp_get_max_threads()
756 IF (output_unit > 0) THEN
757 WRITE (unit=output_unit, fmt=*)
758 CALL multiple_fe_list(force_env_sections, root_section, i_force_eval, nforce_eval)
759 DO iforce_eval = 1, nforce_eval
760 dft_section => section_vals_get_subs_vals3(force_env_sections, "DFT", &
761 i_rep_section=i_force_eval(iforce_eval))
762 qmmm_section => section_vals_get_subs_vals3(force_env_sections, "QMMM", &
763 i_rep_section=i_force_eval(iforce_eval))
764 CALL section_vals_val_get(dft_section, "BASIS_SET_FILE_NAME", &
765 c_val=basis_set_file_name)
766 CALL section_vals_val_get(dft_section, "POTENTIAL_FILE_NAME", &
767 c_val=potential_file_name)
768
769 CALL section_vals_val_get(qmmm_section, "MM_POTENTIAL_FILE_NAME", &
770 c_val=mm_potential_file_name)
771 ! SUBSYS - If any
772 subsys_section => section_vals_get_subs_vals3(force_env_sections, "SUBSYS", &
773 i_rep_section=i_force_eval(iforce_eval))
774 CALL section_vals_get(subsys_section, explicit=explicit)
775 coord_file_name = "__STD_INPUT__"
776 IF (explicit) THEN
777 CALL section_vals_val_get(subsys_section, "TOPOLOGY%COORD_FILE_NAME", &
778 n_rep_val=n_rep_val)
779 IF (n_rep_val == 1) THEN
780 CALL section_vals_val_get(subsys_section, "TOPOLOGY%COORD_FILE_NAME", &
781 c_val=coord_file_name)
782 END IF
783 END IF
784 CALL integer_to_string(i_force_eval(iforce_eval), env_num)
785
786 WRITE (unit=output_unit, fmt="(T2,A,T41,A)") &
787 start_section_label//"| Force Environment number", &
788 adjustr(env_num(:40)), &
789 start_section_label//"| Basis set file name", &
790 adjustr(basis_set_file_name(:40)), &
791 start_section_label//"| Potential file name", &
792 adjustr(potential_file_name(:40)), &
793 start_section_label//"| MM Potential file name", &
794 adjustr(mm_potential_file_name(:40)), &
795 start_section_label//"| Coordinate file name", &
796 adjustr(coord_file_name(:40))
797 END DO
798 DEALLOCATE (i_force_eval)
799
800 NULLIFY (enum1, enum2, keyword, section)
801 CALL create_global_section(section)
802 keyword => section_get_keyword(section, "PROGRAM_NAME")
803 CALL keyword_get(keyword, enum=enum1)
804 keyword => section_get_keyword(section, "RUN_TYPE")
805 CALL keyword_get(keyword, enum=enum2)
806
807 WRITE (unit=output_unit, fmt="(T2,A,T41,A40)") &
808 start_section_label//"| Method name", &
809 adjustr(trim(enum_i2c(enum1, globenv%prog_name_id))), &
810 start_section_label//"| Project name", &
811 adjustr(project_name(:40)), &
812 start_section_label//"| Run type", &
813 adjustr(trim(enum_i2c(enum2, globenv%run_type_id))), &
814 start_section_label//"| FFT library", &
815 adjustr(globenv%default_fft_library(:40)), &
816 start_section_label//"| Diagonalization library", &
817 adjustr(globenv%diag_library(:40)), &
818 start_section_label//"| Cholesky decomposition library", &
819 adjustr(globenv%cholesky_library(:40)), &
820 start_section_label//"| DGEMM library", &
821 adjustr(globenv%default_dgemm_library(:40))
822
823 IF (globenv%diag_library == "ELPA") THEN
824 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
825 start_section_label//"| Minimum number of eigenvectors for ELPA usage", &
826 globenv%elpa_neigvec_min
827 END IF
828
829 IF (globenv%diag_library == "DLAF") THEN
830 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
831 start_section_label//"| Minimum number of eigenvectors for DLAF usage", &
832 globenv%dlaf_neigvec_min
833 END IF
834
835 IF (globenv%diag_library == "cuSOLVER" .OR. globenv%diag_library == "ScaLAPACK" .OR. &
836 globenv%diag_library == "DLAF") THEN
837 WRITE (unit=output_unit, fmt="(T2,A,T71,L10)") &
838 start_section_label//"| Direct generalized diagonalization requested", &
839 globenv%direct_generalized_diagonalization
840 END IF
841
842 IF (globenv%diag_library == "cuSOLVER") THEN
843 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
844 start_section_label//"| Minimum matrix size for cuSOLVER diagonalization", &
846 END IF
847
848 IF (globenv%cholesky_library == "DLAF") THEN
849 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
850 start_section_label//"| Minimum matrix size for Cholesky decomposition with DLAF", &
851 globenv%dlaf_cholesky_n_min
852 END IF
853
854#if defined(__CHECK_DIAG)
855 ! Perform default check if no threshold value has been specified explicitly
856 IF (globenv%eps_check_diag < 0.0_dp) THEN
857 WRITE (unit=output_unit, fmt="(T2,A,T71,ES10.3)") &
858 start_section_label//"| Orthonormality check for eigenvectors enabled", &
860 ELSE
861 WRITE (unit=output_unit, fmt="(T2,A,T71,ES10.3)") &
862 start_section_label//"| Orthonormality check for eigenvectors enabled", &
863 globenv%eps_check_diag
864 END IF
865#else
866 IF (globenv%eps_check_diag < 0.0_dp) THEN
867 WRITE (unit=output_unit, fmt="(T2,A,T73,A)") &
868 start_section_label//"| Orthonormality check for eigenvectors", &
869 "DISABLED"
870 ELSE
871 WRITE (unit=output_unit, fmt="(T2,A,T71,ES10.3)") &
872 start_section_label//"| Orthonormality check for eigenvectors enabled", &
873 globenv%eps_check_diag
874 END IF
875#endif
876 CALL section_release(section)
877
878 SELECT CASE (cp_fm_get_mm_type())
879 CASE (do_scalapack)
880 WRITE (unit=output_unit, fmt="(T2,A,T72,A)") &
881 start_section_label//"| Matrix multiplication library", "ScaLAPACK"
882 CASE (do_cosma)
883 WRITE (unit=output_unit, fmt="(T2,A,T76,A)") &
884 start_section_label//"| Matrix multiplication library", "COSMA"
885 END SELECT
886
887 CALL section_vals_val_get(global_section, "ALLTOALL_SGL", l_val=ata)
888 WRITE (unit=output_unit, fmt="(T2,A,T80,L1)") &
889 start_section_label//"| All-to-all communication in single precision", ata
890 CALL section_vals_val_get(global_section, "EXTENDED_FFT_LENGTHS", l_val=efl)
891 WRITE (unit=output_unit, fmt="(T2,A,T80,L1)") &
892 start_section_label//"| FFTs using library dependent lengths", efl
893
894 SELECT CASE (print_level)
895 CASE (silent_print_level)
896 print_level_string = "SILENT"
897 CASE (low_print_level)
898 print_level_string = " LOW"
899 CASE (medium_print_level)
900 print_level_string = "MEDIUM"
901 CASE (high_print_level)
902 print_level_string = " HIGH"
903 CASE (debug_print_level)
904 print_level_string = " DEBUG"
905 CASE DEFAULT
906 cpabort("Unknown print_level")
907 END SELECT
908
909 CALL section_vals_val_get(global_section, "GRID%BACKEND", i_val=i_grid_backend)
910 SELECT CASE (i_grid_backend)
911 CASE (grid_backend_auto)
912 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
913 start_section_label//"| Grid backend", "AUTO"
914 CASE (grid_backend_cpu)
915 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
916 start_section_label//"| Grid backend", "CPU"
917 CASE (grid_backend_dgemm)
918 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
919 start_section_label//"| Grid backend", "DGEMM"
920 CASE (grid_backend_gpu)
921 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
922 start_section_label//"| Grid backend", "GPU"
923 CASE (grid_backend_hip)
924 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
925 start_section_label//"| Grid backend", "HIP"
926 CASE (grid_backend_ref)
927 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
928 start_section_label//"| Grid backend", "REF"
929 END SELECT
930
931 WRITE (unit=output_unit, fmt="(T2,A,T75,A6)") &
932 start_section_label//"| Global print level", print_level_string
933 WRITE (unit=output_unit, fmt="(T2,A,T75,L6)") &
934 start_section_label//"| MPI I/O enabled", flag
935 WRITE (unit=output_unit, fmt="(T2,A,T75,I6)") &
936 start_section_label//"| Total number of message passing processes", &
937 para_env%num_pe, &
938 start_section_label//"| Number of distributed systems (nodes)", &
939 node_count, &
940 start_section_label//"| Number of threads for this process", &
941 num_threads, &
942 start_section_label//"| This output is from process", para_env%mepos
943
944 CALL m_omp_get_stacksize(omp_stacksize)
945 WRITE (unit=output_unit, fmt="(T2,A,T68,A13)") &
946 start_section_label//"| OpenMP stack size per thread (OMP_STACKSIZE)", &
947 adjustr(omp_stacksize)
948
949 IF (0 <= m_omp_trace_issues()) THEN ! only show in header if enabled
950 WRITE (unit=output_unit, fmt="(T2,A,T68,A13)") &
951 start_section_label//"| OpenMP issue trace (CP2K_OMP_TRACE)", &
952 "enabled"
953 END IF
954
955 CALL m_cpuinfo(model_name)
956 WRITE (unit=output_unit, fmt="(T2,A,T30,A51)") &
957 start_section_label//"| CPU model name", adjustr(trim(model_name))
958
959 cpuid = m_cpuid()
960 cpuid_static = m_cpuid_static()
961
962 IF ((cpuid > 0) .OR. (cpuid_static > 0)) THEN
963 WRITE (unit=output_unit, fmt="(T2,A,T75,I6)") &
964 start_section_label//"| CPUID", cpuid
965 IF (cpuid /= cpuid_static) THEN
966 WRITE (unit=output_unit, fmt="(T2,A,T75,I6)") &
967 start_section_label//"| Compiled for CPUID", cpuid_static
968 END IF
969 END IF
970
971 ! filter cpuids by vlen to show more relevant information
972 IF (m_cpuid_vlen(cpuid_static) < m_cpuid_vlen(cpuid)) THEN
973 ! base/machine_cpuid.c relies on the (same) target flags as the Fortran code
974 CALL cp_hint(__location__, "The compiler target flags ("// &
975 trim(m_cpuid_name(cpuid_static))//") used to build this binary cannot exploit "// &
976 "all extensions of this CPU model ("//trim(m_cpuid_name(cpuid))//"). "// &
977 "Consider compiler target flags as part of FCFLAGS and CFLAGS (ARCH file).")
978 END IF
979
980 WRITE (unit=output_unit, fmt="()")
981 WRITE (unit=output_unit, fmt="(T2,A)") "MEMORY| system memory details [Kb]"
982 WRITE (unit=output_unit, fmt="(T2,A23,4A14)") "MEMORY| ", "rank 0", "min", "max", "average"
983 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") "MEMORY| MemTotal ", memtotal, memtotal_min, memtotal_max, memtotal_avr
984 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") "MEMORY| MemFree ", memfree, memfree_min, memfree_max, memfree_avr
985 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") "MEMORY| Buffers ", buffers, buffers_min, buffers_max, buffers_avr
986 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") "MEMORY| Cached ", cached, cached_min, cached_max, cached_avr
987 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") "MEMORY| Slab ", slab, slab_min, slab_max, slab_avr
988 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") &
989 "MEMORY| SReclaimable ", sreclaimable, sreclaimable_min, sreclaimable_max, &
990 sreclaimable_avr
991 WRITE (unit=output_unit, fmt="(T2,A23,4I14)") &
992 "MEMORY| MemLikelyFree ", memlikelyfree, memlikelyfree_min, memlikelyfree_max, &
993 memlikelyfree_avr
994 WRITE (unit=output_unit, fmt='()')
995
996 END IF
997
998 CALL cp_print_key_finished_output(output_unit, logger, global_section, &
999 "PROGRAM_RUN_INFO")
1000
1001 END SUBROUTINE read_global_section
1002
1003! **************************************************************************************************
1004!> \brief ...
1005!> \param root_section ...
1006!> \param para_env ...
1007!> \param globenv ...
1008!> \par History
1009!> 2-Dec-2000 (JGH) added default fft library
1010!> \author JGH,MK
1011! **************************************************************************************************
1012 SUBROUTINE read_cp2k_section(root_section, para_env, globenv)
1013
1014 TYPE(section_vals_type), POINTER :: root_section
1015 TYPE(mp_para_env_type), POINTER :: para_env
1016 TYPE(global_environment_type), POINTER :: globenv
1017
1018 INTEGER :: output_unit
1019 TYPE(cp_logger_type), POINTER :: logger
1020 TYPE(section_vals_type), POINTER :: global_section
1021
1022 global_section => section_vals_get_subs_vals(root_section, "GLOBAL")
1023 CALL read_global_section(root_section, para_env, globenv)
1024 logger => cp_get_default_logger()
1025 output_unit = cp_print_key_unit_nr(logger, global_section, "PROGRAM_RUN_INFO", &
1026 extension=".log")
1027
1028 CALL fft_setup_library(globenv, global_section)
1029 CALL diag_setup_library(globenv)
1030
1031 CALL cp_print_key_finished_output(output_unit, logger, global_section, &
1032 "PROGRAM_RUN_INFO")
1033
1034 END SUBROUTINE read_cp2k_section
1035
1036! **************************************************************************************************
1037!> \brief check FFT preferred library availability, if not switch
1038!> \param globenv ...
1039!> \param global_section ...
1040!> \par History
1041!> 2-Dec-2000 (JGH) added default fft library
1042!> Nov-2013 (MI) refactoring
1043!> \author JGH,MK
1044! **************************************************************************************************
1045 SUBROUTINE fft_setup_library(globenv, global_section)
1046
1047 TYPE(global_environment_type), POINTER :: globenv
1048 TYPE(section_vals_type), POINTER :: global_section
1049
1050 CHARACTER(LEN=3*default_string_length) :: message
1051 COMPLEX(KIND=dp), DIMENSION(4, 4, 4) :: zz
1052 INTEGER :: stat
1053 INTEGER, DIMENSION(3) :: n
1054 LOGICAL :: try_fftw
1055
1056 n(:) = 4
1057 zz(:, :, :) = 0.0_dp
1058
1059 ! Setup the FFT library
1060 ! If the user has specified PREFERRED_FFT_LIBRARY try that first (default FFTW3)
1061 ! If that one is not available, try FFTW3 (unless it has been tried already)
1062 ! If FFTW3 is not available use FFTSG
1063
1064 IF (globenv%default_fft_library == "FFTW3") THEN
1065 try_fftw = .false.
1066 ELSE
1067 try_fftw = .true.
1068 END IF
1069
1070 ! Initialize FFT library with the user's preferred FFT library
1071 CALL init_fft(fftlib=trim(globenv%default_fft_library), &
1072 alltoall=section_get_lval(global_section, "ALLTOALL_SGL"), &
1073 fftsg_sizes=.NOT. section_get_lval(global_section, "EXTENDED_FFT_LENGTHS"), &
1074 pool_limit=globenv%fft_pool_scratch_limit, &
1075 wisdom_file=globenv%fftw_wisdom_file_name, &
1076 plan_style=globenv%fftw_plan_type)
1077
1078 ! Check for FFT library
1079 CALL fft3d(fwfft, n, zz, status=stat)
1080 IF (stat /= 0) THEN
1081 IF (try_fftw) THEN
1082 message = "FFT library "//trim(globenv%default_fft_library)// &
1083 " is not available. Trying FFT library FFTW3."
1084 cpwarn(trim(message))
1085 globenv%default_fft_library = "FFTW3"
1086 CALL init_fft(fftlib=trim(globenv%default_fft_library), &
1087 alltoall=section_get_lval(global_section, "ALLTOALL_SGL"), &
1088 fftsg_sizes=.NOT. section_get_lval(global_section, "EXTENDED_FFT_LENGTHS"), &
1089 pool_limit=globenv%fft_pool_scratch_limit, &
1090 wisdom_file=globenv%fftw_wisdom_file_name, &
1091 plan_style=globenv%fftw_plan_type)
1092
1093 CALL fft3d(fwfft, n, zz, status=stat)
1094 END IF
1095 IF (stat /= 0) THEN
1096 message = "FFT library "//trim(globenv%default_fft_library)// &
1097 " is not available. Trying FFT library FFTSG."
1098 cpwarn(trim(message))
1099 globenv%default_fft_library = "FFTSG"
1100 CALL init_fft(fftlib=trim(globenv%default_fft_library), &
1101 alltoall=section_get_lval(global_section, "ALLTOALL_SGL"), &
1102 fftsg_sizes=.NOT. section_get_lval(global_section, "EXTENDED_FFT_LENGTHS"), &
1103 pool_limit=globenv%fft_pool_scratch_limit, &
1104 wisdom_file=globenv%fftw_wisdom_file_name, &
1105 plan_style=globenv%fftw_plan_type)
1106
1107 CALL fft3d(fwfft, n, zz, status=stat)
1108 IF (stat /= 0) THEN
1109 cpabort("FFT library FFTSG does not work. No FFT library available.")
1110 END IF
1111 END IF
1112 END IF
1113
1114 END SUBROUTINE fft_setup_library
1115
1116! **************************************************************************************************
1117!> \brief availability diagonalizatioon library
1118!>
1119!> \param globenv ...
1120!> \author MI
1121! **************************************************************************************************
1122 SUBROUTINE diag_setup_library(globenv)
1123 TYPE(global_environment_type), POINTER :: globenv
1124
1125 CHARACTER(LEN=3*default_string_length) :: message
1126 LOGICAL :: fallback_applied
1127
1128 CALL diag_init(diag_lib=trim(globenv%diag_library), &
1129 fallback_applied=fallback_applied, &
1130 elpa_kernel=globenv%k_elpa, &
1131 elpa_neigvec_min_input=globenv%elpa_neigvec_min, &
1132 elpa_qr=globenv%elpa_qr, &
1133 elpa_print=globenv%elpa_print, &
1134 elpa_one_stage=globenv%elpa_one_stage, &
1135 dlaf_neigvec_min_input=globenv%dlaf_neigvec_min, &
1136 eps_check_diag_input=globenv%eps_check_diag, &
1137 direct_generalized_diagonalization_input= &
1138 globenv%direct_generalized_diagonalization)
1139
1140 IF (fallback_applied) THEN
1141 message = "Diagonalization library "//trim(globenv%diag_library)// &
1142 " is not available. The ScaLAPACK library is used as fallback."
1143 cpwarn(trim(message))
1144 END IF
1145
1146 END SUBROUTINE diag_setup_library
1147
1148! **************************************************************************************************
1149!> \brief ...
1150!> \param glob_section ...
1151! **************************************************************************************************
1152 SUBROUTINE fm_setup(glob_section)
1153 TYPE(section_vals_type), POINTER :: glob_section
1154
1155 INTEGER :: mm_type, ncb, nrb
1156 LOGICAL :: force_me
1157 TYPE(section_vals_type), POINTER :: fm_section
1158
1159 fm_section => section_vals_get_subs_vals(glob_section, "FM")
1160
1161 CALL section_vals_val_get(fm_section, "NROW_BLOCKS", i_val=nrb)
1162 CALL section_vals_val_get(fm_section, "NCOL_BLOCKS", i_val=ncb)
1163 CALL section_vals_val_get(fm_section, "FORCE_BLOCK_SIZE", l_val=force_me)
1164 CALL cp_fm_struct_config(nrow_block=nrb, ncol_block=ncb, force_block=force_me)
1165
1166 CALL section_vals_val_get(fm_section, "TYPE_OF_MATRIX_MULTIPLICATION", i_val=mm_type)
1167 CALL cp_fm_setup(mm_type)
1168
1169 END SUBROUTINE fm_setup
1170
1171! **************************************************************************************************
1172!> \brief ...
1173!> \param glob_section ...
1174! **************************************************************************************************
1175 SUBROUTINE dgemm_setup(glob_section)
1176 TYPE(section_vals_type), POINTER :: glob_section
1177
1178 INTEGER :: dgemm_type
1179
1180 CALL section_vals_val_get(glob_section, "PREFERRED_DGEMM_LIBRARY", i_val=dgemm_type)
1181
1182 CALL local_gemm_set_library(dgemm_type)
1183
1184 END SUBROUTINE dgemm_setup
1185
1186! **************************************************************************************************
1187!> \brief Parses the input section used to define the heuristic rules which determine if
1188!> a FM matrix should be redistributed before diagonalizing it.
1189!> \param glob_section the global input section
1190!> \author Nico Holmberg [01.2018]
1191! **************************************************************************************************
1192 SUBROUTINE fm_diag_rules_setup(glob_section)
1193 TYPE(section_vals_type), POINTER :: glob_section
1194
1195 INTEGER :: a, x
1196 LOGICAL :: elpa_force_redistribute, should_print
1197 TYPE(section_vals_type), POINTER :: section
1198
1199 section => section_vals_get_subs_vals(glob_section, "FM_DIAG_SETTINGS")
1200
1201 CALL section_vals_val_get(section, "PARAMETER_A", i_val=a)
1202 CALL section_vals_val_get(section, "PARAMETER_X", i_val=x)
1203 CALL section_vals_val_get(section, "PRINT_FM_REDISTRIBUTE", l_val=should_print)
1204 CALL section_vals_val_get(section, "ELPA_FORCE_REDISTRIBUTE", l_val=elpa_force_redistribute)
1205
1206 CALL cp_fm_redistribute_init(a, x, should_print, elpa_force_redistribute)
1207
1208 END SUBROUTINE fm_diag_rules_setup
1209! **************************************************************************************************
1210!> \brief reads the Walltime also in format HH:MM:SS
1211!> \param section ...
1212!> \param keyword_name ...
1213!> \param walltime ...
1214!> \par History
1215!> none
1216!> \author Mandes
1217! **************************************************************************************************
1218 SUBROUTINE cp2k_get_walltime(section, keyword_name, walltime)
1219 TYPE(section_vals_type), POINTER :: section
1220 CHARACTER(LEN=*), INTENT(in) :: keyword_name
1221 REAL(kind=dp), INTENT(out) :: walltime
1222
1223 CHARACTER(LEN=1) :: c1, c2
1224 CHARACTER(LEN=100) :: txt
1225 INTEGER :: hours, ierr, minutes, n, seconds
1226
1227 CALL section_vals_val_get(section, keyword_name, c_val=txt)
1228 n = len_trim(txt)
1229
1230 IF (n == 0) THEN
1231 walltime = -1.0_dp
1232 ELSE IF (index(txt, ":") == 0) THEN
1233 READ (txt(1:n), fmt=*, iostat=ierr) walltime
1234 IF (ierr /= 0) cpabort('Could not parse WALLTIME: "'//txt(1:n)//'"')
1235 ELSE
1236 READ (txt(1:n), fmt="(I2,A1,I2,A1,I2)", iostat=ierr) hours, c1, minutes, c2, seconds
1237 IF (n /= 8 .OR. ierr /= 0 .OR. c1 /= ":" .OR. c2 /= ":") &
1238 cpabort('Could not parse WALLTIME: "'//txt(1:n)//'"')
1239 walltime = 3600.0_dp*real(hours, dp) + 60.0_dp*real(minutes, dp) + real(seconds, dp)
1240 END IF
1241 END SUBROUTINE cp2k_get_walltime
1242
1243! **************************************************************************************************
1244!> \brief Writes final timings and banner for CP2K
1245!> \param root_section ...
1246!> \param para_env ...
1247!> \param globenv ...
1248!> \param wdir ...
1249!> \param q_finalize ...
1250!> \par History
1251!> none
1252!> \author JGH,MK
1253!> \note
1254!> The following routines need to be synchronized wrt. adding/removing
1255!> of the default environments (logging, performance,error):
1256!> environment:cp2k_init, environment:cp2k_finalize,
1257!> f77_interface:f_env_add_defaults, f77_interface:f_env_rm_defaults,
1258!> f77_interface:create_force_env, f77_interface:destroy_force_env
1259! **************************************************************************************************
1260 SUBROUTINE cp2k_finalize(root_section, para_env, globenv, wdir, q_finalize)
1261
1262 TYPE(section_vals_type), POINTER :: root_section
1263 TYPE(mp_para_env_type), POINTER :: para_env
1264 TYPE(global_environment_type), POINTER :: globenv
1265 CHARACTER(LEN=*), OPTIONAL :: wdir
1266 LOGICAL, INTENT(IN), OPTIONAL :: q_finalize
1267
1268 CHARACTER(LEN=default_path_length) :: cg_filename
1269 INTEGER :: cg_mode, iw, unit_exit
1270 LOGICAL :: delete_it, do_finalize, report_maxloc, &
1271 sort_by_self_time
1272 REAL(kind=dp) :: r_timings
1273 TYPE(cp_logger_type), POINTER :: logger
1274
1275 ! Look if we inherited a failure, more care is needed if so
1276 ! i.e. the input is most likely not available
1277 ! Set flag if this is a development version
1278
1279 do_finalize = .true.
1280 IF (PRESENT(q_finalize)) do_finalize = q_finalize
1281 ! Clean up
1282 NULLIFY (logger)
1283 logger => cp_get_default_logger()
1284 IF (do_finalize) THEN
1288 CALL diag_finalize()
1289 ! finalize the fft (i.e. writes the wisdom if FFTW3 )
1290 CALL finalize_fft(para_env, globenv%fftw_wisdom_file_name)
1291 CALL finalize_libvori()
1292 END IF
1293
1294 ! Write message passing performance info
1295
1296 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PROGRAM_RUN_INFO", &
1297 extension=".log")
1298 CALL describe_mp_perf_env(iw)
1299 CALL cp_print_key_finished_output(iw, logger, root_section, &
1300 "GLOBAL%PROGRAM_RUN_INFO")
1301
1302 CALL collect_citations_from_ranks(para_env)
1303 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%REFERENCES", &
1304 extension=".Log")
1305 IF (iw > 0) THEN
1306 WRITE (unit=iw, fmt="(/,T2,A)") repeat("-", 79)
1307 WRITE (unit=iw, fmt="(T2,A,T80,A)") "-", "-"
1308 WRITE (unit=iw, fmt="(T2,A,T30,A,T80,A)") "-", "R E F E R E N C E S", "-"
1309 WRITE (unit=iw, fmt="(T2,A,T80,A)") "-", "-"
1310 WRITE (unit=iw, fmt="(T2,A)") repeat("-", 79)
1311 WRITE (unit=iw, fmt="(T2,A)") ""
1312 WRITE (unit=iw, fmt="(T2,A)") trim(cp2k_version)//", the CP2K developers group ("//trim(cp2k_year)//")."
1313 WRITE (unit=iw, fmt="(T2,A)") "CP2K is freely available from "//trim(cp2k_home)//" ."
1314 WRITE (unit=iw, fmt="(T2,A)") ""
1315 CALL print_cited_references(unit=iw)
1316 END IF
1317 CALL cp_print_key_finished_output(iw, logger, root_section, &
1318 "GLOBAL%REFERENCES")
1319
1320 CALL timestop(globenv%handle) ! corresponding the "CP2K" in cp2k_init
1321
1322 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%TIMINGS", &
1323 extension=".Log")
1324 r_timings = section_get_rval(root_section, "GLOBAL%TIMINGS%THRESHOLD")
1325 sort_by_self_time = section_get_lval(root_section, "GLOBAL%TIMINGS%SORT_BY_SELF_TIME")
1326 report_maxloc = section_get_lval(root_section, "GLOBAL%TIMINGS%REPORT_MAXLOC")
1327 IF (m_energy() /= 0.0_dp) THEN
1328 CALL timings_report_print(iw, r_timings, sort_by_self_time, cost_type_energy, report_maxloc, para_env)
1329 END IF
1330 CALL timings_report_print(iw, r_timings, sort_by_self_time, cost_type_time, report_maxloc, para_env)
1331
1332 ! Write the callgraph, if desired by user
1333 CALL section_vals_val_get(root_section, "GLOBAL%CALLGRAPH", i_val=cg_mode)
1334 IF (cg_mode /= callgraph_none) THEN
1335 CALL section_vals_val_get(root_section, "GLOBAL%CALLGRAPH_FILE_NAME", c_val=cg_filename)
1336 IF (len_trim(cg_filename) == 0) cg_filename = trim(logger%iter_info%project_name)
1337 IF (cg_mode == callgraph_all) & !incorporate mpi-rank into filename
1338 cg_filename = trim(cg_filename)//"_"//trim(adjustl(cp_to_string(para_env%mepos)))
1339 IF (iw > 0) THEN
1340 WRITE (unit=iw, fmt="(T2,3X,A)") "Writing callgraph to: "//trim(cg_filename)//".callgraph"
1341 WRITE (unit=iw, fmt="()")
1342 WRITE (unit=iw, fmt="(T2,A)") "-------------------------------------------------------------------------------"
1343 END IF
1344 IF (cg_mode == callgraph_all .OR. para_env%is_source()) &
1345 CALL timings_report_callgraph(trim(cg_filename)//".callgraph")
1346 END IF
1347
1348 CALL cp_print_key_finished_output(iw, logger, root_section, &
1349 "GLOBAL%TIMINGS")
1350
1351 CALL rm_mp_perf_env()
1352 CALL rm_timer_env()
1353
1354 IF (para_env%is_source()) THEN
1355 iw = cp_print_key_unit_nr(logger, root_section, "GLOBAL%PROGRAM_RUN_INFO", &
1356 extension=".log")
1357
1358 ! Deleting (if existing) the external EXIT files
1359 delete_it = .false.
1360 INQUIRE (file="EXIT", exist=delete_it)
1361 IF (delete_it) THEN
1362 CALL open_file(file_name="EXIT", unit_number=unit_exit)
1363 CALL close_file(unit_number=unit_exit, file_status="DELETE")
1364 END IF
1365
1366 delete_it = .false.
1367 INQUIRE (file=trim(logger%iter_info%project_name)//".EXIT", exist=delete_it)
1368 IF (delete_it) THEN
1369 CALL open_file(file_name=trim(logger%iter_info%project_name)//".EXIT", unit_number=unit_exit)
1370 CALL close_file(unit_number=unit_exit, file_status="DELETE")
1371 END IF
1372
1373 ! Print OpenMP issue counter and number of warnings for this workload
1374 IF (iw > 0) THEN
1375 IF (0 <= m_omp_trace_issues()) THEN
1376 WRITE (iw, "(T2,A,I0)") "The number of traced issues for OpenMP : ", m_omp_trace_issues()
1377 END IF
1378 WRITE (iw, "(T2,A,I0)") "The number of warnings for this run is : ", warning_counter
1379 WRITE (iw, *) ""
1380 WRITE (unit=iw, fmt="(T2,A)") repeat("-", 79)
1381 END IF
1382
1383 ! Update the runtime environment variables
1384 CALL get_runtime_info()
1385
1386 ! Just a choice, do not print the CP2K footer if there is a failure
1387 CALL cp2k_footer(iw, wdir)
1388 IF (iw > 0) FLUSH (iw) ! ignore &GLOBAL / FLUSH_SHOULD_FLUSH
1389
1390 CALL cp_print_key_finished_output(iw, logger, root_section, &
1391 "GLOBAL%PROGRAM_RUN_INFO")
1392 END IF
1393
1394 ! Release message passing environment
1396
1397 END SUBROUTINE cp2k_finalize
1398
1399END MODULE environment
const char * get_data_dir()
Returns path of data directory if set, otherwise an empty string.
Definition cp_data_dir.c:18
Target architecture or instruction set extension according to compiler target flags.
Definition machine.F:102
Trace OpenMP constructs if ennvironment variable CP2K_OMP_TRACE=1.
Definition machine.F:113
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:16
character(len=default_string_length), public r_host_name
Definition cp2k_info.F:68
character(len= *), parameter, public cp2k_home
Definition cp2k_info.F:45
character(len= *), parameter, public compile_host
Definition cp2k_info.F:63
character(len= *), parameter, public compile_arch
Definition cp2k_info.F:51
integer, public r_pid
Definition cp2k_info.F:70
character(len= *), parameter, public compile_revision
Definition cp2k_info.F:39
character(len= *), parameter, public compile_date
Definition cp2k_info.F:57
character(len= *), parameter, public cp2k_year
Definition cp2k_info.F:44
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:81
character(len= *), parameter, public cp2k_version
Definition cp2k_info.F:43
subroutine, public get_runtime_info()
...
Definition cp2k_info.F:336
character(len=default_string_length), public r_user_name
Definition cp2k_info.F:68
Module that contains the routines for error handling.
integer, save, public warning_counter
Utility routines to open and close files. Tracking of preconnections.
Definition cp_files.F:16
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
Definition cp_files.F:311
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
Definition cp_files.F:122
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 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:84
integer, parameter, public fm_diag_type_cusolver
Definition cp_fm_diag.F:106
integer, parameter, public fm_diag_type_dlaf
Definition cp_fm_diag.F:106
integer, parameter, public fm_diag_type_scalapack
Definition cp_fm_diag.F:106
subroutine, public diag_finalize()
Finalize the diagonalization library.
Definition cp_fm_diag.F:221
integer, parameter, public fm_diag_type_elpa
Definition cp_fm_diag.F:106
integer, parameter, public cusolver_n_min
Definition cp_fm_diag.F:94
subroutine, public diag_init(diag_lib, fallback_applied, elpa_kernel, elpa_neigvec_min_input, elpa_qr, elpa_print, elpa_one_stage, dlaf_neigvec_min_input, eps_check_diag_input, direct_generalized_diagonalization_input)
Setup the diagonalization library to be used.
Definition cp_fm_diag.F:156
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)
...
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 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)
...
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
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 init_fft(fftlib, alltoall, fftsg_sizes, pool_limit, wisdom_file, plan_style)
...
Definition fft_tools.F:186
integer, parameter, public fwfft
Definition fft_tools.F:146
subroutine, public finalize_fft(para_env, wisdom_file)
does whatever is needed to finalize the current fft setup
Definition fft_tools.F:216
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_hip
Definition grid_api.F:69
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)
...
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)
...
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
logical, save, public flush_should_flush
Definition machine.F:121
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:423
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:522
pure integer function, public m_cpuid()
Target architecture or instruction set extension according to CPU-check at runtime.
Definition machine.F:200
pure integer function, public m_cpuid_vlen(cpuid, typesize)
Determine vector-length for a given CPUID.
Definition machine.F:289
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:341
subroutine, public m_cpuinfo(model_name)
reads /proc/cpuinfo if it exists (i.e. Linux) to return relevant info
Definition machine.F:167
pure character(len=default_string_length) function, public m_cpuid_name(cpuid)
Determine name of target architecture for a given CPUID.
Definition machine.F:245
subroutine, public m_omp_get_stacksize(omp_stacksize)
Retrieve environment variable OMP_STACKSIZE.
Definition machine.F:768
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:76
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:398
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:134
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.
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