Benchmarking B2000++

This chapter provides a brief overview of how to set up and run benchmarks for your B2000++ code.

There are multiple methods to measure performance, including monitoring runtime or utilizing tools such as perf to obtain runtime statistics or dive deeper into the assembly level.

Two additional built-in and tested possibilities for measuring code performance in B2000++ pro are,

  • Using the Benchmark framework from Google

  • Using Score-p and Cube

Benchmark

Existing benchmark tests for static and dynamic cases are already available in the src/bench directory.

To run these tests, simply build B2000++ with the bench variant enabled.

spack install b2000@develop+bench+tbb

the executable should now be available in the build directory.

Note

As of our most recent testing, benchmarks did not work with b2000++ built with mpi variant.

Score-p and Cube

Using Score-p and Cube requires additional steps to execute the code.

Activate spack env.

module use /modules_sp/ubuntu2204/modules
module load spack-user/
source ${SPACK_USER_ROOT}/share/spack/setup-env.sh
mkdir b2bench
cd b2bench
spack env create -d .
spack env activate -p .

Setup env and install necessary packages.

spack add simples~b2gtkbrowser~b2dependency
spack add b2000@develop+bench+mpi+scorep

We want to install b2000 for development.

spack develop b2000@develop+bench+mpi+scorep

Before installing or o rimplementing, we need to check if the necessary Score-P wrapper flags and compiler flags are setup. Execute

git clone git@gitlab.dlr.de:b2000coop/b2spack.git
git checkout origin/spack-v0
spack repo add b2spack
spack edit b2000

if you code contains the lines

env.set("SCOREP_WRAPPER_INSTRUMENTER_FLAGS", "--thread=omp" + " --user" + instfilter)
env.set("SCOREP_WRAPPER_COMPILER_FLAGS", "-DHAVE_SCOREP")

you can carry forward with the next steps, in case it doesn’t please add these two lines to the setup_build_environment function.

Concretize and build b2000.

spack concretize -f
spack install

You can now execute your program using

b2000++ input_file.mdl

and you should have a scorep-yyyymmdd-hhmmm-xxx... directory with a profile.cubex file.

For the graphical interface, you need to open the file with cube,

module use /modules_sp/ubuntu2204/modules
module load flowsim_env/
module load cube
cube scorep-yyyymmdd-hhmmm-xxx.../profile.cubex