Displays the total CPU time summary. Pass an array of CLOCK variables to clks. This is intended to be called at the end of the program. Specify the output unit number in unit. If unit is not given, output goes to standard output.
718 implicit none
719 type(CLOCK), intent(in):: clks(:)
720 integer, intent(in), optional:: unit
721 logical, intent(in), optional:: total_auto
722 type(CLOCK), intent(in), optional:: clk_total
723 logical, intent(out), optional:: err
724 character(*), intent(in), optional:: total_name
725 integer:: out_unit, i, clks_size, ra
726 character(20):: clk_name
727 integer:: name_len
728 character(STRING):: cause_c
729 character(STRING):: total_name_work
730 type(CLOCK):: clk_auto_total
731 logical:: total_print_complete
732 real(DP):: elapsed_time_val_cor
733 integer:: stat
734 character(*), parameter:: total_time_mes = ' TOTAL TIME = '
735 integer:: myrank_mpi, nprocs_mpi
736 character(*), parameter:: subname = 'DCClockResult'
737 continue
738 call beginsub(subname)
740 cause_c = 'CLOCK'
741 clks_size = size(clks)
742 do i = 1, clks_size
743 if (.not. clks(i) % initialized) then
744 call messagenotify(
'W', subname,
'Call Create before Result in dc_clock.')
745 call dbgmessage('Ignored because input argument was not initialized.')
747 goto 999
748 end if
749 end do
750 if (present(unit)) then
751 out_unit = unit
752 else
754 end if
755 if (present(total_name)) then
756 total_name_work = ' (' // trim(total_name) // ')'
757 else
758 total_name_work = ''
759 end if
760 myrank_mpi = -1
761 nprocs_mpi = 1
762 do ra = 0, nprocs_mpi - 1
764 if ( myrank_mpi < 0 ) then
766 & ' ############## CPU TIME SUMMARY%c################', &
767 & c1=trim(total_name_work) // ' ')
768 else
770 & ' ####### CPU TIME SUMMARY%c#### [rank=%06d] ####', &
771 & c1=trim(total_name_work) // ' ', &
772 & i = (/myrank_mpi/) )
773 end if
774 do i = 1, clks_size
775 clk_name = ''
776 name_len = min(len(clk_name), len_trim(clks(i) % name))
777 if (name_len > 0) then
778 clk_name(1:name_len) = clks(i) % name(1:name_len)
779 end if
780 elapsed_time_val_cor = clks(i) % elapsed_time
781 if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
783 & ' %c%c %c', c1=clk_name, &
784 & c2=trim(result_value_form(elapsed_time_val_cor)), &
785 & c3=trim(fit_unit_value(clks(i) % elapsed_time)))
786 end do
787 total_print_complete = .false.
788 if (present(clk_total)) then
789 if (clk_total % initialized) then
791 & ' ------------------------------------------------')
792 elapsed_time_val_cor = clk_total % elapsed_time
793 if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
795 & ' %c%c %c', c1=total_time_mes, &
796 & c2=trim(result_value_form(elapsed_time_val_cor)), &
797 & c3=trim(fit_unit_value(clk_total % elapsed_time)))
798 total_print_complete = .true.
799 end if
800 end if
801 if (present(total_auto) .and. .not. total_print_complete) then
802 if (total_auto) then
803 clk_auto_total = clks(1)
804 if (clks_size > 1) then
805 do i = 2, clks_size
806 clk_auto_total = clk_auto_total + clks(i)
807 end do
808 end if
810 & ' ------------------------------------------------')
811 elapsed_time_val_cor = clk_auto_total % elapsed_time
812 if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
814 & ' %c%c %c', c1=total_time_mes, &
815 & c2=trim(result_value_form(elapsed_time_val_cor)), &
816 & c3=trim(fit_unit_value(clk_auto_total % elapsed_time)))
817 end if
818 end if
819 call dbgmessage('total results, output to device number %d', &
820 & i=(/out_unit/))
821 end do
822999 continue
824 call endsub(subname)
Date and time manipulation module.
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_noerr
Error storage variables
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
Handling character types.
Provides kind type parameter values.
integer, parameter, public stdout
Unit number for Standard OUTPUT
integer, parameter, public dp
Double Precision Real number
integer, parameter, public string
Character length for string