Derived type for benchmarking and performance evaluation.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(mark_co), | public, | dimension(:), allocatable | :: | marks_co[:] |
Array of mark_co type for each method being benchmarked in each image |
||
type(mark), | public, | dimension(:), allocatable | :: | marks |
Array of mark type for each method being benchmarked in all images |
||
character(len=:), | public, | allocatable | :: | filename |
Filename for storing the benchmark data in all images |
||
character(len=:), | public, | allocatable | :: | filename_image |
Filename for storing the benchmark data in each image |
||
integer, | public | :: | nloops |
Number of loops for each benchmark |
|||
integer(kind=ik), | public, | dimension(:), allocatable | :: | argi |
Integer arguments for benchmarks |
||
real(kind=rk), | public, | dimension(:), allocatable | :: | argr |
Real arguments for benchmarks |
||
character(len=:), | public, | allocatable | :: | timer |
Timer object for measuring time |
||
integer, | public | :: | imark |
Index of the current benchmark |
Initialization the benchmark object
Initialize the benchmark object.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(benchmark), | intent(inout) | :: | this |
Benchmark object |
||
integer, | intent(in) | :: | nmarks |
Number of methods being benchmarked |
||
character(len=*), | intent(in), | optional | :: | title |
Title of the benchmark |
|
character(len=*), | intent(in), | optional | :: | filename |
Filename for storing the benchmark data |
|
integer, | intent(in), | optional | :: | nloops |
Number of loops for each benchmark (default: 10) |
|
character(len=*), | intent(in), | optional | :: | timer |
Timer object for measuring time (default: wall) |
Start a benchmark
Start a specific benchmark.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(benchmark), | intent(inout) | :: | this |
Benchmark object |
||
integer, | intent(in) | :: | imark |
Index of the current method |
||
character(len=*), | intent(in) | :: | method |
Name of the method being benchmarked |
||
character(len=*), | intent(in), | optional | :: | description |
Description of the method being benchmarked (optional) |
|
integer(kind=ik), | intent(in), | optional, | dimension(:) | :: | argi |
Integer arguments for benchmarks (optional) |
real(kind=rk), | intent(in), | optional, | dimension(:) | :: | argr |
Real arguments for benchmarks (optional) |
Stop a benchmark
Stops the currently active benchmark, calculates performance metrics, and writes the results to the file and terminal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(benchmark), | intent(inout) | :: | this |
Benchmark object |
||
procedure(Fun), | optional | :: | flops |
Function to calculate Floating Point Operations Per Second (optional) |
Write benchmark data to file
Writes the benchmark data to a specified file, including method, speedup, elapsed time, flops, and other details.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(benchmark), | intent(inout) | :: | this |
Benchmark object |
Finalize the benchmark object
Finalizes the benchmark object by deallocating memory and performs necessary cleanup.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(benchmark), | intent(inout) | :: | this |
Benchmark object to be finalized |
type :: benchmark !! author: Seyed Ali Ghasemi !! Derived type for benchmarking and performance evaluation. !! type(mark_co), dimension(:), allocatable :: marks_co[:] !! Array of mark_co type for each method being benchmarked in each image type(mark), dimension(:), allocatable :: marks !! Array of mark type for each method being benchmarked in all images character(:), allocatable :: filename !! Filename for storing the benchmark data in all images character(:), allocatable :: filename_image !! Filename for storing the benchmark data in each image integer :: nloops !! Number of loops for each benchmark integer(ik), dimension(:), allocatable :: argi !! Integer arguments for benchmarks real(rk), dimension(:), allocatable :: argr !! Real arguments for benchmarks character(:), allocatable :: timer !! Timer object for measuring time integer :: imark !! Index of the current benchmark contains procedure :: init !! Initialization the benchmark object procedure :: start_benchmark !! Start a benchmark procedure :: stop_benchmark !! Stop a benchmark procedure, private :: write_benchmark !! Write benchmark data to file procedure :: finalize !! Finalize the benchmark object end type benchmark