722 implicit none
723 type(CLOCK), intent(in):: clks(:)
724 integer, intent(in), optional:: unit
725 logical, intent(in), optional:: total_auto
726 type(CLOCK), intent(in), optional:: clk_total
727 logical, intent(out), optional:: err
728 character(*), intent(in), optional:: total_name
729 integer:: out_unit, i, clks_size, ra
730 character(20):: clk_name
731 integer:: name_len
732 character(STRING):: cause_c
733 character(STRING):: total_name_work
734 type(CLOCK):: clk_auto_total
735 logical:: total_print_complete
736 real(DP):: elapsed_time_val_cor
737 integer:: stat
738 character(*), parameter:: total_time_mes = ' TOTAL TIME = '
739 logical:: initflag_mpi
740 integer:: err_mpi
741 integer:: myrank_mpi, nprocs_mpi
742 character(*), parameter:: subname = 'DCClockResult'
743 continue
744 call beginsub(subname)
746 cause_c = 'CLOCK'
747 clks_size = size(clks)
748 do i = 1, clks_size
749 if (.not. clks(i) % initialized) then
750 call messagenotify(
'W', subname,
'Call Create before Result in dc_clock.')
751 call dbgmessage('Ignored because input argument was not initialized.')
753 goto 999
754 end if
755 end do
756 if (present(unit)) then
757 out_unit = unit
758 else
760 end if
761 if (present(total_name)) then
762 total_name_work = ' (' // trim(total_name) // ')'
763 else
764 total_name_work = ''
765 end if
766 myrank_mpi = -1
767 nprocs_mpi = 1
768 call mpi_initialized(initflag_mpi, err_mpi)
769 if ( initflag_mpi ) then
770 call mpi_comm_rank(mpi_comm_world, myrank_mpi, err_mpi)
771 call mpi_comm_size(mpi_comm_world, nprocs_mpi, err_mpi)
772 end if
773 do ra = 0, nprocs_mpi - 1
774 if ( initflag_mpi ) call mpi_barrier(mpi_comm_world, err_mpi)
775 if ( myrank_mpi > -1 .and. ra /= myrank_mpi ) cycle
777 if ( myrank_mpi < 0 ) then
779 & ' ############## CPU TIME SUMMARY%c################', &
780 & c1=trim(total_name_work) // ' ')
781 else
783 & ' ####### CPU TIME SUMMARY%c#### [rank=%06d] ####', &
784 & c1=trim(total_name_work) // ' ', &
785 & i = (/myrank_mpi/) )
786 end if
787 do i = 1, clks_size
788 clk_name = ''
789 name_len = min(len(clk_name), len_trim(clks(i) % name))
790 if (name_len > 0) then
791 clk_name(1:name_len) = clks(i) % name(1:name_len)
792 end if
793 elapsed_time_val_cor = clks(i) % elapsed_time
794 if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
796 & ' %c%c %c', c1=clk_name, &
797 & c2=trim(result_value_form(elapsed_time_val_cor)), &
798 & c3=trim(fit_unit_value(clks(i) % elapsed_time)))
799 end do
800 total_print_complete = .false.
801 if (present(clk_total)) then
802 if (clk_total % initialized) then
804 & ' ------------------------------------------------')
805 elapsed_time_val_cor = clk_total % elapsed_time
806 if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
808 & ' %c%c %c', c1=total_time_mes, &
809 & c2=trim(result_value_form(elapsed_time_val_cor)), &
810 & c3=trim(fit_unit_value(clk_total % elapsed_time)))
811 total_print_complete = .true.
812 end if
813 end if
814 if (present(total_auto) .and. .not. total_print_complete) then
815 if (total_auto) then
816 clk_auto_total = clks(1)
817 if (clks_size > 1) then
818 do i = 2, clks_size
819 clk_auto_total = clk_auto_total + clks(i)
820 end do
821 end if
823 & ' ------------------------------------------------')
824 elapsed_time_val_cor = clk_auto_total % elapsed_time
825 if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
827 & ' %c%c %c', c1=total_time_mes, &
828 & c2=trim(result_value_form(elapsed_time_val_cor)), &
829 & c3=trim(fit_unit_value(clk_auto_total % elapsed_time)))
830 end if
831 end if
832 call dbgmessage('total results, output to device number %d', &
833 & i=(/out_unit/))
834 end do
835999 continue
837 call endsub(subname)
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_enotinit
-400 以下: dc ユーティリティのエラー
integer, parameter, public dc_noerr
エラー等を保持
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
integer, parameter, public stdout
標準出力の装置番号
integer, parameter, public dp
倍精度実数型変数