Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

bench-pykokkos-cpp-openmp

This repository holds a CPU (OpenMP) benchmark of canoP. It compares canoP with its physics in Python, written with pykokkos, to the last canoP with its physics in C++. The question is the cost of the Python physics in time per step.

  • pykokkos: canoP main at 8c715195 (release 0.1.0), with kalypsso-core a5070cb7 and pykokkos a1878c91. The physics of the runs is in physics/ (commit 8d52ba2 of this repository: a copy of physics/ of canoP at 8c715195).
  • C++: canoP a778bf4a, main before the physics in Python, with the same kalypsso-core.

This repository is the canoP studio campaign that holds the pykokkos runs. The C++ runs were made outside the studio, with the same input files converted to the format of that version (model monofluid, options in [callback]). Only their metrics are kept, in the tables below.

Cases

All the cases run the blast of the model onephase:

  • periodic domain;
  • Euler in time and MUSCL in space (minmod), with the all-regime flux and a CFL of 0.5;
  • refinement everywhere (epsilon_refine = -1) from min_refine, so the mesh is uniform at max_refine after a few steps, and adapted at every step (amr.cycle_frequency = 1);
  • outputs of the initial and final states only (io.save_count = 1, write_variables = m).
case (bench.case) mesh blocks max_refine min_refine bx
2d_l11_b4 2D 2048² 4² 11 3 4
2d_l11_b16 2D 2048² 16² 11 4 16
3d_l7_b4 3D 128³ 4³ 7 3 4
3d_l7_b8 3D 128³ 8³ 7 3 8
3d_l8_b8 3D 256³ 8³ 8 3 8

The key bench.case is written in the input files only to name the case: canoP does not read it.

Method

Each case runs for 50 and for 250 steps (simulation.nstepmax). The time per step is (ALL(250) − ALL(50)) / 200, where ALL is the time Kalypsso::ALL printed at the end of canoP.log. The start goes away in this difference, being the same in both runs: Python, the first kernel launches, the first refinements, and the outputs (same mesh). The speed is Mcell/s = cells / time per step.

  • Machine: one node of Ruche (cpu_short, 2 × Intel Xeon Gold 6230, 40 cores), one MPI process with 40 OpenMP threads (OMP_PROC_BIND=spread, OMP_PLACES=threads).
  • pykokkos: one run per case and number of steps, each its own Slurm job (node189, except 3D 128³ blocks 4³ at 250 steps on node190). The kernels were already in the cache of the build: no run compiled one.
  • C++: two repetitions in one Slurm job (node001). Each ALL is the minimum of the two.

Results

case C++ ms/step C++ Mcell/s pykokkos ms/step pykokkos Mcell/s pykokkos / C++
2D 2048², blocks 4² 278.97 15.0 272.21 15.4 1.03
2D 2048², blocks 16² 138.59 30.3 139.74 30.0 0.99
3D 128³, blocks 4³ 363.78 5.8 358.44 5.9 1.02
3D 128³, blocks 8³ 187.46 11.2 177.34 11.8 1.05
3D 256³, blocks 8³ 1425.51 11.8 1279.73 13.1 1.11

The physics in Python runs as fast as in C++ on CPU, up to 11 % faster on the largest 3D case. These ratios are those of the benchmark of 2026-11-23 (0.99 to 1.07, pykokkos at 16989d10).

The raw times, in seconds (Kalypsso::ALL):

case pykokkos 50 pykokkos 250 C++ 50 (2 runs) C++ 250 (2 runs)
2d_l11_b4 17.934 72.375 18.547, 20.207 75.619, 74.340
2d_l11_b16 8.370 36.317 9.742, 7.546 36.683, 35.265
3d_l7_b4 21.545 93.232 22.672, 21.925 95.609, 94.680
3d_l7_b8 11.755 47.223 12.111, 13.825 49.602, 49.902
3d_l8_b8 76.190 332.136 78.730, 74.152 361.276, 359.253

Limits:

  • pykokkos has one run per point, while the C++ takes the minimum of two (their spread is 0.6 to 4 %).
  • The two versions ran on different nodes, of the same model.
  • The GPU benchmark (A100) is a separate campaign, bench-pykokkos-cpp-cuda.

Contents

The repository is kept by canoP studio, which commits at each launch:

  • workspace/<id>/: the input file of each run, with the commits of canoP and of the physics in its # [canoP studio] lines, plus its signac state point and job document (metrics of the run);
  • physics/: the physics of the campaign;
  • analysis.py: the Analyse tab of canoP studio, which shows the comparison table and a bar chart of the Mcell/s. It reads the logs of the runs and cpp_reference.json (the C++ metrics), neither of which is versioned here: in a clone, the tables above are the record;
  • project.py, templates/: the signac-flow project of the runs;
  • signac_project_document.json: the base input file, the parameters of the runs and the launch settings of the last submission.

The outputs, the logs and the copies of the physics in the run directories are not versioned.

Reproducing

  1. Build canoP at 8c715195 in canoP studio, OpenMP, canoP_2d and canoP_3d.
  2. Make a new campaign with the base input file and the parameters of the runs. Both are in signac_project_document.json (base_ini, sweep), and each run's are in workspace/<id>/signac_statepoint.json.
  3. Run it in two phases, as here. First, with the studio in 3D (dim = 3), submit the 3D cases and wait until all of them have finished. Then, with the studio in 2D, add and submit the 2D cases.

canoP studio runs one executable per submission, canoP_2d or canoP_3d, chosen by the dimension of the studio. A queued run takes the launch settings of the last submission of its campaign when it starts. A 3D run still queued when the 2D runs are submitted would therefore run canoP_2d.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages