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-cuda

This repository holds a GPU (Cuda, NVIDIA A100) 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. The CPU benchmark of the same versions is bench-pykokkos-cpp-openmp.

  • 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 93e26a1 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. Its Cuda build was made from a0feaaa0, the head of the branch that a778bf4a merges: the same sources, apart from canoP studio (tools/) and the documentation (docs/).

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);
  • tmax = 1000, out of reach: every run stops at simulation.nstepmax.
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 steps and for a second number of steps n2 (simulation.nstepmax), chosen so that the difference lasts about 150 s on the A100. The time per step is (ALL(n2) − ALL(50)) / (n2 − 50), 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.

case n2
2d_l11_b4 5050
2d_l11_b16 15050
3d_l7_b4 8050
3d_l7_b8 15050
3d_l8_b8 2050

The CPU benchmark uses 50 and 250 steps. On the GPU that is too few, because of the two outputs: canoP studio needs them to see a run as finished. They are written on GPFS and take 2 to 6 s, a different time in each run, while 50 steps of computation take about 0.5 s. Measured with the C++ on 2d_l11_b16 at 50 steps, four runs of each:

  • without outputs (save_count = 0), ALL was 0.513 to 0.523 s;
  • with the two outputs (641 MB), ALL was 2.76 to 6.11 s.

With 50 and 250 steps, the two repetitions of the C++ differed by up to 43 %. With the long runs, they differ by 1 % at most.

  • Machine: the node ruche-gpu14 of Ruche (gpua100): NVIDIA A100-SXM4-40GB, 2 × Intel Xeon Gold 6346. One MPI process with 8 OpenMP threads (OMP_PROC_BIND=spread, OMP_PLACES=threads) and one GPU. CUDA 13.0.2 and gcc 15.1.0, Kokkos with Cuda for AMPERE80.
  • pykokkos: one run per case and number of steps, each its own Slurm job, all on ruche-gpu14 (2026-11-28, 13:58 to 14:24). The kernels of the physics were already in the cache of the build: no run compiled one.
  • C++: two repetitions, in two Slurm jobs (2D, then 3D) on ruche-gpu14 (2026-11-28, 11:55 to 12:24). Each ALL is the minimum of the two.

Results

case steps C++ ms/step C++ Mcell/s pykokkos ms/step pykokkos Mcell/s pykokkos / C++
2D 2048², blocks 4² 50-5050 30.09 139.4 28.29 148.3 1.06
2D 2048², blocks 16² 50-15050 10.21 410.8 10.32 406.5 0.99
3D 128³, blocks 4³ 50-8050 18.29 114.6 16.34 128.4 1.12
3D 128³, blocks 8³ 50-15050 11.01 190.4 10.05 208.6 1.10
3D 256³, blocks 8³ 50-2050 69.78 240.4 57.37 292.4 1.22

On the A100, the physics in Python is as fast as in C++ in 2D, and 10 to 22 % faster in 3D. The benchmark of 2026-11-23 (pykokkos at 16989d10, 50 and 150 steps without outputs, on the same node) gave the same ratios: 1.06, 1.01, 1.11, 1.09 and 1.21.

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

case pykokkos 50 pykokkos n2 C++ 50 (2 runs) C++ n2 (2 runs)
2d_l11_b4 4.238 145.689 4.901, 4.897 155.660, 155.341
2d_l11_b16 2.796 157.586 4.065, 4.604 158.104, 157.206
3d_l7_b4 3.505 134.208 4.363, 1.530 149.346, 147.887
3d_l7_b8 3.806 154.603 2.250, 4.682 168.867, 167.457
3d_l8_b8 10.875 125.620 14.497, 13.787 153.345, 153.953

Limits:

  • pykokkos has one run per point, while the C++ takes the minimum of two. The outputs vary by up to about 3.5 s from one run to another: on differences of 125 to 155 s, a single run may be off by up to about 3 %.
  • All the runs ran on the same node and the same model of GPU, but at different times, and the clocks of the GPU were not locked.

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 for Cuda (kokkos_backend = Cuda, kokkos_arch_gpu = AMPERE80 for an A100), canoP_2d and canoP_3d.
  2. Compile the kernels of the physics before the measured runs: the first run of a kernel on a GPU compiles it (20 to 45 s each). A short run of each dimension on a GPU node, with the physics of the campaign, is enough.
  3. 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. Put all the runs on one node (--nodelist in the Slurm lines of the studio).
  4. 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