Find us on…

GitHub

ForBenchmark

GitHub Version Documentation License Build

ForBenchmark: A Fortran library for benchmarking (with support for coarrays).

ForBenchmark can measure various time metrics including elapsed wall time, CPU time, OpenMP (OMP) time, MPI time, and date_and_time. Furthermore, it can compute flops based on a provided function.

Benchmark Results

This list will be updated. Feel free to add new benchmarks.

Simple Usage

use forbenchmark

type(benchmark) :: bench

! initialize the benchmark
call bench%init(nmarks)

! start benchmark
call bench%start_benchmark(imark, method)
! loop over nloops
do nl = 1, bench%nloops

    ! call your function or subroutine or ...

end do
! stop benchmark
call bench%stop_benchmark()

! finalize the benchmark
call bench%finalize()

Procedures

! initialize the benchmark
call bench%init(nmarks, title, filename, nloops, timer)
! start benchmark
call bench%start_benchmark(imark, method, description, argi, argr)
! stop benchmark
call bench%stop_benchmark(flops)
! finalize the benchmark
call bench%finalize()

Refer to example/demo.f90 for a complete demonstration.

fpm dependency

To use ForBenchmark as a dependency in your fpm project, include the following line in your fpm.toml file:

[dependencies]
forbenchmark = {git="https://github.com/gha3mi/forbenchmark.git"}

How to Run the Demo

Clone the repository:

Clone the ForBenchmark repository from GitHub using:

git clone https://github.com/gha3mi/forbenchmark.git
cd forbenchmark

Run the demo:

For non-coarray benchmarking:

fpm run --example demo --profile release

For coarray programs benchmarking using the Intel Fortran compiler:

fpm run --example demo  --profile release --compiler ifx --flag "-coarray -coarray-num-images=4 -DUSE_COARRAY"
fpm run --example demo  --profile release --compiler ifort --flag "-coarray -coarray-num-images=4 -DUSE_COARRAY"

After execution, the results will be displayed in the terminal and stored in the 'results' folder. See results/demo.data, results/demo_im1.data for instance.

Visualizing and exporting demo results:

To generate visual representations and export benchmarking metrics, execute the following commands in Python. Specify the relevant data file as an argument:

python results/export.py demo_<compiler>.data

This command will produce graphical representations and an HTML table showcasing benchmarking metrics:

Elapsed Time Performance
demo_elapsed_time demo_performance
Speedup Average Weighted Speedup
demo_speedup demo_speedup

For Coarray benchmarks, execute:

python results/export_co.py demo_co.data
python results/export_im.py demo_im1.data

The outputs can be found in the results directory.

TODO

  • [ ] Add sphinx-gallery
  • [ ] Add settings to set units.
  • [ ] Add and update benchmarks for matmul and matmul_co,...
  • [ ] Add MPI module.

API documentation

The most up-to-date API documentation for the main branch is available here. To generate the API documentation for ForBenchmark using ford run the following command:

ford ford.yml

Contributing

Contributions to ForBenchmark are welcome! If you find any issues or would like to suggest improvements, please open an issue.

Developer Info

Seyed Ali Ghasemi