ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_timer::timerCPU_type Interface Reference

This is the timerCPU_type class, containing attributes and static methods for setting up a timer based on the CPU-clock, using the Fortran intrinsic cpu_time(). More...

Inheritance diagram for pm_timer::timerCPU_type:
Collaboration diagram for pm_timer::timerCPU_type:

Public Member Functions

procedure, nopass time => getTimeCPU
 See getTime_proc. More...
 
procedure, nopass wait => setIdleCPU
 See setIdle_proc. More...
 
type(timerCPU_type) function timerCPU_typer ()
 This is the constructor of the timerCPU_type class.
More...
 
- Public Member Functions inherited from pm_timer::timer_type
procedure(getTime_proc), deferred, nopass time
 See getTime_proc. More...
 
procedure(setIdle_proc), deferred, nopass wait
 See setIdle_proc. More...
 
type(timerMPI_type) type(timerOMP_type) type(timerSYS_type) function timer_typer ()
 This is the constructor of the timer_type class.
More...
 

Additional Inherited Members

- Public Attributes inherited from pm_timer::timer_type
real(RKD) start
 The protected scalar real of kind double precision RKD provided as a convenience for the user to contain the start time of the timer since the processor epoch (a processor-dependent past time) in seconds.
More...
 
real(RKD) clock
 The scalar real of kind double precision RKD provided as a convenience for the user to contain the total time in seconds elapsed since the start of the timer.
The clock time can be readily can be computed as timer%clock = timer%time(since = timer%start).
More...
 
real(RKD) delta
 The scalar real of kind double precision RKD provided as a convenience for the user to contain the delta time in seconds since the last timing (last timer call).
The delta time can be readily can be computed as timer%delta = timer%time(since = timer%start) - timer%clock where timer%clock is the last clock read as timer%clock = timer%time(since = timer%start).
More...
 
real(RKD) resol
 The protected scalar real of kind double precision RKD provided as a convenience for the user to contain the time in seconds between the timer clock tics.
More...
 

Detailed Description

This is the timerCPU_type class, containing attributes and static methods for setting up a timer based on the CPU-clock, using the Fortran intrinsic cpu_time().

See the documentation of timerCPU_typer for the non-default constructor interface of this type.
See also the documentation details of pm_timer.


Possible calling interfaces

type(timerCPU_type) :: timer
timer = timerCPU_type()
This module contains the timer procedures and derived types to facilitate timing applications at runt...
Definition: pm_timer.F90:99
This is the timerCPU_type class, containing attributes and static methods for setting up a timer base...
Definition: pm_timer.F90:271
See also
timer_type
timerDAT_type
timerMPI_type
timerOMP_type
timerSYS_type


Example usage

1program example
2
3 use pm_kind, only: IK, LK, SK, RKD
4 use pm_io, only: display_type
5 use pm_timer, only: timerCPU_type
6
7 implicit none
8
9 type(timerCPU_type) :: timer
10 logical(LK) :: failed
11 integer :: i
12
13 type(display_type) :: disp
14 disp = display_type(file = "main.out.F90")
15
16 call disp%skip()
17 call disp%show("timer = timerCPU_type()")
18 timer = timerCPU_type()
19 call showTimerComponents()
20 call disp%skip()
21
22 call disp%skip()
23 call disp%show("timer%clock = timer%time()")
24 timer%clock = timer%time()
25 call showTimerComponents()
26 call disp%skip()
27
28 call disp%skip()
29 call disp%show("timer%clock = timer%time(since = timer%start)")
30 timer%clock = timer%time(since = timer%start)
31 call showTimerComponents()
32 call disp%skip()
33
34 call disp%skip()
35 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
36 call disp%show("!Idle for a certain number of seconds.")
37 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
38 call disp%skip()
39
40 call disp%skip()
41 call disp%show("timer = timerCPU_type()")
42 timer = timerCPU_type()
43 call disp%show("call timer%wait(seconds = 0.1_RKD)")
44 call timer%wait(seconds = 0.1_RKD)
45 call disp%show("timer%delta = timer%time() - timer%start")
46 timer%delta = timer%time() - timer%start
47 call showTimerComponents()
48 call disp%skip()
49
50contains
51
52 impure subroutine showTimerComponents()
53 call disp%show("timer%start")
54 call disp%show( timer%start )
55 call disp%show("timer%clock")
56 call disp%show( timer%clock )
57 call disp%show("timer%delta")
58 call disp%show( timer%delta )
59 call disp%show("timer%resol")
60 call disp%show( timer%resol )
61 end subroutine
62
63end program example
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter RKD
The double precision real kind in Fortran mode. On most platforms, this is an 64-bit real kind.
Definition: pm_kind.F90:568
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2timer = timerCPU_type()
3timer%start
4+0.10600000000000000E-2
5timer%clock
6+0.0000000000000000
7timer%delta
8+0.0000000000000000
9timer%resol
10+0.10000000000001327E-5
11
12
13timer%clock = timer%time()
14timer%start
15+0.10600000000000000E-2
16timer%clock
17+0.10889999999999999E-2
18timer%delta
19+0.0000000000000000
20timer%resol
21+0.10000000000001327E-5
22
23
24timer%clock = timer%time(since = timer%start)
25timer%start
26+0.10600000000000000E-2
27timer%clock
28+0.38999999999999972E-4
29timer%delta
30+0.0000000000000000
31timer%resol
32+0.10000000000001327E-5
33
34
35!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36!Idle for a certain number of seconds.
37!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38
39
40timer = timerCPU_type()
41call timer%wait(seconds = 0.1_RKD)
42timer%delta = timer%time() - timer%start
43timer%start
44+0.11140000000000000E-2
45timer%clock
46+0.0000000000000000
47timer%delta
48+0.10001900000000000
49timer%resol
50+0.99999999999991589E-6
51
52
Test:
test_pm_timer


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, March 22, 2012, 00:00 AM, National Institute for Fusion Studies, The University of Texas at Austin

Definition at line 271 of file pm_timer.F90.

Member Function/Subroutine Documentation

◆ time()

procedure, nopass pm_timer::timerCPU_type::time

See getTime_proc.

Implements pm_timer::timer_type.

Definition at line 273 of file pm_timer.F90.

◆ timerCPU_typer()

type(timerCPU_type) function pm_timer::timerCPU_type::timerCPU_typer

This is the constructor of the timerCPU_type class.

Upon return, the constructor initializes all components of the timer object.
See also the documentation details of pm_timer.

Returns
timer : The output scalar object of class timerCPU_type.


Possible calling interfaces

type(timerCPU_type) :: timer
timer = timerCPU_type()
Remarks
See the documentation of timerCPU_type for example usage.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, March 22, 2012, 00:00 AM, National Institute for Fusion Studies, The University of Texas at Austin

Definition at line 601 of file pm_timer.F90.

References pm_timer::getResTimerCPU().

Here is the call graph for this function:

◆ wait()

procedure, nopass pm_timer::timerCPU_type::wait

See setIdle_proc.

Implements pm_timer::timer_type.

Definition at line 274 of file pm_timer.F90.


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