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