Construct and return an object of type bench_type.
This is the constructor of the type bench_type for creating objects to perform benchmarking of the user-specified procedures within the user-provided wrapper function.
- Parameters
-
[in] | name | : The input scalar character of arbitrary length of default kind SK, containing the benchmark name (typically the name of the procedure to be timed). |
[in] | exec | : The input procedure pointer with the abstract interface exec_proc pointing to the user-defined wrapper procedure that calls the arbitrary procedure to be timed. |
[in] | overhead | : The input procedure pointer with the abstract interface exec_proc pointing to a user-defined wrapper procedure that calls everything executed within wrapper procedure exec() , except the call to the procedure that is being timed.
This procedure pointer will be used to measure the overhead due to calling or executing any non-relevant statements within the wrapper procedure exec() .
(optional. If missing, then a default empty wrapper procedure will be used to compute the overhead.
Note the default overhead is likely optimized away in production builds of the library, effectively yielding zero overhead.) |
[in] | minsec | : The input scalar of type real of kind double precision RKD representing the minimum time in units of seconds that the overall benchmark should last.
(optional. The default is set by the constructor of the superclass benchBase_type.) |
[in] | miniter | : The input scalar of type integer of default kind IK representing the minimum number of timing the user-specified wrapper procedure repeatedly.
(optional. The default is set by the constructor of the superclass benchBase_type.) |
[in] | timer | : The input object of abstract class timer_type representing the benchmark timer.
This object can be one of the available timers in pm_timer:
-
timerCPU_type,
-
timerDAT_type,
-
timerMPI_type,
-
timerOMP_type,
-
timerSYS_type,
or any other user-defined subclass of the abstract timer_type class.
(optional, default = timer_type) |
- Returns
bench
: The output scalar object of type bench_type.
Possible calling interfaces ⛓
type(bench_type) :: bench
character(:, SK) :: name
integer(IK) :: miniter
real(RKD) :: minsec
benchBase
= bench_type(name, exec, overhead
= overhead, minsec
= minsec, miniter
= miniter, timer
= timer_type())
benchBase
= bench_type(name, exec, overhead
= overhead, minsec
= minsec, miniter
= miniter, timer
= timerCPU_type())
benchBase
= bench_type(name, exec, overhead
= overhead, minsec
= minsec, miniter
= miniter, timer
= timerDAT_type())
benchBase
= bench_type(name, exec, overhead
= overhead, minsec
= minsec, miniter
= miniter, timer
= timerMPI_type())
benchBase
= bench_type(name, exec, overhead
= overhead, minsec
= minsec, miniter
= miniter, timer
= timerOMP_type())
benchBase
= bench_type(name, exec, overhead
= overhead, minsec
= minsec, miniter
= miniter, timer
= timerSYS_type())
This module contains abstract interfaces and types that facilitate benchmarking of different procedur...
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter RKD
The double precision real kind in Fortran mode. On most platforms, this is an 64-bit real kind.
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
This module contains the timer procedures and derived types to facilitate timing applications at runt...
This is the base class for creating low-level benchmark objects.
This is the class for creating benchmark and performance-profiling objects.
This is the timerCPU_type class, containing attributes and static methods for setting up a timer base...
This is the timerDAT_type class, containing attributes and static methods for setting up a timer base...
This is the timerMPI_type class, containing attributes and static methods for setting up a timer base...
This is the timerMPI_type class, containing attributes and static methods for setting up a timer base...
This is the timerSYS_type class, containing attributes and static methods for setting up a timer base...
This is the abstract base derived type that serves as a simple container template for other timer cla...
- Note
- If the specified benchmark routine is to be called certain number of times, set
minsec = 0.
and miniter
to desired number of times the routine must be timed.
- See also
- benchBase_type
benchMulti_type
timerDAT_type
timerMPI_type
timerOMP_type
timerSYS_type
timer_type
Example usage ⛓
12 type(bench_type) :: bench
14 real(RKD) :: unifsum
= 0._RKD
16 type(display_type) :: disp
20 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
21 call disp%show(
"!Benchmark the uniform random number generation.")
22 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
26 call disp%show(
"subroutine wrapper(); call random_number(unifrnd); unifsum = unifsum + unifrnd; end")
27 call disp%show(
"bench = bench_type(name = SK_'random_number', exec = wrapper)")
28 bench
= bench_type(name
= SK_
'random_number', exec
= wrapper)
29 call disp%show(
"bench%timing = bench%getTiming() ! same as below")
35 call disp%show(
"call bench%setTiming(minsec = 0.1_RKD) ! same as above but with a non-default minimum overall repetitive timing for 0.1 seconds.")
44 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
45 call disp%show(
"!Benchmark the uniform random number generation while excluding the overhead of redundant operations.")
46 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
50 call disp%show(
"subroutine wrapper(); call random_number(unifrnd); unifsum = unifsum + unifrnd; end")
51 call disp%show(
"subroutine overhead(); unifsum = unifsum + unifrnd; end")
52 call disp%show(
"bench = bench_type(name = SK_'random_number', exec = wrapper, overhead = overhead)")
53 bench
= bench_type(name
= SK_
'random_number', exec
= wrapper, overhead
= overhead)
54 call disp%show(
"bench%timing = bench%getTiming() ! same as below")
65 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
66 call disp%show(
"!Benchmark the uniform random number generation while excluding the overhead of redundant operations using a non-default CPU timer.")
67 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
71 call disp%show(
"subroutine wrapper(); call random_number(unifrnd); unifsum = unifsum + unifrnd; end")
72 call disp%show(
"subroutine overhead(); unifsum = unifsum + unifrnd; end")
73 call disp%show(
"bench = bench_type(name = SK_'random_number', exec = wrapper, overhead = overhead, timer = timerCPU_type())")
75 call disp%show(
"bench%timing = bench%getTiming() ! same as below")
86 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
87 call disp%show(
"!Benchmark the uniform random number generation while excluding the overhead of redundant operations using a non-default date_and_time() timer.")
88 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
92 call disp%show(
"subroutine wrapper(); call random_number(unifrnd); unifsum = unifsum + unifrnd; end")
93 call disp%show(
"subroutine overhead(); unifsum = unifsum + unifrnd; end")
94 call disp%show(
"bench = bench_type(name = SK_'random_number', exec = wrapper, overhead = overhead, timer = timerDAT_type())")
96 call disp%show(
"bench%timing = bench%getTiming() ! same as below")
108 impure subroutine showTimerComponents()
110 call disp%show( bench
%name , deliml
= SK_
"""" )
118 call random_number(unifrnd)
119 unifsum
= unifsum
+ unifrnd
122 subroutine overhead()
123 unifsum
= unifsum
+ unifrnd
Generate and return an object of type timing_type containing the benchmark timing information and sta...
Time the user-specified procedure wrapper in the parent object of type bench_type and store the outpu...
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
7subroutine wrapper(); call random_number(unifrnd); unifsum
= unifsum
+ unifrnd; end
8bench
= bench_type(name
= SK_
'random_number', exec
= wrapper)
11+0.22604502138542149E-6
13+0.68037835551224595E-6
16+0.20747135432595663E-6
18+0.43650225530541366E-6
26subroutine wrapper(); call random_number(unifrnd); unifsum
= unifsum
+ unifrnd; end
27subroutine overhead(); unifsum
= unifsum
+ unifrnd; end
28bench
= bench_type(name
= SK_
'random_number', exec
= wrapper, overhead
= overhead)
31+0.92292511819425713E-7
33+0.40737882127251760E-6
35+0.10000000000000001E-8
43subroutine wrapper(); call random_number(unifrnd); unifsum
= unifsum
+ unifrnd; end
44subroutine overhead(); unifsum
= unifsum
+ unifrnd; end
48+0.10000000000287557E-5
50+0.10000000000287557E-5
52+0.10000000000287557E-5
60subroutine wrapper(); call random_number(unifrnd); unifsum
= unifsum
+ unifrnd; end
61subroutine overhead(); unifsum
= unifsum
+ unifrnd; end
65+0.10000000000000007E-2
67+0.10000000000000000E-2
69+0.10000000000000000E-2
- Test:
- test_pm_bench
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.
-
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.
-
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.
- Copyright
- Computational Data Science Lab
- Author:
- Amir Shahmoradi, Wednesday 4:13 AM, August 13, 2016, Institute for Computational Engineering and Sciences (ICES), The University of Texas Austin
Definition at line 498 of file pm_bench.F90.