30 cp_iteration_info_type,&
58 #include "../base/base_uses.f90"
63 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
64 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_output_handling'
113 LOGICAL,
PRIVATE,
SAVE :: enable_mpi_io = .false.
140 TYPE cp_out_flags_type
141 INTEGER :: ref_count = 0, n_flags = 0
142 CHARACTER(default_string_length),
DIMENSION(:),
POINTER :: names => null()
143 INTEGER,
DIMENSION(:),
POINTER :: control_val => null()
144 TYPE(section_vals_type),
POINTER :: input => null()
145 TYPE(cp_logger_type),
POINTER :: logger => null()
146 LOGICAL :: strict = .false.
147 INTEGER :: default_val = 0
148 END TYPE cp_out_flags_type
172 print_level, each_iter_names, each_iter_values, add_last, filename, &
173 common_iter_levels, citations, unit_str)
174 TYPE(section_type),
POINTER :: print_key_section
175 CHARACTER(len=*),
INTENT(IN) :: location, name, description
176 INTEGER,
INTENT(IN),
OPTIONAL :: print_level
177 CHARACTER(LEN=*),
DIMENSION(:),
INTENT(IN), &
178 OPTIONAL :: each_iter_names
179 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: each_iter_values
180 INTEGER,
INTENT(IN),
OPTIONAL :: add_last
181 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: filename
182 INTEGER,
INTENT(IN),
OPTIONAL :: common_iter_levels
183 INTEGER,
DIMENSION(:),
OPTIONAL :: citations
184 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: unit_str
186 CHARACTER(len=default_path_length) :: my_filename
187 INTEGER :: i_each, i_iter, my_add_last, &
188 my_comm_iter_levels, my_print_level, &
190 LOGICAL :: check, ext_each
191 TYPE(keyword_type),
POINTER :: keyword
192 TYPE(section_type),
POINTER :: subsection
194 cpassert(.NOT.
ASSOCIATED(print_key_section))
196 IF (
PRESENT(print_level)) my_print_level = print_level
198 CALL section_create(print_key_section, location=location, name=name, description=description, &
199 n_keywords=2, n_subsections=0, repeats=.false., &
202 NULLIFY (keyword, subsection)
203 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
204 description=
"Level starting at which this property is printed", &
207 enum_c_vals=s2a(
"on",
"off",
"silent",
"low",
"medium",
"high",
"debug"), &
214 CALL keyword_create(keyword, __location__, name=
"__CONTROL_VAL", &
215 description=
' hidden parameter that controls storage, printing,...'// &
216 ' of the print_key', &
222 description=
"This section specifies how often this property is printed. "// &
223 "Each keyword inside this section is mapping to a specific iteration level and "// &
224 "the value of each of these keywords is matched with the iteration level during "// &
225 "the calculation. How to handle the last iteration is treated "// &
226 "separately in ADD_LAST (this mean that each iteration level (MD, GEO_OPT, etc..), "// &
227 "though equal to 0, might print the last iteration). If an iteration level is specified "// &
228 "that is not present in the flow of the calculation it is just ignored.", &
229 n_keywords=2, n_subsections=0, repeats=.false., &
233 check = (
PRESENT(each_iter_names)) .EQV. (
PRESENT(each_iter_values))
235 ext_each = (
PRESENT(each_iter_names)) .AND. (
PRESENT(each_iter_values))
242 DO i_iter = 1,
SIZE(each_iter_names)
244 my_value = each_iter_values(i_iter)
251 default_i_val=my_value)
259 IF (
PRESENT(add_last))
THEN
260 my_add_last = add_last
263 description=
"If the last iteration should be added, and if it "// &
264 "should be marked symbolically (with lowercase letter l) or with "// &
265 "the iteration number. "// &
266 "Not every iteration level is able to identify the last iteration "// &
267 "early enough to be able to output. When this keyword is activated "// &
268 "all iteration levels are checked for the last iteration step.", &
269 usage=
"ADD_LAST (NO|NUMERIC|SYMBOLIC)", &
270 enum_c_vals=s2a(
"no",
"numeric",
"symbolic"), &
272 enum_desc=s2a(
"Do not mark last iteration specifically", &
273 "Mark last iteration with its iteration number", &
274 "Mark last iteration with lowercase letter l"), &
275 default_i_val=my_add_last)
279 my_comm_iter_levels = 0
280 IF (
PRESENT(common_iter_levels)) my_comm_iter_levels = common_iter_levels
281 CALL keyword_create(keyword, __location__, name=
"COMMON_ITERATION_LEVELS", &
282 description=
"How many iterations levels should be written"// &
283 " in the same file (no extra information about the actual"// &
284 " iteration level is written to the file)", &
285 usage=
"COMMON_ITERATION_LEVELS <INTEGER>", &
286 default_i_val=my_comm_iter_levels)
291 IF (
PRESENT(filename)) my_filename = filename
293 description=
' controls part of the filename for output. '// &
294 ' use __STD_OUT__ (exactly as written here) for the screen or standard logger. '// &
295 ' use filename to obtain projectname-filename. '// &
296 ' use ./filename to get filename.'// &
297 ' A middle name (if present), iteration numbers'// &
298 ' and extension are always added to the filename.'// &
299 ' if you want to avoid it use =filename, in this'// &
300 ' case the filename is always exactly as typed.'// &
301 ' Please note that this can lead to clashes of'// &
303 usage=
"FILENAME ./filename ", &
304 default_lc_val=my_filename)
308 CALL keyword_create(keyword, __location__, name=
"LOG_PRINT_KEY", &
309 description=
"This keywords enables the logger for the print_key (a message is printed on "// &
310 "screen everytime data, controlled by this print_key, are written)", &
311 usage=
"LOG_PRINT_KEY <LOGICAL>", default_l_val=.false., lone_keyword_l_val=.true.)
315 IF (
PRESENT(unit_str))
THEN
317 description=
'Specify the unit of measurement for the quantity in output. '// &
318 "All available CP2K units can be used.", &
319 usage=
"UNIT angstrom", default_c_val=trim(unit_str))
343 print_key_path, used_print_key, first_time) &
345 TYPE(cp_iteration_info_type),
INTENT(IN) :: iteration_info
346 TYPE(section_vals_type),
INTENT(IN),
TARGET :: basis_section
347 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: print_key_path
348 TYPE(section_vals_type),
INTENT(INOUT),
OPTIONAL, &
349 POINTER :: used_print_key
350 LOGICAL,
INTENT(OUT),
OPTIONAL :: first_time
353 INTEGER :: end_str, my_control_val, to_path
354 LOGICAL :: flags, is_iter, is_on
355 TYPE(section_vals_type),
POINTER :: print_key
358 IF (
PRESENT(first_time)) first_time = .false.
359 cpassert(basis_section%ref_count > 0)
360 IF (
PRESENT(used_print_key))
NULLIFY (used_print_key)
362 IF (
PRESENT(print_key_path))
THEN
363 end_str = len_trim(print_key_path)
364 to_path = index(print_key_path,
"/")
365 IF (to_path < 1)
THEN
366 to_path = end_str + 1
369 IF (to_path > 1)
THEN
371 print_key_path(1:(to_path - 1)))
373 print_key => basis_section
375 cpassert(
ASSOCIATED(print_key))
376 cpassert(print_key%ref_count > 0)
377 IF (to_path + 1 < end_str)
THEN
384 print_key => basis_section
387 IF (
PRESENT(used_print_key)) used_print_key => print_key
389 IF (.NOT. flags)
RETURN
392 i_val=my_control_val)
398 is_iter = cp_printkey_is_iter(iteration_info, print_key, first_time=first_time)
402 ELSE IF (btest(my_control_val,
cp_p_store_if) .AND. is_iter .AND. is_on)
THEN
408 IF (btest(my_control_val,
cp_p_file))
THEN
410 ELSE IF (btest(my_control_val,
cp_p_file_if) .AND. is_iter .AND. is_on)
THEN
412 ELSE IF (btest(my_control_val,
cp_p_file_each) .AND. is_iter)
THEN
415 IF (btest(my_control_val,
cp_p_calc) .OR. res /= 0)
THEN
429 TYPE(cp_iteration_info_type),
INTENT(IN) :: iteration_info
430 TYPE(section_vals_type),
POINTER :: print_key
433 INTEGER :: print_level
435 cpassert(iteration_info%ref_count > 0)
436 IF (.NOT.
ASSOCIATED(print_key))
THEN
439 cpassert(print_key%ref_count > 0)
441 res = iteration_info%print_level >= print_level
456 FUNCTION cp_printkey_is_iter(iteration_info, print_key, first_time) &
458 TYPE(cp_iteration_info_type),
INTENT(IN) :: iteration_info
459 TYPE(section_vals_type),
POINTER :: print_key
460 LOGICAL,
INTENT(OUT),
OPTIONAL :: first_time
463 INTEGER :: add_last, ilevel, iter_nr, ival
464 LOGICAL :: first, level_passed
466 cpassert(iteration_info%ref_count > 0)
467 IF (.NOT.
ASSOCIATED(print_key))
THEN
469 first = all(iteration_info%iteration(1:iteration_info%n_rlevel) == 1)
471 cpassert(print_key%ref_count > 0)
477 DO ilevel = 1, iteration_info%n_rlevel
478 level_passed = .false.
482 iter_nr = iteration_info%iteration(ilevel)
483 IF (iter_nr/ival > 1) first = .false.
484 IF (
modulo(iter_nr, ival) == 0)
THEN
485 level_passed = .true.
489 IF (iteration_info%last_iter(ilevel))
THEN
490 level_passed = .true.
493 IF (.NOT. level_passed) res = .false.
496 first = first .AND. res
497 IF (
PRESENT(first_time)) first_time = first
498 END FUNCTION cp_printkey_is_iter
517 TYPE(cp_iteration_info_type),
POINTER :: iter_info
518 TYPE(section_vals_type),
OPTIONAL,
POINTER :: print_key
519 LOGICAL,
INTENT(IN),
OPTIONAL :: for_file
520 CHARACTER(len=default_string_length) :: res
522 INTEGER :: add_last, c_i_level, ilevel, n_rlevel, &
524 LOGICAL :: my_for_file
525 TYPE(section_vals_type),
POINTER :: my_print_key
528 my_for_file = .false.
529 IF (
PRESENT(for_file)) my_for_file = for_file
530 cpassert(
ASSOCIATED(iter_info))
531 cpassert(iter_info%ref_count > 0)
532 NULLIFY (my_print_key)
533 IF (
PRESENT(print_key)) my_print_key => print_key
535 IF (
ASSOCIATED(my_print_key))
THEN
538 n_rlevel = iter_info%n_rlevel
539 IF (my_for_file) n_rlevel = min(n_rlevel, max(0, n_rlevel - c_i_level))
540 DO ilevel = s_level, n_rlevel
541 IF (iter_info%last_iter(ilevel))
THEN
543 WRITE (res(9*ilevel - 8:9*ilevel),
"('l_')")
545 WRITE (res(9*ilevel - 8:9*ilevel),
"(i8,'_')") iter_info%iteration(ilevel)
548 WRITE (res(9*ilevel - 8:9*ilevel),
"(i8,'_')") iter_info%iteration(ilevel)
552 DO ilevel = s_level, iter_info%n_rlevel
553 WRITE (res(9*ilevel - 8:9*ilevel),
"(i8,'_')") iter_info%iteration(ilevel)
557 IF (len_trim(res) > 0)
THEN
558 res(len_trim(res):len_trim(res)) =
" "
573 SUBROUTINE cp_iterate(iteration_info, last, iter_nr, increment, iter_nr_out)
574 TYPE(cp_iteration_info_type),
POINTER :: iteration_info
575 LOGICAL,
INTENT(IN),
OPTIONAL :: last
576 INTEGER,
INTENT(IN),
OPTIONAL :: iter_nr, increment
577 INTEGER,
INTENT(OUT),
OPTIONAL :: iter_nr_out
579 INTEGER :: my_increment
584 IF (
PRESENT(last)) my_last = last
585 IF (
PRESENT(increment)) my_increment = increment
586 IF (
PRESENT(iter_nr_out)) iter_nr_out = -1
588 cpassert(
ASSOCIATED(iteration_info))
589 cpassert(iteration_info%ref_count > 0)
590 IF (
PRESENT(iter_nr))
THEN
591 iteration_info%iteration(iteration_info%n_rlevel) = iter_nr
593 iteration_info%iteration(iteration_info%n_rlevel) = &
594 iteration_info%iteration(iteration_info%n_rlevel) + my_increment
597 IF (
PRESENT(iter_nr_out)) iter_nr_out = iteration_info%iteration(iteration_info%n_rlevel)
600 iteration_info%last_iter(iteration_info%n_rlevel) = my_last
612 TYPE(cp_iteration_info_type),
POINTER :: iteration_info
613 CHARACTER(LEN=*),
INTENT(IN) :: level_name
614 INTEGER,
INTENT(OUT),
OPTIONAL :: n_rlevel_new
619 cpassert(
ASSOCIATED(iteration_info))
620 cpassert(iteration_info%ref_count > 0)
630 iteration_info%n_rlevel = iteration_info%n_rlevel + 1
631 CALL reallocate(iteration_info%iteration, 1, iteration_info%n_rlevel)
632 CALL reallocate(iteration_info%level_name, 1, iteration_info%n_rlevel)
633 CALL reallocate(iteration_info%last_iter, 1, iteration_info%n_rlevel)
634 iteration_info%iteration(iteration_info%n_rlevel) = 0
635 iteration_info%level_name(iteration_info%n_rlevel) = level_name
636 iteration_info%last_iter(iteration_info%n_rlevel) = .false.
637 IF (
PRESENT(n_rlevel_new)) n_rlevel_new = iteration_info%n_rlevel
639 CALL cp_abort(__location__, &
640 "Trying to create an iteration level ("//trim(level_name)//
") not defined. "// &
641 "Please update the module: cp_iter_types.")
655 TYPE(cp_iteration_info_type),
POINTER :: iteration_info
656 CHARACTER(LEN=*),
INTENT(IN) :: level_name
657 INTEGER,
INTENT(IN),
OPTIONAL :: n_rlevel_att
661 cpassert(
ASSOCIATED(iteration_info))
662 cpassert(iteration_info%ref_count > 0)
663 IF (
PRESENT(n_rlevel_att))
THEN
664 cpassert(n_rlevel_att == iteration_info%n_rlevel)
669 check = iteration_info%level_name(iteration_info%n_rlevel) == level_name
671 iteration_info%n_rlevel = iteration_info%n_rlevel - 1
672 CALL reallocate(iteration_info%iteration, 1, iteration_info%n_rlevel)
673 CALL reallocate(iteration_info%level_name, 1, iteration_info%n_rlevel)
674 CALL reallocate(iteration_info%last_iter, 1, iteration_info%n_rlevel)
703 my_local)
RESULT(filename)
704 TYPE(cp_logger_type),
POINTER :: logger
705 TYPE(section_vals_type),
POINTER :: print_key
706 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: middle_name
707 CHARACTER(len=*),
INTENT(IN) :: extension
708 LOGICAL,
INTENT(IN) :: my_local
709 CHARACTER(len=default_path_length) :: filename
711 CHARACTER(len=default_path_length) :: outpath, postfix, root
712 CHARACTER(len=default_string_length) :: my_middle_name, outname
713 INTEGER :: my_ind1, my_ind2
717 IF (outpath(1:1) ==
'=')
THEN
718 cpassert(len(outpath) - 1 <= len(filename))
719 filename = outpath(2:)
722 IF (outpath ==
"__STD_OUT__") outpath =
""
725 my_ind1 = index(outpath,
"/")
726 my_ind2 = len_trim(outpath)
727 IF (my_ind1 /= 0)
THEN
729 DO WHILE (index(outpath(my_ind1 + 1:my_ind2),
"/") /= 0)
730 my_ind1 = index(outpath(my_ind1 + 1:my_ind2),
"/") + my_ind1
732 IF (my_ind1 == my_ind2)
THEN
735 outname = outpath(my_ind1 + 1:my_ind2)
739 IF (
PRESENT(middle_name))
THEN
740 IF (outname /=
"")
THEN
741 my_middle_name =
"-"//trim(outname)//
"-"//middle_name
743 my_middle_name =
"-"//middle_name
746 IF (outname /=
"")
THEN
747 my_middle_name =
"-"//trim(outname)
753 IF (.NOT. has_root)
THEN
754 root = trim(logger%iter_info%project_name)//trim(my_middle_name)
755 ELSE IF (outname ==
"")
THEN
756 root = outpath(1:my_ind1)//trim(logger%iter_info%project_name)//trim(my_middle_name)
758 root = outpath(1:my_ind1)//my_middle_name(2:len_trim(my_middle_name))
762 postfix =
"-"//trim(
cp_iter_string(logger%iter_info, print_key=print_key, for_file=.true.))
763 IF (trim(postfix) ==
"-") postfix =
""
766 postfix = trim(postfix)//extension
769 root=root, postfix=postfix, local=my_local)
800 middle_name, local, log_filename, ignore_should_output, file_form, file_position, &
801 file_action, file_status, do_backup, on_file, is_new_file, mpi_io, &
803 TYPE(cp_logger_type),
POINTER :: logger
804 TYPE(section_vals_type),
INTENT(IN) :: basis_section
805 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: print_key_path
806 CHARACTER(len=*),
INTENT(IN) :: extension
807 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: middle_name
808 LOGICAL,
INTENT(IN),
OPTIONAL :: local, log_filename, ignore_should_output
809 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: file_form, file_position, file_action, &
811 LOGICAL,
INTENT(IN),
OPTIONAL :: do_backup, on_file
812 LOGICAL,
INTENT(OUT),
OPTIONAL :: is_new_file
813 LOGICAL,
INTENT(INOUT),
OPTIONAL :: mpi_io
814 CHARACTER(len=default_path_length),
INTENT(OUT), &
818 CHARACTER(len=default_path_length) :: filename, filename_bak, filename_bak_1, &
820 CHARACTER(len=default_string_length) :: my_file_action, my_file_form, &
821 my_file_position, my_file_status, &
823 INTEGER :: c_i_level, f_backup_level, i, mpi_amode, &
824 my_backup_level, my_nbak, nbak, &
825 s_backup_level, unit_nr
826 LOGICAL :: do_log, found, my_do_backup, my_local, &
827 my_mpi_io, my_on_file, &
828 my_should_output, replace
829 TYPE(cp_iteration_info_type),
POINTER :: iteration_info
830 TYPE(mp_file_type) :: mp_unit
831 TYPE(section_vals_type),
POINTER :: print_key
834 my_do_backup = .false.
839 my_file_form =
"FORMATTED"
840 my_file_position =
"APPEND"
841 my_file_action =
"WRITE"
842 my_file_status =
"UNKNOWN"
845 IF (
PRESENT(file_form)) my_file_form = file_form
846 IF (
PRESENT(file_position)) my_file_position = file_position
847 IF (
PRESENT(file_action)) my_file_action = file_action
848 IF (
PRESENT(file_status)) my_file_status = file_status
849 IF (
PRESENT(do_backup)) my_do_backup = do_backup
850 IF (
PRESENT(on_file)) my_on_file = on_file
851 IF (
PRESENT(local)) my_local = local
852 IF (
PRESENT(is_new_file)) is_new_file = .false.
853 IF (
PRESENT(mpi_io))
THEN
854 #if defined(__parallel)
855 IF (
cp_mpi_io_get() .AND. logger%para_env%num_pe > 1 .AND. mpi_io)
THEN
862 trim(my_file_action), trim(my_file_status), trim(my_file_position))
863 replace = replace .AND. logger%para_env%is_source()
872 cpassert(
ASSOCIATED(logger))
873 cpassert(basis_section%ref_count > 0)
874 cpassert(logger%ref_count > 0)
876 basis_section, print_key_path, used_print_key=print_key),
cp_p_file)
877 IF (
PRESENT(ignore_should_output)) my_should_output = my_should_output .OR. ignore_should_output
878 IF (.NOT. my_should_output)
RETURN
880 logger%para_env%is_source() .OR. &
884 IF (outpath ==
'__STD_OUT__' .AND. .NOT. my_on_file)
THEN
896 IF (
PRESENT(is_new_file))
THEN
897 INQUIRE (file=filename, exist=found)
898 is_new_file = .NOT. found
899 IF (my_file_position ==
"REWIND") is_new_file = .true.
903 IF (
PRESENT(log_filename))
THEN
904 do_log = log_filename
909 IF (my_do_backup)
THEN
910 INQUIRE (file=filename, exist=found)
913 iteration_info => logger%iter_info
915 IF (
ASSOCIATED(print_key%ibackup)) s_backup_level =
SIZE(print_key%ibackup)
917 my_backup_level = max(1, iteration_info%n_rlevel - c_i_level + 1)
918 f_backup_level = max(s_backup_level, my_backup_level)
919 IF (f_backup_level > s_backup_level)
THEN
920 CALL reallocate(print_key%ibackup, 1, f_backup_level)
921 DO i = s_backup_level + 1, f_backup_level
922 print_key%ibackup(i) = 0
926 print_key%ibackup(my_backup_level) = print_key%ibackup(my_backup_level) + 1
927 my_nbak = print_key%ibackup(my_backup_level)
929 DO i = min(nbak, my_nbak), 2, -1
930 filename_bak_1 = trim(filename)//
".bak-"//adjustl(cp_to_string(i))
931 filename_bak_2 = trim(filename)//
".bak-"//adjustl(cp_to_string(i - 1))
935 WRITE (unit_nr, *)
"Moving file "//trim(filename_bak_2)// &
936 " into file "//trim(filename_bak_1)//
"."
938 INQUIRE (file=filename_bak_2, exist=found)
939 IF (.NOT. found)
THEN
943 WRITE (unit_nr, *)
"File "//trim(filename_bak_2)//
" not existing.."
946 CALL m_mov(trim(filename_bak_2), trim(filename_bak_1))
950 filename_bak = trim(filename)//
".bak-"//adjustl(cp_to_string(1))
954 WRITE (unit_nr, *)
"Moving file "//trim(filename)//
" into file "//trim(filename_bak)//
"."
956 CALL m_mov(trim(filename), trim(filename_bak))
959 print_key%ibackup(my_backup_level) = 0
964 IF (.NOT. my_mpi_io)
THEN
965 CALL open_file(file_name=filename, file_status=my_file_status, &
966 file_form=my_file_form, file_action=my_file_action, &
967 file_position=my_file_position, unit_number=res)
970 CALL mp_unit%open(groupid=logger%para_env, &
971 filepath=filename, amode_status=mpi_amode)
972 IF (
PRESENT(fout)) fout = filename
973 res = mp_unit%get_handle()
978 WRITE (unit_nr, *)
"Writing "//trim(print_key%section%name)//
" "// &
1011 print_key_path, local, ignore_should_output, on_file, &
1013 INTEGER,
INTENT(INOUT) :: unit_nr
1014 TYPE(cp_logger_type),
POINTER :: logger
1015 TYPE(section_vals_type),
INTENT(IN) :: basis_section
1016 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: print_key_path
1017 LOGICAL,
INTENT(IN),
OPTIONAL :: local, ignore_should_output, on_file, &
1020 CHARACTER(len=default_string_length) :: outpath
1021 LOGICAL :: my_local, my_mpi_io, my_on_file, &
1023 TYPE(mp_file_type) :: mp_unit
1024 TYPE(section_vals_type),
POINTER :: print_key
1027 my_on_file = .false.
1030 IF (
PRESENT(local)) my_local = local
1031 IF (
PRESENT(on_file)) my_on_file = on_file
1032 IF (
PRESENT(mpi_io)) my_mpi_io = mpi_io
1033 cpassert(
ASSOCIATED(logger))
1034 cpassert(basis_section%ref_count > 0)
1035 cpassert(logger%ref_count > 0)
1037 print_key_path, used_print_key=print_key),
cp_p_file)
1038 IF (
PRESENT(ignore_should_output)) my_should_output = my_should_output .OR. ignore_should_output
1039 IF (my_should_output .AND. (my_local .OR. &
1040 logger%para_env%is_source() .OR. &
1043 IF (my_on_file .OR. outpath .NE.
'__STD_OUT__')
THEN
1044 cpassert(unit_nr > 0)
1045 IF (.NOT. my_mpi_io)
THEN
1048 CALL mp_unit%set_handle(unit_nr)
1049 CALL mp_unit%close()
1056 cpassert(unit_nr == -1)
1068 LOGICAL,
INTENT(IN) :: flag
1070 enable_mpi_io = flag
1083 flag = enable_mpi_io
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Utility routines to open and close files. Tracking of preconnections.
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.
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.
Collection of routines to handle the iteration info.
character(len=default_path_length), dimension(18), parameter, public each_possible_labels
subroutine, public cp_iteration_info_retain(iteration_info)
retains the iteration_info (see doc/ReferenceCounting.html)
subroutine, public cp_iteration_info_release(iteration_info)
releases the iteration_info (see doc/ReferenceCounting.html)
character(len=default_path_length), dimension(18), parameter, public each_desc_labels
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
integer function, public cp_logger_get_unit_nr(logger, local)
returns the unit nr for the requested kind of log.
subroutine, public cp_logger_generate_filename(logger, res, root, postfix, local)
generates a unique filename (ie adding eventual suffixes and process ids)
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public cp_out_calc
integer, parameter, public cp_out_file_each
integer, parameter, public cp_p_store_each
character(len=default_string_length) function, public cp_iter_string(iter_info, print_key, for_file)
returns the iteration string, a string that is useful to create unique filenames (once you trim it)
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 cp_out_default
integer, parameter, public cp_out_store_if
integer, parameter, public debug_print_level
integer, parameter, public cp_out_store_each
integer, parameter, public cp_p_calc
integer, parameter, public cp_p_store_if
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 cp_out_file_if
integer, parameter, public cp_out_store
integer, parameter, public low_print_level
integer, parameter, public medium_print_level
character(len=default_path_length) function, public cp_print_key_generate_filename(logger, print_key, middle_name, extension, my_local)
Utility function that returns a unit number to write the print key. Might open a file with a unique f...
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 cp_p_file
integer, parameter, public cp_out_none
integer, parameter, public high_print_level
logical function, public cp_mpi_io_get()
Gets flag which determines whether or not to use MPI I/O for I/O routines that have been parallized w...
logical function, public cp_printkey_is_on(iteration_info, print_key)
returns true if the printlevel activates this printkey does not look if this iteration it should be p...
subroutine, public cp_iterate(iteration_info, last, iter_nr, increment, iter_nr_out)
adds one to the actual iteration
integer, parameter, public add_last_symbolic
integer, parameter, public cp_p_file_if
subroutine, public cp_rm_iter_level(iteration_info, level_name, n_rlevel_att)
Removes an iteration level.
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
integer, parameter, public add_last_numeric
integer, parameter, public silent_print_level
integer, parameter, public cp_out_file
integer, parameter, public cp_p_file_each
integer, parameter, public cp_p_store
integer, parameter, public add_last_no
subroutine, public cp_print_key_section_create(print_key_section, location, name, description, print_level, each_iter_names, each_iter_values, add_last, filename, common_iter_levels, citations, unit_str)
creates a print_key section
subroutine, public cp_add_iter_level(iteration_info, level_name, n_rlevel_new)
Adds an iteration level.
Defines the basic variable types.
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_mov(source, TARGET)
...
Utility routines for the memory handling.
Interface to the message passing library MPI.
subroutine, public mp_file_delete(filepath, info)
Deletes a file. Auxiliary routine to emulate 'replace' action for mp_file_open. Only the master proce...
subroutine, public mp_file_get_amode(mpi_io, replace, amode, form, action, status, position)
(parallel) Utility routine to determine MPI file access mode based on variables
Utilities for string manipulations.
subroutine, public compress(string, full)
Eliminate multiple space characters in a string. If full is .TRUE., then all spaces are eliminated.