Construct and return an object of type benchBase_type.
This is the constructor of the type benchBase_type for creating objects that facilitate the benchmarking of arbitrary procedures.
- 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] | 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, default = 0.05 seconds) |
[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, default = 1 ) |
[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
benchBase
: The output scalar object of type benchBase_type.
Possible calling interfaces ⛓
type(benchBase_type) :: benchBase
character(:, SK) :: name
integer(IK) :: miniter
real(RKD) :: minsec
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 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
timerDAT_type
timerMPI_type
timerOMP_type
timerSYS_type
timer_type
Example usage ⛓
12 type(benchBase_type) :: benchBase
14 real(RKD) :: sumTime
= 0._RKD
15 real(RKD) :: sumUnif
= 0._RKD
18 type(display_type) :: disp
22 call disp%show(
"benchBase = benchBase_type(name = SK_'random_number')")
24 call showTimerComponents()
28 call disp%show(
"allocate(benchBase%timing%values(1000))")
30 call disp%show(
" benchBase%timer%start = benchBase%timer%time()")
31 call disp%show(
" call random_number(unifrnd)")
32 call disp%show(
" benchBase%timing%values(i) = benchBase%timer%time(since = benchBase%timer%start)")
33 call disp%show(
" sumTime = sumTime + benchBase%timing%values(i)")
34 call disp%show(
" if (sumTime > benchBase%minsec) exit")
35 call disp%show(
" sumUnif = sumUnif + unifrnd")
37 allocate(benchBase
%timing
%values(
1000))
39 benchBase
%timer
%start
= benchBase
%timer
%time()
40 call random_number(unifrnd)
41 benchBase
%timing
%values(i)
= benchBase
%timer
%time(since
= benchBase
%timer
%start)
42 sumTime
= sumTime
+ benchBase
%timing
%values(i)
43 if (sumTime
> benchBase
%minsec)
exit
44 sumUnif
= sumUnif
+ unifrnd
46 call disp%show(
"sum(benchBase%timing%values) / size(benchBase%timing%values)")
47 call disp%show(
sum(benchBase
%timing
%values)
/ size(benchBase
%timing
%values) )
52 impure subroutine showTimerComponents()
54 call disp%show( benchBase
%name , deliml
= SK_
"""" )
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 ⛓
11allocate(benchBase
%timing
%values(
1000))
13 benchBase
%timer
%start
= benchBase
%timer
%time()
14 call random_number(unifrnd)
15 benchBase
%timing
%values(i)
= benchBase
%timer
%time(since
= benchBase
%timer
%start)
16 sumTime
= sumTime
+ benchBase
%timing
%values(i)
17 if (sumTime
> benchBase
%minsec)
exit
18 sumUnif
= sumUnif
+ unifrnd
20sum(benchBase
%timing
%values)
/ size(benchBase
%timing
%values)
21+0.29597023967653514E-7
- 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 308 of file pm_bench.F90.