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

This is the class for creating object to perform multiple benchmarks and performance-profiling. More...

Public Member Functions

procedure, pass showsum => showsum_
 The generic object method name that points to showsum. More...
 
 benchMulti_typer
 

Public Attributes

integer(IK) ncase
 The scalar integer of default kind IK containing the number of user-specified benchmark cases. More...
 
character(:, SK), allocatable name
 The allocatable scalar character of default kind SK containing the names of benchmark cases separated with " vs.". More...
 
type(bench_type), dimension(:), allocatable case
 The vector component object of type bench_type of size ncase * repeat containing the Benchmark cases.
More...
 

Detailed Description

This is the class for creating object to perform multiple benchmarks and performance-profiling.

This type facilitates comparison of performances of multiple user-specified procedure wrappers by reducing the amount of code to be written and automating and randomizing the timing schemes.
See also benchMulti_typer, the type constructor.


Possible calling interfaces

type(benchMulti_type) :: self(:)
type(bench_type), allocatable :: case(:)
self = benchMulti_type(case(:))
See also
benchMulti_typer
showsum
bench_type
timer_type
timerDAT_type
timerMPI_type
timerOMP_type
timerSYS_type


Example usage

1program example
2
3 use iso_fortran_env, only: error_unit
4 use pm_kind, only: IK, LK, SK, RKS, RKD, RKQ
6 use pm_io, only: display_type
7 use pm_bench, only: bench_type
8
9 implicit none
10
11 type(benchMulti_type) :: benchMulti
12 real(RKS) :: unifrnd_RKS
13 real(RKS) :: unifsum_RKS = 0._RKS ! dummy calculation to prevent aggressive compiler optimizations.
14 real(RKD) :: unifrnd_RKD
15 real(RKD) :: unifsum_RKD = 0._RKD ! dummy calculation to prevent aggressive compiler optimizations.
16 real(RKQ) :: unifrnd_RKQ
17 real(RKQ) :: unifsum_RKQ = 0._RKQ ! dummy calculation to prevent aggressive compiler optimizations.
18
19 type(display_type) :: disp
20 disp = display_type(file = "main.out.F90")
21
22 call disp%skip()
23 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
24 call disp%show("!Benchmark the runtime cost of single, double, and quad precision exponentiaion.")
25 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
26 call disp%skip()
27
28 call disp%skip()
29 call disp%show("benchMulti = benchMulti_type([bench_type(SK_'rng_single', procwrap_RKS, overhead_RKS), bench_type(SK_'rng_double', procwrap_RKD, overhead_RKD), bench_type(SK_'rng_quadro', procwrap_RKQ, overhead_RKQ)])")
30 benchMulti = benchMulti_type([bench_type(SK_'rng_single', procwrap_RKS, overhead_RKS), bench_type(SK_'rng_double', procwrap_RKD, overhead_RKD), bench_type(SK_'rng_quadro', procwrap_RKQ, overhead_RKQ)])
31 !benchMulti = benchMulti_type([bench_type(SK_'rng_single', procwrap_RKS), bench_type(SK_'rng_double', procwrap_RKD), bench_type(SK_'rng_quadro', procwrap_RKQ)])
32 call disp%show("call benchMulti%showsum(unit = disp%unit, tabular = .true._LK) ! Display the results in a nice tabular format.")
33 call benchMulti%showsum(unit = disp%unit, tabular = .true._LK) ! Display the results in a nice tabular format.
34 call disp%show("call benchMulti%showsum(unit = disp%unit, tabular = .false._LK) ! Display the results in the default CSV format.")
35 call benchMulti%showsum(unit = disp%unit, tabular = .false._LK) ! Display the results in the default CSV format.
36 call disp%skip()
37
38 ! Print the dummy results to present potential aggressive compiler optimizations.
39
40 write(error_unit, *) unifsum_RKS + unifsum_RKD + unifsum_RKQ
41
42contains
43
44 subroutine overhead_RKS(); call random_number(unifrnd_RKS); unifsum_RKS = unifsum_RKS + unifrnd_RKS; end
45 subroutine overhead_RKD(); call random_number(unifrnd_RKD); unifsum_RKD = unifsum_RKD + unifrnd_RKD; end
46 subroutine overhead_RKQ(); call random_number(unifrnd_RKQ); unifsum_RKQ = unifsum_RKQ + unifrnd_RKQ; end
47 subroutine procwrap_RKS(); call random_number(unifrnd_RKS); unifsum_RKS = unifsum_RKS + 2._RKS**unifrnd_RKS; end
48 subroutine procwrap_RKD(); call random_number(unifrnd_RKD); unifsum_RKD = unifsum_RKD + 2._RKD**unifrnd_RKD; end
49 subroutine procwrap_RKQ(); call random_number(unifrnd_RKQ); unifsum_RKQ = unifsum_RKQ + 2._RKQ**unifrnd_RKQ; end
50
51end program example
Time the user-specified procedure wrappers in the case vector component of the parent object of type ...
Definition: pm_bench.F90:873
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 abstract interfaces and types that facilitate benchmarking of different procedur...
Definition: pm_bench.F90:41
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 RKQ
The quadru-precision real kind in Fortran mode. On most platforms, this is an 128-bit real kind.
Definition: pm_kind.F90:569
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
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Definition: pm_kind.F90:567
This is the class for creating object to perform multiple benchmarks and performance-profiling.
Definition: pm_bench.F90:735
This is the class for creating benchmark and performance-profiling objects.
Definition: pm_bench.F90:386
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
2!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3!Benchmark the runtime cost of single, double, and quad precision exponentiaion.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6
7benchMulti = benchMulti_type([bench_type(SK_'rng_single', procwrap_RKS, overhead_RKS), bench_type(SK_'rng_double', procwrap_RKD, overhead_RKD), bench_type(SK_'rng_quadro', procwrap_RKQ, overhead_RKQ)])
8call benchMulti%showsum(unit = disp%unit, tabular = .true._LK) ! Display the results in a nice tabular format.
9
10 benchmark | avg runtime [s] | std runtime [s]
11---------- | --------------- | ---------------
12rng_single | 0.880411995E-08 | 0.170833416E-06
13rng_single | 0.945102299E-08 | 0.273280224E-06
14rng_double | 0.189252850E-07 | 0.187433271E-06
15rng_double | 0.189785290E-07 | 0.123753484E-06
16rng_quadro | 0.131443879E-05 | 0.679005902E-05
17rng_quadro | 0.137687062E-05 | 0.438814810E-05
18
19call benchMulti%showsum(unit = disp%unit, tabular = .false._LK) ! Display the results in the default CSV format.
20benchmark,avg runtime [s],std runtime [s]
21rng_single,0.880411995E-8,0.170833416E-6
22rng_single,0.945102299E-8,0.273280224E-6
23rng_double,0.189252850E-7,0.187433271E-6
24rng_double,0.189785290E-7,0.123753484E-6
25rng_quadro,0.131443879E-5,0.679005902E-5
26rng_quadro,0.137687062E-5,0.438814810E-5
27
28
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.

  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, Wednesday 4:13 AM, August 13, 2016, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 735 of file pm_bench.F90.

Member Function/Subroutine Documentation

◆ benchMulti_typer()

pm_bench::benchMulti_type::benchMulti_typer

◆ showsum()

procedure, pass pm_bench::benchMulti_type::showsum

The generic object method name that points to showsum.

Definition at line 745 of file pm_bench.F90.

Member Data Documentation

◆ case

type(bench_type), dimension(:), allocatable pm_bench::benchMulti_type::case

The vector component object of type bench_type of size ncase * repeat containing the Benchmark cases.

Definition at line 740 of file pm_bench.F90.

◆ name

character(:, SK), allocatable pm_bench::benchMulti_type::name

The allocatable scalar character of default kind SK containing the names of benchmark cases separated with " vs.".

Definition at line 738 of file pm_bench.F90.

◆ ncase

integer(IK) pm_bench::benchMulti_type::ncase

The scalar integer of default kind IK containing the number of user-specified benchmark cases.

Definition at line 736 of file pm_bench.F90.


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