gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dc_clock::dcclockpredict Interface Reference

Public Member Functions

subroutine dcclockpredict0 (clk, progress, unit, err)
 

Detailed Description

Definition at line 164 of file dc_clock.f90.

Member Function/Subroutine Documentation

◆ dcclockpredict0()

subroutine dc_clock::dcclockpredict::dcclockpredict0 ( type(clock), intent(in)  clk,
real, intent(in)  progress,
integer, intent(in), optional  unit,
logical, intent(out), optional  err 
)

Display predicted CPU time and completion date

From CLOCK variable clk and progress, displays predicted CPU time and completion date as follows:

########## PREDICTION OF CALCULATION ###########
start date 2007-03-08t16:49:25+09:00
current date 2007-03-08t16:49:27+09:00
progress 66.67% [**************** ]
remaining cpu time 0.100000e+01
completion date 2007-03-08t16:49:28+09:00

Give progress a value from 0 to 1. 0 is program start, 1 is end. (For example, give 0.5 when the program is half done.)

Note: The "prediction" is calculated by a simple algorithm from elapsed time and progress, so it is not an accurate prediction. Use as a guide only.

Specify the output unit number in unit. If unit is not given, output goes to standard output.

If clk has not been initialized by DCClockCreate, an error is raised. If err is provided, .true. is returned in err and the program continues.

Parameters
[in]clkCLOCK type variable
[in]progressProgress value (0.0 to 1.0)
[in]unitOutput unit number (optional). Default: standard output.
[out]errError flag (optional). .true. if error occurred.

Definition at line 1137 of file dc_clock.f90.

1138 use dc_types, only: stdout, dp
1139 use dc_message, only: messagenotify
1140 use dc_string, only: tochar, cprintf, printf
1143 use dc_date, only: operator(+), dcdatetimecreate, tochar, evalsec, &
1144 & dcdifftimecreate
1145 implicit none
1146 type(CLOCK), intent(in):: clk
1147 real, intent(in):: progress
1148 integer, intent(in), optional:: unit
1149 logical, intent(out), optional:: err
1150 character(STRING):: cause_c
1151 integer:: stat, out_unit
1152 type(DC_DIFFTIME):: remain_diff
1153 type(DC_DATETIME):: comp_date, cur_date
1154 character(7):: prog_percent
1155 character(25):: prog_bar
1156 integer:: prog_bar_ptr
1157 real:: prog_valid
1158 logical:: initflag_mpi
1159 integer:: err_mpi, myrank_mpi
1160 character(*), parameter:: subname = 'DCClockPredict'
1161 continue
1162 call beginsub(subname)
1163 stat = dc_noerr
1164 cause_c = 'CLOCK'
1165 if (.not. clk % initialized) then
1166 call messagenotify('W', subname, 'Call Create before Predict in dc_clock.')
1167 call dbgmessage('Ignored because input argument was not initialized.')
1168 stat = dc_enotinit
1169 goto 999
1170 end if
1171 if (progress <= 0.0) then
1172 call messagenotify('W', subname, 'Specify 0.0 -- 1.0 value to "progress"')
1173 return
1174 elseif (progress > 1.0) then
1175 call messagenotify('W', subname, 'Over 1.0 value to "progress" was modified to 1.0')
1176 prog_valid = 1.0
1177 else
1178 prog_valid = progress
1179 end if
1180 if (present(unit)) then
1181 out_unit = unit
1182 else
1183 out_unit = stdout
1184 end if
1185 call dcdifftimecreate( remain_diff, &
1186 & sec = real(nint(evalsec(clk) / prog_valid * (1.0 - prog_valid)), dp) )
1187 call dcdatetimecreate(cur_date)
1188 comp_date = cur_date + remain_diff
1189 prog_percent = ''
1190 prog_percent = adjustr(trim(printf_g5_2(real(prog_valid * 100, dp))) // '%')
1191 prog_bar = ''
1192 prog_bar_ptr = int(prog_valid * 25)
1193 if (prog_bar_ptr > 0) prog_bar(1:prog_bar_ptr) = '*************************'
1194 call mpi_initialized(initflag_mpi, err_mpi)
1195 if ( initflag_mpi ) then
1196 call mpi_comm_rank(mpi_comm_world, myrank_mpi, err_mpi)
1197 if ( myrank_mpi /= 0 ) goto 999
1198 end if
1199 call printf(out_unit, '')
1200 call printf(out_unit, &
1201 & ' ########## PREDICTION OF CALCULATION ###########')
1202 call printf(out_unit, &
1203 & ' Start Date %c', c1=trim(tochar(clk % start_date)))
1204 call printf(out_unit, &
1205 & ' Current Date %c', c1=trim(tochar(cur_date)))
1206 call printf(out_unit, &
1207 & ' Progress %c [%c]', c1=prog_percent, c2=prog_bar)
1208 call printf(out_unit, &
1209 & ' Remaining CPU TIME %c %c', &
1210 & c1=trim(result_value_form(evalsec(remain_diff))), &
1211 & c2=trim(fit_unit_value(0.0_dp, remain_diff)))
1212 call printf(out_unit, &
1213 & ' Completion Date %c', c1=trim(tochar(comp_date)))
1214999 continue
1215 call storeerror(stat, subname, err, cause_c)
1216 call endsub(subname)
Derived types and parameters for date and time.
Date and time manipulation module.
Definition dc_date.f90:57
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
Definition dc_error.f90:534
Message output module.
Handling character types.
Definition dc_string.f90:83
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public stdout
Unit number for Standard OUTPUT
Definition dc_types.f90:117
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_enotinit, dc_error::dc_noerr, dc_types::dp, dc_trace::endsub(), dc_types::stdout, and dc_error::storeerror().

Here is the call graph for this function:

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