gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
dc_clock.f90
Go to the documentation of this file.
1! -*- mode: f90; coding: utf-8 -*-
2!-----------------------------------------------------------------------
3! Copyright (c) 2006-2026 Gtool Development Group. All rights reserved.
4!-----------------------------------------------------------------------
5!>
6!> @author Yasuhiro MORIKAWA
7!> @copyright Copyright (C) GFD Dennou Club, 2006-2026. All rights reserved. <br/>
8!> License is BSD-2-Clause. see [COPYRIGHT](@ref COPYRIGHT) in detail
9!>
10!> @en
11!> @brief Monitor of CPU TIME
12!> @details
13!> Measures and displays the CPU time consumed by program processing.
14!>
15!> @section dc_clock_procedures Procedures List
16!>
17!> | Procedure | Description |
18!> |-----------------|--------------------------------------------------|
19!> | DCClockCreate | Initialize CLOCK type variable |
20!> | DCClockStart | Start measurement |
21!> | DCClockStop | Pause measurement |
22!> | DCClockClose | Finalize CLOCK type variable |
23!> | DCClockGet | Get CPU time (in seconds) |
24!> | DCClockEvalSec | Get CPU time (in seconds) as function |
25!> | DCClockToChar | Convert CPU time to formatted string |
26!> | DCClockPutLine | Display CLOCK variable information |
27!> | DCClockResult | Display comprehensive CPU time information |
28!> | DCClockPredict | Display predicted CPU time and date to completion|
29!> | DCClockSetName | Reset name |
30!> | operator(+) | Addition (between CLOCK types) |
31!> | operator(-) | Subtraction (between CLOCK types) |
32!>
33!> @section dc_clock_usage Usage
34!>
35!> First, define a CLOCK type variable and initialize it with DCClockCreate.
36!> Call DCClockStart at the measurement start point in your program,
37!> and call DCClockStop at the point to pause measurement.
38!> Display elapsed time with DCClockResult.
39!> Use DCClockPredict to display estimated remaining CPU time.
40!>
41!> @note CPU time measurement uses the *cpu_time* intrinsic subroutine
42!> (introduced in Fortran 95). Whether the measured CPU time is system
43!> CPU time, user CPU time, or the sum of both depends on the implementation.
44!>
45!> @enden
46!>
47!> @ja
48!> @brief CPU 時間の計測
49!> @details
50!> プログラムの処理に要した CPU 時間を計測して表示します。
51!>
52!> @section dc_clock_procedures_ja 手続一覧
53!>
54!> | 手続名 | 説明 |
55!> |-----------------|--------------------------------------------------|
56!> | DCClockCreate | CLOCK 型変数の初期設定 |
57!> | DCClockStart | 計測の開始 |
58!> | DCClockStop | 計測の一時停止 |
59!> | DCClockClose | 構造型 CLOCK 変数の終了処理 |
60!> | DCClockGet | CPU 時間 (単位: 秒) の取得 |
61!> | DCClockEvalSec | CPU 時間 (単位: 秒) の取得 (関数) |
62!> | DCClockToChar | CPU 時間を適当に整形して文字型変数に変換 |
63!> | DCClockPutLine | 構造型 CLOCK 変数の情報を表示 |
64!> | DCClockResult | CPU 時間に関する総合的な情報を表示 |
65!> | DCClockPredict | プログラム終了までの予測 CPU 時間・日時を表示 |
66!> | DCClockSetName | 名称の再設定 |
67!> | operator(+) | 加算 (CLOCK 型同士) |
68!> | operator(-) | 減算 (CLOCK 型同士) |
69!>
70!> @section dc_clock_usage_ja 使用方法
71!>
72!> 始めに、構造型 CLOCK の変数を定義し、DCClockCreate で初期化します。
73!> プログラム中の計測開始地点で DCClockStart を呼び出し、
74!> 計測を一時停止する地点で DCClockStop を呼び出します。
75!> DCClockResult によって経過時間を表示します。
76!> DCClockPredict を使用することでプログラム終了までの残り CPU 時間
77!> の予測値を表示することが可能です。
78!>
79!> @note CPU 時間の計測に *cpu_time* サブルーチン (Fortran 95 規格で導入)
80!> を使用しているため、計測された CPU 時間がシステム CPU 時間なのか
81!> ユーザ CPU 時間なのか、もしくは両方の合計なのかは処理系に依存します。
82!>
83!> @endja
84!>
86 use dc_types, only: string, dp
89 ! MPI ライブラリ
90 ! MPI library
91 !
92 use mpi
93 implicit none
94 private
95 public:: clock
98 public:: operator(+), operator(-)
100 !-----------------------------------------------
101 ! 後方互換用
102 ! For backward compatibility
103 public:: create, Close, start, stop, putline, result, set_name
104 public:: get, evalsec, tochar, predict
105 !> @en
106 !> @brief Structure for CPU time measurement
107 !> @details
108 !> Use Create for initialization and Close for finalization.
109 !> See dc_clock Usage for detailed usage.
110 !> @enden
111 !>
112 !> @ja
113 !> @brief CPU 時刻計測用の構造体
114 !> @details
115 !> 初期化には Create を、終了処理には Close を用います。
116 !> 詳しい使い方は dc_clock の Usage を参照ください。
117 !> @endja
118 type clock
119 private
120 character(STRING):: name
121 real(dp):: start_time ! 計測を開始した時間
122 ! (計測の一時停止中には負の値が設定される)
123 real(dp):: elapsed_time ! 経過時間の累計値
124 type(dc_datetime):: start_date ! 計測を開始した日時
125 logical:: initialized = .false. ! CLOCK 構造体の初期化チェック用フラグ
126 end type clock
128 module procedure dcclockcreate0
129 end interface
130 interface dcclockclose
131 module procedure dcclockclose0
132 end interface
133 interface dcclockstart
134 module procedure dcclockstart0
135 end interface
136 interface dcclockstop
137 module procedure dcclockstop0
138 end interface
140 module procedure dcclockputline0
141 end interface
142 interface dcclockget
143 module procedure dcclockgetr
144 module procedure dcclockgetd
145 end interface
147 module procedure dcclockevalsecd
148 end interface
150 module procedure dcclocktochar0
151 end interface
153 module procedure dcclockresult0
154 end interface
155 interface operator(+)
156 module procedure dcclockadd
157 end interface
158 interface operator(-)
159 module procedure dcclocksubtract
160 end interface
162 module procedure dcclocksetname0
163 end interface
165 module procedure dcclockpredict0
166 end interface
167 !-----------------------------------------------
168 ! 後方互換用
169 ! For backward compatibility
170 interface create
171 module procedure dcclockcreate0
172 end interface
173 interface close
174 module procedure dcclockclose0
175 end interface
176 interface start
177 module procedure dcclockstart0
178 end interface
179 interface stop
180 module procedure dcclockstop0
181 end interface
182 interface putline
183 module procedure dcclockputline0
184 end interface
185 interface get
186 module procedure dcclockgetr
187 module procedure dcclockgetd
188 end interface
189 interface evalsec
190 module procedure dcclockevalsecd
191 end interface
192 interface tochar
193 module procedure dcclocktochar0
194 end interface
195 interface result
196 module procedure dcclockresult0
197 end interface
198 interface set_name
199 module procedure dcclocksetname0
200 end interface
201 interface predict
202 module procedure dcclockpredict0
203 end interface
204 character(*), parameter:: version = &
205 & '$Name: $' // &
206 & '$Id: dc_clock.F90,v 1.1 2009-03-20 09:09:53 morikawa Exp $'
207contains
208 !> @en
209 !> @brief Initialize CLOCK variable
210 !> @details
211 !> Initialize a CLOCK type variable before using it.
212 !> Give the measurement content to `name`.
213 !>
214 !> @param[out] clk CLOCK type variable to initialize
215 !> @param[in] name Name of measurement content
216 !> @enden
217 !>
218 !> @ja
219 !> @brief CLOCK の初期化用サブルーチン
220 !> @details
221 !> CLOCK 型の変数を利用する際にはまずこのサブルーチンによって
222 !> 初期化を行ってください。`name` には計測内容を与えてください。
223 !>
224 !> @param[out] clk 初期化する CLOCK 型変数
225 !> @param[in] name 計測内容の名称
226 !> @endja
227 subroutine dcclockcreate0(clk, name)
228 use dc_message, only: messagenotify
229 use dc_date, only: dcdatetimecreate
230 implicit none
231 type(clock), intent(out):: clk
232 character(*), intent(in):: name
233 character(*), parameter:: subname = 'DCClockCreate'
234 continue
235 call beginsub(subname, 'name=%c', c1=trim(name), version=version)
236 if (clk % initialized) then
237 call messagenotify('W', subname, 'This argument (type CLOCK) is already initialized.')
238 call dbgmessage('already initialized')
239 goto 999
240 end if
241 clk % name = name
242 clk % elapsed_time = 0.0
243 clk % start_time = - 1.0
244 clk % initialized = .true.
245 call dcdatetimecreate(clk % start_date)
246 call dbgmessage('normal initialized')
247999 continue
248 call endsub(subname)
249 end subroutine dcclockcreate0
250 !> @en
251 !> @brief Close CLOCK variable
252 !> @details
253 !> Closes a CLOCK type variable.
254 !>
255 !> @param[in,out] clk CLOCK type variable to close
256 !> @enden
257 !>
258 !> @ja
259 !> @brief CLOCK の終了サブルーチン
260 !> @details
261 !> CLOCK 型の変数をクローズします。
262 !>
263 !> @param[in,out] clk クローズする CLOCK 型変数
264 !> @endja
265 subroutine dcclockclose0(clk)
266 implicit none
267 type(clock), intent(inout):: clk
268 character(*), parameter:: subname = 'DCClockClose'
269 continue
270 call beginsub(subname)
271 if (clk % initialized) then
272 clk % initialized = .false.
273 clk % name = ''
274 end if
275 call endsub(subname)
276 end subroutine dcclockclose0
277 !> @en
278 !> @brief Start measurement
279 !> @details
280 !> Starts measurement at the point this subroutine is called.
281 !>
282 !> If `clk` has not been initialized by DCClockCreate, an error is raised.
283 !> If `err` is provided, .true. is returned in `err` and the program continues.
284 !>
285 !> @param[in,out] clk CLOCK type variable
286 !> @param[out] err Error flag (optional). .true. if error occurred.
287 !> @enden
288 !>
289 !> @ja
290 !> @brief 計測の開始
291 !> @details
292 !> このサブルーチンを呼んだ時点で計測を開始します。
293 !>
294 !> `clk` に対して DCClockCreate による初期化が行われていない場合、
295 !> エラーを発生させます。`err` を与える場合には `err` に .true. が返り、
296 !> プログラムは続行されます。
297 !>
298 !> @param[in,out] clk CLOCK 型変数
299 !> @param[out] err エラーフラグ (省略可)。エラー時に .true.。
300 !> @endja
301 subroutine dcclockstart0(clk, err)
302 use dc_message, only: messagenotify
303 use dc_string, only: tochar
305 use dc_date, only: evalsec
306 !$ use omp_lib
307 implicit none
308 type(clock), intent(inout):: clk
309 logical, intent(out), optional:: err
310 character(STRING):: cause_c
311 integer:: stat
312 character(*), parameter:: subname = 'DCClockStart'
313 continue
314 call beginsub(subname)
315 stat = dc_noerr
316 cause_c = 'CLOCK'
317 if (.not. clk % initialized) then
318 call messagenotify('W', subname, 'Call Create before Start in dc_clock.')
319 call dbgmessage('Ignored because input argument was not initialized.')
320 stat = dc_enotinit
321 goto 999
322 end if
323 call cpu_time(clk % start_time) ! (out)
324 !$ clk % start_time = omp_get_wtime()
325 call dbgmessage('name=%c, cpu_time=%f', &
326 & c1=trim(clk % name), d=(/clk % start_time/) )
327999 continue
328 call storeerror(stat, subname, err, cause_c)
329 call endsub(subname)
330 end subroutine dcclockstart0
331 !> @en
332 !> @brief Pause measurement
333 !> @details
334 !> Pauses measurement at the point this subroutine is called.
335 !>
336 !> If `clk` has not been initialized by DCClockCreate, an error is raised.
337 !> If `err` is provided, .true. is returned in `err` and the program continues.
338 !>
339 !> @param[in,out] clk CLOCK type variable
340 !> @param[out] err Error flag (optional). .true. if error occurred.
341 !> @enden
342 !>
343 !> @ja
344 !> @brief 計測の一時停止
345 !> @details
346 !> このサブルーチンを呼んだ時点で計測を一時停止します。
347 !>
348 !> `clk` に対して DCClockCreate による初期化が行われていない場合、
349 !> エラーを発生させます。`err` を与える場合には `err` に .true. が返り、
350 !> プログラムは続行されます。
351 !>
352 !> @param[in,out] clk CLOCK 型変数
353 !> @param[out] err エラーフラグ (省略可)。エラー時に .true.。
354 !> @endja
355 subroutine dcclockstop0(clk, err)
356 use dc_message, only: messagenotify
357 use dc_string, only: tochar
359 use dc_date, only: evalsec, operator(+), operator(-)
360 use dc_date_types, only: dc_difftime
361 use dc_types, only: dp
362 !$ use omp_lib
363 implicit none
364 type(clock), intent(inout):: clk
365 logical, intent(out), optional:: err
366 character(STRING):: cause_c
367 real(DP):: stop_time
368 integer:: stat
369 character(*), parameter:: subname = 'DCClockStop'
370 continue
371 call beginsub(subname)
372 stat = dc_noerr
373 cause_c = 'CLOCK'
374 if (.not. clk % initialized) then
375 call messagenotify('W', subname, 'Call Create before Stop in dc_clock.')
376 call dbgmessage('Ignored because input argument was not initialized.')
377 stat = dc_enotinit
378 goto 999
379 elseif (clk % start_time < 0.0_dp) then
380 call messagenotify('W', subname, 'Call Start before Stop in dc_clock.')
381 call dbgmessage('Ignored because input argument was not started.')
382 goto 999
383 end if
384 call cpu_time(stop_time)
385 !$ stop_time = omp_get_wtime()
386 clk % elapsed_time = clk % elapsed_time + stop_time - clk % start_time
387 clk % start_time = - 1.0
388 call dbgmessage('name=%c, cpu_time=%f, elapsed_time=%f', &
389 & c1=trim(clk % name), d=(/stop_time, clk % elapsed_time/))
390999 continue
391 call storeerror(stat, subname, err, cause_c)
392 call endsub(subname)
393 end subroutine dcclockstop0
394 !> @en
395 !> @brief Get CPU time (in seconds) - single precision
396 !> @details
397 !> Gets CPU time (in seconds) to `sec`.
398 !>
399 !> If `clk` has not been initialized by DCClockCreate, an error is raised.
400 !> If `err` is provided, .true. is returned in `err` and the program continues.
401 !>
402 !> @param[in] clk CLOCK type variable
403 !> @param[out] sec CPU time in seconds (single precision)
404 !> @param[out] err Error flag (optional). .true. if error occurred.
405 !> @enden
406 !>
407 !> @ja
408 !> @brief CPU 時間 (単位: 秒) の取得 (単精度)
409 !> @details
410 !> CPU 時間 (単位: 秒) を `sec` に取得します。
411 !>
412 !> `clk` に対して DCClockCreate による初期化が行われていない場合、
413 !> エラーを発生させます。`err` を与える場合には `err` に .true. が返り、
414 !> プログラムは続行されます。
415 !>
416 !> @param[in] clk CLOCK 型変数
417 !> @param[out] sec CPU 時間 (秒、単精度)
418 !> @param[out] err エラーフラグ (省略可)。エラー時に .true.。
419 !> @endja
420 subroutine dcclockgetr(clk, sec, err) !:doc-priority 40:
421 use dc_message, only: messagenotify
422 use dc_date, only: evalsec
423 use dc_string, only: cprintft
425 implicit none
426 type(clock), intent(in):: clk
427 real, intent(out):: sec
428 logical, intent(out), optional:: err
429 character(STRING):: cause_c
430 integer:: stat
431 character(*), parameter:: subname = 'DCClockGetR'
432 continue
433 call beginsub(subname)
434 stat = dc_noerr
435 cause_c = 'CLOCK'
436 if (.not. clk % initialized) then
437 call messagenotify('W', subname, 'Call Create before Get in dc_clock.')
438 call dbgmessage('Ignored because input argument was not initialized.')
439 stat = dc_enotinit
440 goto 999
441 end if
442 sec = real(clk % elapsed_time, kind=kind(sec))
443 call dbgmessage('name=%c, return sec=<%r>', &
444 & c1=trim(clk % name), r=(/sec/))
445999 continue
446 call storeerror(stat, subname, err, cause_c)
447 call endsub(subname)
448 end subroutine dcclockgetr
449 !> @en
450 !> @brief Get CPU time (in seconds) - double precision
451 !> @details
452 !> Gets CPU time (in seconds) to `sec`.
453 !>
454 !> If `clk` has not been initialized by DCClockCreate, an error is raised.
455 !> If `err` is provided, .true. is returned in `err` and the program continues.
456 !>
457 !> @param[in] clk CLOCK type variable
458 !> @param[out] sec CPU time in seconds (double precision)
459 !> @param[out] err Error flag (optional). .true. if error occurred.
460 !> @enden
461 !>
462 !> @ja
463 !> @brief CPU 時間 (単位: 秒) の取得 (倍精度)
464 !> @details
465 !> CPU 時間 (単位: 秒) を `sec` に取得します。
466 !>
467 !> `clk` に対して DCClockCreate による初期化が行われていない場合、
468 !> エラーを発生させます。`err` を与える場合には `err` に .true. が返り、
469 !> プログラムは続行されます。
470 !>
471 !> @param[in] clk CLOCK 型変数
472 !> @param[out] sec CPU 時間 (秒、倍精度)
473 !> @param[out] err エラーフラグ (省略可)。エラー時に .true.。
474 !> @endja
475 subroutine dcclockgetd(clk, sec, err) !:doc-priority 60:
476 use dc_types, only: dp
477 use dc_string, only: cprintf
478 use dc_message, only: messagenotify
479 use dc_date, only: evalsec
481 implicit none
482 type(clock), intent(in):: clk
483 real(DP), intent(out):: sec
484 logical, intent(out), optional:: err
485 character(STRING):: cause_c
486 integer:: stat
487 character(*), parameter:: subname = 'DCClockGetD'
488 continue
489 call beginsub(subname)
490 stat = dc_noerr
491 cause_c = 'CLOCK'
492 if (.not. clk % initialized) then
493 call messagenotify('W', subname, 'Call Create before Get in dc_clock.')
494 call dbgmessage('Ignored because input argument was not initialized.')
495 stat = dc_enotinit
496 goto 999
497 end if
498 sec = clk % elapsed_time
499 call dbgmessage('name=%c, return sec=<%f>', &
500 & c1=trim(clk % name), d=(/sec/))
501999 continue
502 call storeerror(stat, subname, err, cause_c)
503 call endsub(subname)
504 end subroutine dcclockgetd
505 !> @en
506 !> @brief Get CPU time (in seconds) as function
507 !> @details
508 !> Returns CPU time (in seconds).
509 !> If `clk` has not been initialized by DCClockCreate, -1.0 is returned.
510 !>
511 !> @param[in] clk CLOCK type variable
512 !> @return CPU time in seconds (double precision). -1.0 if not initialized.
513 !> @enden
514 !>
515 !> @ja
516 !> @brief CPU 時間 (単位: 秒) の取得 (関数)
517 !> @details
518 !> CPU 時間 (単位: 秒) を返します。
519 !> `clk` に対して DCClockCreate による初期化が行われていない場合、
520 !> -1.0 が返ります。
521 !>
522 !> @param[in] clk CLOCK 型変数
523 !> @return CPU 時間 (秒、倍精度)。初期化されていない場合は -1.0。
524 !> @endja
525 function dcclockevalsecd(clk) result(result)
526 use dc_types, only: dp
527 implicit none
528 type(clock), intent(in):: clk
529 real(dp):: result
530 logical:: err
531 continue
532 call dcclockgetd(clk, result, err)
533 if (err) result = -1.0_dp
534 end function dcclockevalsecd
535 !> @en
536 !> @brief Convert CPU time to formatted string
537 !> @details
538 !> Formats CPU time appropriately and returns it as a character variable.
539 !> If `clk` has not been initialized by DCClockCreate, an empty string is returned.
540 !>
541 !> @param[in] clk CLOCK type variable
542 !> @return Formatted string of CPU time
543 !> @enden
544 !>
545 !> @ja
546 !> @brief CPU 時間を適当に整形して文字型変数に変換
547 !> @details
548 !> CPU 時間に関して適当に整形を行い、文字型変数に変換して返します。
549 !> `clk` に対して DCClockCreate による初期化が行われていない場合、
550 !> 空文字が返ります。
551 !>
552 !> @param[in] clk CLOCK 型変数
553 !> @return 整形された CPU 時間の文字列
554 !> @endja
555 function dcclocktochar0(clk) result(result)
556 use dc_string, only: cprintf
557 use dc_date, only: evalsec
558 implicit none
559 type(clock), intent(in):: clk
560 character(STRING):: result
561 character(20):: clk_name
562 integer:: name_len
563 continue
564 clk_name = ''
565 name_len = min(len(clk_name), len_trim(clk % name))
566 if (name_len > 0) then
567 clk_name(1:name_len) = clk % name(1:name_len)
568 end if
569 if (clk % initialized) then
570 result = cprintf(' %c%c %c', c1 = clk_name, &
571 & c2=trim(result_value_form(clk % elapsed_time)), &
572 & c3=trim(fit_unit_value(clk % elapsed_time)))
573 else
574 result = ''
575 end if
576 end function dcclocktochar0
577 !> @en
578 !> @brief Display CLOCK variable information
579 !> @details
580 !> Displays information about a CLOCK type variable.
581 !> Specify the output unit number in `unit`. If `unit` is not given,
582 !> output goes to standard output.
583 !>
584 !> If `clk` has not been initialized by DCClockCreate, an error is raised.
585 !> If `err` is provided, .true. is returned in `err` and the program continues.
586 !>
587 !> @param[in] clk CLOCK type variable
588 !> @param[in] unit Output unit number (optional). Default: standard output.
589 !> @param[in] indent Indent of displayed messages (optional)
590 !> @param[out] err Error flag (optional). .true. if error occurred.
591 !> @enden
592 !>
593 !> @ja
594 !> @brief 構造型 CLOCK 変数の情報を表示
595 !> @details
596 !> 構造型 CLOCK 変数に関する情報を表示します。`unit` には出力先の装置番号を
597 !> 与えてください。`unit` を与えない場合、標準出力へ表示されます。
598 !>
599 !> `clk` に対して DCClockCreate による初期化が行われていない場合、
600 !> エラーを発生させます。`err` を与える場合には `err` に .true. が返り、
601 !> プログラムは続行されます。
602 !>
603 !> @param[in] clk CLOCK 型変数
604 !> @param[in] unit 出力先装置番号 (省略可)。デフォルト: 標準出力。
605 !> @param[in] indent 表示されるメッセージの字下げ (省略可)
606 !> @param[out] err エラーフラグ (省略可)。エラー時に .true.。
607 !> @endja
608 subroutine dcclockputline0(clk, unit, indent, err)
609 use dc_types, only: stdout
610 use dc_message, only: messagenotify
611 use dc_string, only: printf, tochar, cprintf
612 use dc_date, only: evalsec, evalday, tochar
614 use dc_types, only: dp
615 implicit none
616 type(clock), intent(in):: clk
617 integer, intent(in), optional:: unit
618 character(*), intent(in), optional:: indent
619 logical, intent(out), optional:: err
620 integer:: out_unit
621 character(STRING):: cause_c
622 integer:: stat
623 integer:: indent_len
624 character(STRING):: indent_str
625 character(*), parameter:: subname = 'DCClockPutLine'
626 continue
627 call beginsub(subname)
628 stat = dc_noerr
629 cause_c = 'CLOCK'
630 if (.not. clk % initialized) then
631 call messagenotify('W', subname, 'Call Create before PutLine in dc_clock.')
632 call dbgmessage('Ignored because input argument was not initialized.')
633 stat = dc_enotinit
634 goto 999
635 end if
636 if (present(unit)) then
637 out_unit = unit
638 else
639 out_unit = stdout
640 end if
641 indent_len = 0
642 indent_str = ''
643 if (present(indent)) then
644 if (len(indent) /= 0) then
645 indent_len = len(indent)
646 indent_str(1:indent_len) = indent
647 end if
648 end if
649 call printf(out_unit, &
650 & indent_str(1:indent_len) // &
651 & '#<CLOCK:: @name=%c @clocking=%y @elapsed_time=%f sec. %c @start_date=%c>', &
652 & c1=trim(clk % name), l=(/clk % start_time > 0.0_dp/), &
653 & d=(/clk % elapsed_time/), &
654 & c2=trim(fit_unit_value(clk % elapsed_time)), &
655 & c3=trim(tochar(clk % start_date)))
656 call dbgmessage('name=%c, output to device number %d', &
657 & c1=trim(clk % name), i=(/out_unit/))
658999 continue
659 call storeerror(stat, subname, err, cause_c)
660 call endsub(subname)
661 end subroutine dcclockputline0
662 !> @en
663 !> @brief Display CPU time summary
664 !> @details
665 !> Displays the total CPU time summary. Pass an array of CLOCK variables to `clks`.
666 !> This is intended to be called at the end of the program.
667 !> Specify the output unit number in `unit`. If `unit` is not given,
668 !> output goes to standard output.
669 !>
670 !> If `total_auto` is .true., the sum of all `clks` is automatically displayed.
671 !> If `clk_total` is given, it takes precedence.
672 !>
673 !> If `clk_total` is given, this CLOCK variable is displayed as the total.
674 !>
675 !> If `total_name` is given, this string is output at the beginning of the summary.
676 !>
677 !> If any `clk` in `clks` has not been initialized by DCClockCreate, an error is raised.
678 !> If `err` is provided, .true. is returned in `err` and the program continues.
679 !>
680 !> @param[in] clks Array of CLOCK type variables
681 !> @param[in] unit Output unit number (optional). Default: standard output.
682 !> @param[in] total_auto If .true., automatically display sum of all clks (optional)
683 !> @param[in] clk_total CLOCK variable to display as total (optional)
684 !> @param[in] total_name String to output at the beginning of summary (optional)
685 !> @param[out] err Error flag (optional). .true. if error occurred.
686 !> @enden
687 !>
688 !> @ja
689 !> @brief CPU 時間の総計を表示
690 !> @details
691 !> CPU 時間の総計を表示します。`clks` へ CLOCK 変数の配列を与えてください。
692 !> プログラムの最後で呼び出されることを想定しています。
693 !> `unit` には出力先の装置番号を与えてください。
694 !> `unit` を与えない場合、標準出力へ表示されます。
695 !>
696 !> `total_auto` に .true. を与えると、`clks` を全て足し合わせた
697 !> 合計値を自動的に表示します。`clk_total` が与えられている場合は
698 !> `clk_total` が優先されます。
699 !>
700 !> `clk_total` に CLOCK 変数を与えると、この変数を合計値として表示します。
701 !>
702 !> `total_name` に文字型変数を与えると、総計メッセージの冒頭に
703 !> この文字列を出力します。
704 !>
705 !> `clks` 内の `clk` に対して DCClockCreate による初期化が行われていない場合、
706 !> エラーを発生させます。`err` を与える場合には `err` に .true. が返り、
707 !> プログラムは続行されます。
708 !>
709 !> @param[in] clks CLOCK 型変数の配列
710 !> @param[in] unit 出力先装置番号 (省略可)。デフォルト: 標準出力。
711 !> @param[in] total_auto .true. の場合、全 clks の合計を自動表示 (省略可)
712 !> @param[in] clk_total 合計として表示する CLOCK 変数 (省略可)
713 !> @param[in] total_name 総計メッセージ冒頭に出力する文字列 (省略可)
714 !> @param[out] err エラーフラグ (省略可)。エラー時に .true.。
715 !> @endja
716 subroutine dcclockresult0(clks, unit, total_auto, clk_total, total_name, err)
717 use dc_types, only: stdout, string, dp
718 use dc_message, only: messagenotify
719 use dc_string, only: printf, tochar, cprintf
720 use dc_date, only: evalsec
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)
745 stat = dc_noerr
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.')
752 stat = dc_enotinit
753 goto 999
754 end if
755 end do
756 if (present(unit)) then
757 out_unit = unit
758 else
759 out_unit = stdout
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
776 call printf(out_unit, '')
777 if ( myrank_mpi < 0 ) then
778 call printf(out_unit, &
779 & ' ############## CPU TIME SUMMARY%c################', &
780 & c1=trim(total_name_work) // ' ')
781 else
782 call printf(out_unit, &
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
795 call printf(out_unit, &
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
803 call printf(out_unit, &
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
807 call printf(out_unit, &
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
822 call printf(out_unit, &
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
826 call printf(out_unit, &
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
836 call storeerror(stat, subname, err, cause_c)
837 call endsub(subname)
838 end subroutine dcclockresult0
839 !> @brief Format double precision value to exponential notation string
840 !> @param[in] value Double precision value to format
841 !> @return Formatted string (e.g., "0.183400E+02")
842 function result_value_form(value) result(result)
843 use dc_types, only: dp, token
844 implicit none
845 character(TOKEN):: result
846 real(DP), intent(in):: value
847 continue
848 write(result, "(e15.6)") value
849 end function result_value_form
850 !> @brief Format seconds to appropriate unit string
851 !> @details
852 !> Treats the value given to `sec` as seconds and formats it as:
853 !> "(23.18 days)". The unit is chosen from days, hrs., minutes
854 !> (chosen so the value is >= 1). Returns empty string if < 1 minute.
855 !> @param[in] sec Seconds value
856 !> @param[in] diff DC_DIFFTIME to use directly (optional)
857 !> @return Formatted string (e.g., "(23.18 days)")
858 function fit_unit_value(sec, diff) result(result)
859 use dc_types, only: dp, token
860 use dc_date_types, only: dc_difftime
861 use dc_date, only: dcdifftimecreate, evalday, evalhour, evalmin, evalsec
862 implicit none
863 character(TOKEN):: result
864 real(DP), intent(in):: sec
865 type(dc_difftime), intent(in), optional:: diff
866 type(dc_difftime):: diffw
867 character(TOKEN):: unit
868 real(DP):: value
869 character(TOKEN):: cval
870 continue
871 if ( present(diff) ) then
872 diffw = diff
873 else
874 call dcdifftimecreate( diffw, sec = sec )
875 end if
876 if (evalday(diffw) > 1.0_dp) then
877 unit = ' days'
878 value = evalday(diffw)
879 elseif (evalhour(diffw) > 1.0_dp) then
880 unit = ' hrs.'
881 value = evalhour(diffw)
882 elseif (evalmin(diffw) > 1.0_dp) then
883 unit = ' minutes'
884 value = evalmin(diffw)
885 else
886 result = ''
887 return
888 end if
889 cval = printf_g5_2(value)
890 result = '(' // trim(adjustl(cval)) // trim(unit) // ')'
891 end function fit_unit_value
892 !> @brief Format numeric value with 2 decimal places
893 !> @details
894 !> Formats the value given as: "23.18" or "0.23"
895 !> @param[in] value Numeric value to format
896 !> @return Formatted string
897 function printf_g5_2(value) result(result)
898 use dc_types, only: dp, token
899 use dc_string, only: cprintft
900 implicit none
901 character(TOKEN):: result
902 real(DP), intent(in):: value
903 character(TOKEN):: int_part, dem_part
904 integer:: dem_int
905 continue
906 write(int_part, "(i20)") int(value)
907 dem_int = nint((value - int(value)) * 100)
908 if (dem_int < 0) dem_int = - dem_int
909 if (dem_int == 100) then
910 dem_int = 0
911 write(int_part, "(i20)") int(value) + 1
912 end if
913 dem_part = cprintft('%02d', i=(/dem_int/))
914 result = trim(adjustl(int_part)) // '.' // trim(dem_part)
915 end function printf_g5_2
916 !> @en
917 !> @brief Add CLOCK variables
918 !> @details
919 !> Adds CLOCK variables `clk1` and `clk2`.
920 !> Sums the CPU times of the two given CLOCK variables and returns as CLOCK.
921 !> The name of the result is a combination of `clk1` and `clk2` names joined by '+'.
922 !>
923 !> @param[in] clk1 First CLOCK variable
924 !> @param[in] clk2 Second CLOCK variable
925 !> @return Sum of the two CLOCK variables
926 !> @enden
927 !>
928 !> @ja
929 !> @brief CLOCK 変数を足し合わせる
930 !> @details
931 !> CLOCK 変数 `clk1` と `clk2` を足し合わせます。
932 !> 与えられた 2 つの CLOCK 変数の CPU 時間を合計し、
933 !> CLOCK 変数として返します。計測内容の名称は `clk1` と `clk2`
934 !> の名称を '+' で組み合わせたものとなります。
935 !>
936 !> @param[in] clk1 1つ目の CLOCK 変数
937 !> @param[in] clk2 2つ目の CLOCK 変数
938 !> @return 2 つの CLOCK 変数の合計
939 !> @endja
940 function dcclockadd(clk1, clk2) result(clk_total)
941 use dc_string, only: cprintf
942 use dc_date, only: operator(+), operator(<)
943 implicit none
944 type(clock), intent(in):: clk1
945 type(clock), intent(in):: clk2
946 type(clock):: clk_total
947 continue
948 if (.not. clk1 % initialized .or. .not. clk2 % initialized) then
949 clk_total % initialized = .false.
950 return
951 end if
952 clk_total % name = cprintf('%c+%c', &
953 & c1=trim(clk1 % name), c2=trim(clk2 % name))
954 clk_total % start_time = - 1.0
955 clk_total % initialized = .true.
956 clk_total % elapsed_time = 0.0
957 if (clk1 % start_date < clk2 % start_date) then
958 clk_total % start_date = clk1 % start_date
959 else
960 clk_total % start_date = clk2 % start_date
961 end if
962 clk_total % elapsed_time = &
963 & clk1 % elapsed_time + clk2 % elapsed_time
964 end function dcclockadd
965 !> @en
966 !> @brief Subtract CLOCK variables
967 !> @details
968 !> Subtracts `clk2` from CLOCK variable `clk1`.
969 !> Returns the difference between the CPU times of the two CLOCK variables.
970 !> The name of the result is a combination of `clk1` and `clk2` names joined by '-'.
971 !>
972 !> @param[in] clk1 First CLOCK variable (minuend)
973 !> @param[in] clk2 Second CLOCK variable (subtrahend)
974 !> @return Difference of the two CLOCK variables
975 !> @enden
976 !>
977 !> @ja
978 !> @brief CLOCK 変数を引き算する
979 !> @details
980 !> CLOCK 変数 `clk1` から `clk2` を引きます。
981 !> 1 つ目の CLOCK 変数の CPU 時間と 2 つ目の CLOCK 変数の CPU 時間との差を
982 !> CLOCK 変数として返します。計測内容の名称は `clk1` と `clk2`
983 !> の名称を '-' で組み合わせたものとなります。
984 !>
985 !> @param[in] clk1 1つ目の CLOCK 変数 (被減数)
986 !> @param[in] clk2 2つ目の CLOCK 変数 (減数)
987 !> @return 2 つの CLOCK 変数の差
988 !> @endja
989 function dcclocksubtract(clk1, clk2) result(clk_total)
990 use dc_string, only: cprintf
991 use dc_date, only: operator(-), operator(<)
992 implicit none
993 type(clock), intent(in):: clk1
994 type(clock), intent(in):: clk2
995 type(clock):: clk_total
996 continue
997 if (.not. clk1 % initialized .or. .not. clk2 % initialized) then
998 clk_total % initialized = .false.
999 return
1000 end if
1001 clk_total % name = cprintf('%c-%c', &
1002 & c1=trim(clk1 % name), c2=trim(clk2 % name))
1003 clk_total % start_time = - 1.0
1004 clk_total % initialized = .true.
1005 clk_total % elapsed_time = 0.0
1006 if (clk1 % start_date < clk2 % start_date) then
1007 clk_total % start_date = clk1 % start_date
1008 else
1009 clk_total % start_date = clk2 % start_date
1010 end if
1011 clk_total % elapsed_time = &
1012 & clk1 % elapsed_time - clk2 % elapsed_time
1013 end function dcclocksubtract
1014 !> @en
1015 !> @brief Change the measurement name
1016 !> @details
1017 !> Changes the measurement name of CLOCK variable `clk`.
1018 !> This name was originally specified by the `name` argument in Create.
1019 !>
1020 !> If `clk` has not been initialized by DCClockCreate, an error is raised.
1021 !> If `err` is provided, .true. is returned in `err` and the program continues.
1022 !>
1023 !> @param[in,out] clk CLOCK type variable
1024 !> @param[in] name New measurement name
1025 !> @param[out] err Error flag (optional). .true. if error occurred.
1026 !> @enden
1027 !>
1028 !> @ja
1029 !> @brief 測定内容の名称を変更する
1030 !> @details
1031 !> CLOCK 変数 `clk` の計測内容の名称を変更します。
1032 !> この名称は Create の `name` 引数で指定されたものです。
1033 !>
1034 !> `clk` に対して DCClockCreate による初期化が行われていない場合、
1035 !> エラーを発生させます。`err` を与える場合には `err` に .true. が返り、
1036 !> プログラムは続行されます。
1037 !>
1038 !> @param[in,out] clk CLOCK 型変数
1039 !> @param[in] name 新しい計測内容の名称
1040 !> @param[out] err エラーフラグ (省略可)。エラー時に .true.。
1041 !> @endja
1042 subroutine dcclocksetname0(clk, name, err)
1043 use dc_message, only: messagenotify
1044 use dc_string, only: tochar, cprintf
1046 implicit none
1047 type(clock), intent(inout):: clk
1048 character(*), intent(in):: name
1049 logical, intent(out), optional:: err
1050 character(STRING):: cause_c
1051 integer:: stat
1052 character(*), parameter:: subname = 'DCClockSetName'
1053 continue
1054 call beginsub(subname)
1055 stat = dc_noerr
1056 cause_c = 'CLOCK'
1057 if (.not. clk % initialized) then
1058 call messagenotify('W', subname, 'Call Create before Set_Name in dc_clock.')
1059 call dbgmessage('Ignored because input argument was not initialized.')
1060 stat = dc_enotinit
1061 goto 999
1062 end if
1063 clk % name = name
1064 call dbgmessage('set new name "%c"', c1=trim(clk % name))
1065999 continue
1066 call storeerror(stat, subname, err, cause_c)
1067 call endsub(subname)
1068 end subroutine dcclocksetname0
1069 !> @en
1070 !> @brief Display predicted CPU time and completion date
1071 !> @details
1072 !> From CLOCK variable `clk` and `progress`, displays predicted CPU time
1073 !> and completion date as follows:
1074 !>
1075 !> @code
1076 !> ########## PREDICTION OF CALCULATION ###########
1077 !> Start Date 2007-03-08T16:49:25+09:00
1078 !> Current Date 2007-03-08T16:49:27+09:00
1079 !> Progress 66.67% [**************** ]
1080 !> Remaining CPU TIME 0.100000E+01
1081 !> Completion Date 2007-03-08T16:49:28+09:00
1082 !> @endcode
1083 !>
1084 !> Give `progress` a value from 0 to 1. 0 is program start, 1 is end.
1085 !> (For example, give 0.5 when the program is half done.)
1086 !>
1087 !> Note: The "prediction" is calculated by a simple algorithm from elapsed
1088 !> time and progress, so it is not an accurate prediction. Use as a guide only.
1089 !>
1090 !> Specify the output unit number in `unit`. If `unit` is not given,
1091 !> output goes to standard output.
1092 !>
1093 !> If `clk` has not been initialized by DCClockCreate, an error is raised.
1094 !> If `err` is provided, .true. is returned in `err` and the program continues.
1095 !>
1096 !> @param[in] clk CLOCK type variable
1097 !> @param[in] progress Progress value (0.0 to 1.0)
1098 !> @param[in] unit Output unit number (optional). Default: standard output.
1099 !> @param[out] err Error flag (optional). .true. if error occurred.
1100 !> @enden
1101 !>
1102 !> @ja
1103 !> @brief プログラムが終了するまでの予測 CPU 時間・日時を表示
1104 !> @details
1105 !> CLOCK 変数 `clk` と `progress` から、プログラムが終了するまでの
1106 !> 予測 CPU 時間および日時を以下のように表示します。
1107 !>
1108 !> @code
1109 !> ########## PREDICTION OF CALCULATION ###########
1110 !> Start Date 2007-03-08T16:49:25+09:00
1111 !> Current Date 2007-03-08T16:49:27+09:00
1112 !> Progress 66.67% [**************** ]
1113 !> Remaining CPU TIME 0.100000E+01
1114 !> Completion Date 2007-03-08T16:49:28+09:00
1115 !> @endcode
1116 !>
1117 !> `progress` には 0 〜 1 までの値を与えてください。
1118 !> プログラムの開始時を 0、終了時を 1 とします
1119 !> (例: プログラムが半分進んだ時には 0.5 を与えます)。
1120 !>
1121 !> @note ここで行う「予測」とは、これまでの経過時間および終了した
1122 !> プログラムの分量から単純なアルゴリズムで割り出しているものなので、
1123 !> 正確な予測値を返すわけではありません。あくまで目安として利用してください。
1124 !>
1125 !> `unit` には出力先の装置番号を与えてください。
1126 !> `unit` を与えない場合、標準出力へ表示されます。
1127 !>
1128 !> `clk` に対して DCClockCreate による初期化が行われていない場合、
1129 !> エラーを発生させます。`err` を与える場合には `err` に .true. が返り、
1130 !> プログラムは続行されます。
1131 !>
1132 !> @param[in] clk CLOCK 型変数
1133 !> @param[in] progress 進捗値 (0.0 〜 1.0)
1134 !> @param[in] unit 出力先装置番号 (省略可)。デフォルト: 標準出力。
1135 !> @param[out] err エラーフラグ (省略可)。エラー時に .true.。
1136 !> @endja
1137 subroutine dcclockpredict0(clk, progress, unit, err)
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)
1217 end subroutine dcclockpredict0
1218 !> @namespace dc_clock
1219end module dc_clock
CPU 時間の計測
Definition dc_clock.f90:85
日付・時刻に関する構造データ型と定数
日付および時刻に関する手続きを提供するモジュール
Definition dc_date.f90:57
エラー処理用モジュール
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_enotinit
-400 以下: dc ユーティリティのエラー
Definition dc_error.f90:534
integer, parameter, public dc_noerr
エラー等を保持
Definition dc_error.f90:468
メッセージの出力
文字型変数の操作
Definition dc_string.f90:83
デバッグ時の追跡用モジュール
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:680
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
Definition dc_types.f90:128
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137
integer, parameter, public stdout
標準出力の装置番号
Definition dc_types.f90:117
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:92