dc_clock::dcclockresult Interface Reference

Private Member Functions

subroutine dcclockresult0 (clks, unit, total_auto, clk_total, total_name, err)
 

Detailed Description

Definition at line 159 of file dc_clock.f90.

Member Function/Subroutine Documentation

◆ dcclockresult0()

subroutine dc_clock::dcclockresult::dcclockresult0 ( type(clock), dimension(:), intent(in)  clks,
integer, intent(in), optional  unit,
logical, intent(in), optional  total_auto,
type(clock), intent(in), optional  clk_total,
character(*), intent(in), optional  total_name,
logical, intent(out), optional  err 
)
private

Definition at line 535 of file dc_clock.f90.

535  !
536  !=== CPU 時間の総計を表示
537  !
538  ! CPU 時間の総計を表示します. *clks* へ, CLOCK 変数の配列を
539  ! 与えてください. プログラムの最後で呼び出されることを
540  ! 想定しています. *unit* には出力先の装置番号を
541  ! 与えてください. *unit* を与えない場合, 標準出力へ表示されます.
542  !
543  ! 引数 *total_auto* に .true. を与えると, *clks* を全て足し合わせた
544  ! 合計値を自動的に表示します. 下記の引数 *clk_total* が与えられている
545  ! 場合は *clk_total* が優先されます.
546  !
547  ! 引数 *clk_total* に CLOCK 変数を与えると, この変数を合計値と
548  ! して表示します.
549  !
550  ! 引数 *total_name* に文字型変数を与えると, 総計メッセージの
551  ! 冒頭にこの文字列を出力します.
552  !
553  ! 第一引数 *clk* に対して DCClockCreate による初期化が行われていない場合,
554  ! エラーを発生させます. *err* を与える場合には *err* に .true. が返り,
555  ! プログラムは続行されます.
556  !
557  use dc_types, only: stdout, string, dp
558  use dc_message, only: messagenotify
559  use dc_string, only: printf, tochar, cprintf
560  use dc_date, only: evalsec
562  implicit none
563  type(clock), intent(in):: clks(:)
564  integer, intent(in), optional:: unit
565  logical, intent(in), optional:: total_auto
566  type(clock), intent(in), optional:: clk_total
567  logical, intent(out), optional:: err
568  character(*), intent(in), optional:: total_name
569  integer:: out_unit, i, clks_size, ra
570  character(20):: clk_name
571  character(STRING):: cause_c
572  character(STRING):: total_name_work
573  type(clock):: clk_auto_total
574  logical:: total_print_complete
575  real(DP):: elapsed_time_val_cor
576  integer:: stat
577  character(*), parameter:: total_time_mes = ' TOTAL TIME = '
578  integer:: myrank_mpi, nprocs_mpi
579  character(*), parameter:: subname = 'DCClockResult'
580  continue
581  call beginsub(subname)
582  stat = dc_noerr
583  cause_c = 'CLOCK'
584  clks_size = size(clks)
585  do i = 1, clks_size
586  if (.not. clks(i) % initialized) then
587  call messagenotify('W', subname, 'Call Create before Result in dc_clock.')
588  call dbgmessage('Ignored because input argument was not initialized.')
589  stat = dc_enotinit
590  goto 999
591  end if
592  end do
593  if (present(unit)) then
594  out_unit = unit
595  else
596  out_unit = stdout
597  end if
598  if (present(total_name)) then
599  total_name_work = ' (' // trim(total_name) // ')'
600  else
601  total_name_work = ''
602  end if
603  myrank_mpi = -1
604  nprocs_mpi = 1
605  do ra = 0, nprocs_mpi - 1
606  call printf(out_unit, '')
607  if ( myrank_mpi < 0 ) then
608  call printf(out_unit, &
609  & ' ############## CPU TIME SUMMARY%c################', &
610  & c1=trim(total_name_work) // ' ')
611  else
612  call printf(out_unit, &
613  & ' ####### CPU TIME SUMMARY%c#### [rank=%06d] ####', &
614  & c1=trim(total_name_work) // ' ', &
615  & i = (/myrank_mpi/) )
616  end if
617  do i = 1, clks_size
618  clk_name = clks(i) % name
619  elapsed_time_val_cor = clks(i) % elapsed_time
620  if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
621  call printf(out_unit, &
622  & ' %c%c %c', c1=clk_name, &
623  & c2=trim(result_value_form(elapsed_time_val_cor)), &
624  & c3=trim(fit_unit_value(clks(i) % elapsed_time)))
625  end do
626  total_print_complete = .false.
627  if (present(clk_total)) then
628  if (clk_total % initialized) then
629  call printf(out_unit, &
630  & ' ------------------------------------------------')
631  elapsed_time_val_cor = clk_total % elapsed_time
632  if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
633  call printf(out_unit, &
634  & ' %c%c %c', c1=total_time_mes, &
635  & c2=trim(result_value_form(elapsed_time_val_cor)), &
636  & c3=trim(fit_unit_value(clk_total % elapsed_time)))
637  total_print_complete = .true.
638  end if
639  end if
640  if (present(total_auto) .and. .not. total_print_complete) then
641  if (total_auto) then
642  clk_auto_total = clks(1)
643  if (clks_size > 1) then
644  do i = 2, clks_size
645  clk_auto_total = clk_auto_total + clks(i)
646  end do
647  end if
648  call printf(out_unit, &
649  & ' ------------------------------------------------')
650  elapsed_time_val_cor = clk_auto_total % elapsed_time
651  if (elapsed_time_val_cor < 0.0_dp) elapsed_time_val_cor = 0.0_dp
652  call printf(out_unit, &
653  & ' %c%c %c', c1=total_time_mes, &
654  & c2=trim(result_value_form(elapsed_time_val_cor)), &
655  & c3=trim(fit_unit_value(clk_auto_total % elapsed_time)))
656  end if
657  end if
658  call dbgmessage('total results, output to device number %d', &
659  & i=(/out_unit/))
660  end do
661 999 continue
662  call storeerror(stat, subname, err, cause_c)
663  call endsub(subname)
integer, parameter, public dc_enotinit
Definition: dc_error.f90:557
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition: dc_error.f90:830
integer, parameter, public dc_noerr
Definition: dc_error.f90:509
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
integer, parameter, public stdout
標準出力の装置番号
Definition: dc_types.f90:98
文字型変数の操作.
Definition: dc_string.f90:24
種別型パラメタを提供します。
Definition: dc_types.f90:49
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118

The documentation for this interface was generated from the following file: