Skip to content

Wave 1 Four-Way Performance Benchmark Report (MESA r26.4.1)

Raw Capture Provenance (benchmarks/raw/26.4.1/, #146)

Measured offline against MESA r26.4.1 (fortran_wave1.txt, rust_waves_1_to_5.txt, python_waves_1_to_5.json). Stages 2 and 3 of auto_diff (eval_autodiff_fused) and mtx_tridiag (fast_block_thomas_solve) execute Reference Fortran loops rather than MESA subroutines; single-matrix MESA bcyclic_dble_decsolblk 4096-zone timings are 2161.30 us (1t) and 790.11 us (4t OpenMP).

1. Environment & Reproduction

  • Raw archive: benchmarks/raw/26.4.1/ (provenance.json, fortran_wave*.txt, rust_waves_1_to_5.txt, python_waves_1_to_5.json).
  • Capture timestamp (UTC): 2026-11-17T22:46:37Z (with clean fortran_wave3b.txt and fortran_wave4.txt rerun from a relative MESA_DIR layout at 2026-11-17T23:25:34Z on base commit b5b6abd).
  • Continuous verification: ci_continuous_verification = false (CI builds and tests Safe Rust, PyO3, and JAX without a MESA installation, so the Fortran comparators run offline on a workstation).
  • Host hardware: AMD Ryzen 7 9800X3D 8-Core Processor (16 logical cores, OMP_NUM_THREADS=4, RAYON_NUM_THREADS=4), NVIDIA GeForce RTX 5080, Linux x86_64.
  • Toolchains: MESA r26.4.1, SDK x86_64-linux-26.6.1, GNU Fortran (GCC) 15.2.0 (-O2 -fopenmp -cpp -ffree-form -ffree-line-length-none), rustc 1.100.0 (0ef1bc386 2026-11-09), Python 3.14.0, JAX 0.11.0 (gpu, jax_enable_x64=True).
  • Workload taxonomy (28 workloads, 84 (workload, N_zones) points): 21 full MESA r26.4.1 workloads, 3 mixed MESA 0-1 / Ref. Fortran 2-3 workloads (auto_diff, mtx_tridiag, chem_comp), 3 hybrid Reference Fortran workloads (w5_diff_rot, w5_binary_rlof, w5_astero_seism), and 1 standalone non-MESA Reference Fortran workload (w5_riemann_rsp2).
make -C benchmarks/fortran_mesa MESA_DIR=/path/to/mesa run_wave1
cargo run --release -p flexmesa-bench --bin run_rust_benchmarks -- --quick

2. Checksum Consistency (\(N_{\mathrm{zones}} \in \{128, 1024, 4096\}\))

All 18 Wave 1 (workload, N_zones) pairs agree across all 9 printed significant digits. The full float64 Python checksums differ from the 9-digit printed Fortran values by at most 4.84e-09, within the 5e-09 rounding of a 9-digit print, so these captures cannot show a difference below that.

Workload \(N_{\mathrm{zones}}\) Comparator Checksum Safe Rust Checksum Python/JAX Checksum |Rust - F90| Rel. |JAX - F90| Rel. Rust max_rel_err JAX max_rel_err
auto_diff 128 1.29083046e+05 1.29083046e+05 1.29083046e+05 0.000e+00 2.111e-09 1.949e-15 2.014e-15
interp_2d 128 5.76679201e+03 5.76679201e+03 5.76679201e+03 0.000e+00 4.767e-10 0.000e+00 0.000e+00
neu 128 3.03451062e+13 3.03451062e+13 3.03451062e+13 0.000e+00 1.151e-09 2.142e-14 2.622e-13
mtx_tridiag 128 1.72569169e+02 1.72569169e+02 1.72569169e+02 0.000e+00 1.526e-09 6.252e-16 1.488e-15
turb_mlt 128 5.47381466e+01 5.47381466e+01 5.47381466e+01 0.000e+00 4.928e-10 0.000e+00 2.101e-14
turb_tdc 128 5.31136162e+01 5.31136162e+01 5.31136162e+01 0.000e+00 3.468e-10 0.000e+00 2.937e-15
auto_diff 1024 1.01556512e+06 1.01556512e+06 1.01556512e+06 0.000e+00 4.839e-09 2.183e-15 2.090e-15
interp_2d 1024 4.61222326e+04 4.61222326e+04 4.61222326e+04 0.000e+00 5.953e-10 0.000e+00 0.000e+00
neu 1024 2.07103315e+14 2.07103315e+14 2.07103315e+14 0.000e+00 1.237e-09 1.772e-12 1.575e-12
mtx_tridiag 1024 1.38152230e+03 1.38152230e+03 1.38152230e+03 0.000e+00 1.767e-09 8.559e-16 2.041e-15
turb_mlt 1024 4.37918538e+02 4.37918538e+02 4.37918538e+02 0.000e+00 2.546e-10 0.000e+00 2.654e-14
turb_tdc 1024 4.24914505e+02 4.24914505e+02 4.24914505e+02 0.000e+00 4.298e-10 0.000e+00 4.404e-15
auto_diff 4096 4.05502565e+06 4.05502565e+06 4.05502565e+06 0.000e+00 1.494e-10 2.170e-15 2.196e-15
interp_2d 4096 1.84483783e+05 1.84483783e+05 1.84483783e+05 0.000e+00 1.769e-10 2.010e-16 0.000e+00
neu 4096 8.14056643e+14 8.14056643e+14 8.14056643e+14 0.000e+00 4.793e-10 6.176e-13 3.208e-13
mtx_tridiag 4096 5.52650461e+03 5.52650461e+03 5.52650461e+03 0.000e+00 5.554e-10 1.053e-15 1.749e-15
turb_mlt 4096 1.75167983e+03 1.75167983e+03 1.75167983e+03 0.000e+00 9.129e-10 0.000e+00 2.977e-14
turb_tdc 4096 1.69966039e+03 1.69966039e+03 1.69966039e+03 0.000e+00 1.140e-09 0.000e+00 4.792e-15

Wave 1 four-way runtime staircase

3. Fortran MESA r26.4.1 & Reference Comparator Results

Workload \(N_{\mathrm{zones}}\) Stage 0 (\(\mu\mathrm{s}\)) Stage 1 (\(\mu\mathrm{s}\)) Stage 2 (\(\mu\mathrm{s}\)) Stage 3 (4t OpenMP) (\(\mu\mathrm{s}\)) Stage 0 / Stage 2 Stage 0 / Stage 3
auto_diff 128 22.14 +/- 0.07 22.12 +/- 0.05 1.77 +/- 0.00 0.83 +/- 0.14 12.51x 26.67x
interp_2d 128 5.74 +/- 0.01 5.68 +/- 0.01 5.31 +/- 0.01 1.71 +/- 0.08 1.08x 3.36x
neu 128 114.98 +/- 8.31 112.79 +/- 8.38 104.21 +/- 6.89 28.52 +/- 0.52 1.10x 4.03x
mtx_tridiag 128 114.60 +/- 0.49 116.29 +/- 2.95 35.42 +/- 0.29 9.00 +/- 0.05 3.24x 12.73x
turb_mlt 128 328.83 +/- 19.24 326.32 +/- 5.97 234.34 +/- 15.69 58.58 +/- 0.21 1.40x 5.61x
turb_tdc 128 6014.63 +/- 131.64 5986.11 +/- 10.98 5986.83 +/- 65.57 1503.34 +/- 17.79 1.00x 4.00x
auto_diff 1024 180.77 +/- 0.36 180.71 +/- 0.41 15.17 +/- 0.19 4.44 +/- 0.04 11.92x 40.71x
interp_2d 1024 43.92 +/- 0.04 43.69 +/- 0.20 40.61 +/- 0.13 10.68 +/- 0.08 1.08x 4.11x
neu 1024 675.38 +/- 32.55 661.79 +/- 19.67 624.76 +/- 24.54 172.02 +/- 6.26 1.08x 3.93x
mtx_tridiag 1024 525.16 +/- 11.52 539.22 +/- 23.98 192.29 +/- 1.18 48.57 +/- 0.68 2.73x 10.81x
turb_mlt 1024 1868.95 +/- 152.98 1818.26 +/- 157.50 1935.34 +/- 303.66 450.28 +/- 5.75 0.97x 4.15x
turb_tdc 1024 49275.51 +/- 1843.92 48482.91 +/- 270.89 48472.22 +/- 729.07 12433.30 +/- 1085.63 1.02x 3.96x
auto_diff 4096 744.66 +/- 14.88 738.81 +/- 11.58 77.78 +/- 1.40 29.92 +/- 0.62 9.57x 24.89x
interp_2d 4096 176.14 +/- 12.39 174.25 +/- 0.15 162.39 +/- 9.72 41.69 +/- 0.12 1.08x 4.22x
neu 4096 2846.80 +/- 72.13 2815.93 +/- 34.46 2544.49 +/- 47.25 910.58 +/- 143.79 1.12x 3.13x
mtx_tridiag 4096 2158.32 +/- 60.43 2161.30 +/- 12.23 789.19 +/- 10.11 196.10 +/- 7.50 2.73x 11.01x
turb_mlt 4096 7178.83 +/- 208.88 7143.01 +/- 81.64 7122.10 +/- 36.78 1797.47 +/- 108.60 1.01x 3.99x
turb_tdc 4096 193020.86 +/- 722.46 198261.00 +/- 3272.75 198002.75 +/- 3503.05 49494.47 +/- 2356.33 0.97x 3.90x

Single-matrix MESA bcyclic_dble_decsolblk OpenMP scaling:

  • N_zones = 128: 116.29 us (1t) -> 56.39 us (4t OpenMP, 2.06x).
  • N_zones = 1024: 539.22 us (1t) -> 218.09 us (4t OpenMP, 2.47x).
  • N_zones = 4096: 2161.30 us (1t) -> 790.11 us (4t OpenMP, 2.74x).

4. Safe Rust (strict, --release) Results

Workload \(N_{\mathrm{zones}}\) Stage 0 (\(\mu\mathrm{s}\)) Stage 1 (\(\mu\mathrm{s}\)) Stage 2 (\(\mu\mathrm{s}\)) Stage 3 (4t rayon) (\(\mu\mathrm{s}\)) Stage 0 / Stage 2 Stage 0 / Stage 3
auto_diff 128 11.71 +/- 0.05 11.62 +/- 0.61 1.66 +/- 0.06 1.00 +/- 0.16 7.05x 11.71x
interp_2d 128 422.97 +/- 16.28 401.64 +/- 13.31 4.45 +/- 0.01 1.23 +/- 0.04 95.05x 343.88x
neu 128 34.65 +/- 0.07 34.59 +/- 0.44 31.57 +/- 0.55 12.80 +/- 0.06 1.10x 2.71x
mtx_tridiag 128 42.32 +/- 0.04 42.20 +/- 0.03 38.98 +/- 0.10 9.71 +/- 0.01 1.09x 4.36x
turb_mlt 128 33.26 +/- 0.21 33.90 +/- 2.17 33.21 +/- 0.93 8.37 +/- 0.08 1.00x 3.97x
turb_tdc 128 262.16 +/- 1.70 264.90 +/- 10.11 261.19 +/- 4.15 79.26 +/- 0.61 1.00x 3.31x
auto_diff 1024 103.88 +/- 0.89 106.25 +/- 8.59 14.06 +/- 1.10 3.14 +/- 0.05 7.39x 33.08x
interp_2d 1024 3393.76 +/- 130.22 3220.97 +/- 189.95 35.51 +/- 0.03 17.73 +/- 0.02 95.57x 191.41x
neu 1024 318.82 +/- 20.70 342.72 +/- 21.52 308.68 +/- 20.92 75.33 +/- 1.98 1.03x 4.23x
mtx_tridiag 1024 423.00 +/- 27.25 357.04 +/- 19.87 317.48 +/- 8.17 81.86 +/- 2.07 1.33x 5.17x
turb_mlt 1024 288.51 +/- 8.19 286.86 +/- 7.70 286.75 +/- 4.87 70.86 +/- 1.65 1.01x 4.07x
turb_tdc 1024 2357.38 +/- 67.65 2338.19 +/- 141.89 2314.80 +/- 41.55 612.69 +/- 93.89 1.02x 3.85x
auto_diff 4096 522.28 +/- 12.24 546.85 +/- 25.54 64.04 +/- 19.00 24.83 +/- 0.45 8.16x 21.03x
interp_2d 4096 13880.22 +/- 382.35 13178.32 +/- 122.16 142.22 +/- 0.35 70.69 +/- 0.09 97.60x 196.35x
neu 4096 1591.00 +/- 8.54 1596.69 +/- 22.23 1446.90 +/- 48.00 364.84 +/- 23.89 1.10x 4.36x
mtx_tridiag 4096 1651.34 +/- 14.76 1405.66 +/- 19.48 1294.80 +/- 35.91 323.73 +/- 5.91 1.28x 5.10x
turb_mlt 4096 1207.81 +/- 26.18 1194.61 +/- 9.80 1203.47 +/- 21.51 300.97 +/- 14.96 1.00x 4.01x
turb_tdc 4096 9399.96 +/- 429.78 9649.41 +/- 593.23 9658.27 +/- 401.27 2566.56 +/- 52.76 0.97x 3.66x

5. Python / PyO3 & JAX float64 Results

Workload \(N_{\mathrm{zones}}\) Stage 0 PyO3 1t (\(\mu\mathrm{s}\)) Stage 1 PyO3 4t (\(\mu\mathrm{s}\)) Stage 2 JAX @jit (\(\mu\mathrm{s}\)) Stage 2 Compile (\(\mathrm{ms}\)) Stage 3 JAX vmap (\(\mu\mathrm{s}\)) Stage 3 Compile (\(\mathrm{ms}\))
auto_diff 128 12.25 +/- 0.39 5.25 +/- 0.86 1271.57 +/- 18.34 176.1 318.92 +/- 16.11 148.4
interp_2d 128 6.30 +/- 0.05 4.29 +/- 0.35 1278.80 +/- 17.32 340.3 325.44 +/- 4.47 331.8
neu 128 34.93 +/- 0.89 11.60 +/- 0.52 1321.60 +/- 112.19 2187.5 327.06 +/- 6.06 2138.4
mtx_tridiag 128 43.29 +/- 7.10 2204.23 +/- 1791.24 1669.78 +/- 43.66 387.1 444.64 +/- 265.12 272.7
turb_mlt 128 34.52 +/- 0.35 9.73 +/- 0.65 1275.75 +/- 14.23 163.0 317.87 +/- 4.62 163.2
turb_tdc 128 270.99 +/- 37.09 67.90 +/- 4.30 1560.25 +/- 83.37 330.8 395.10 +/- 11.94 368.8
auto_diff 1024 106.44 +/- 9.20 28.49 +/- 3.84 1278.59 +/- 61.65 142.1 321.21 +/- 7.57 148.9
interp_2d 1024 37.52 +/- 0.08 12.76 +/- 1.48 1288.11 +/- 5.98 306.0 320.17 +/- 18.22 341.7
neu 1024 331.83 +/- 31.16 88.90 +/- 21.10 1295.07 +/- 30.43 3276.4 357.90 +/- 36.61 1867.4
mtx_tridiag 1024 339.01 +/- 41.50 927.31 +/- 443.76 3128.79 +/- 593.70 327.9 1083.25 +/- 89.01 315.2
turb_mlt 1024 302.92 +/- 31.90 74.67 +/- 75.15 1261.12 +/- 48.77 161.8 322.82 +/- 4.24 166.9
turb_tdc 1024 2301.85 +/- 321.55 627.03 +/- 39.38 1592.51 +/- 105.08 317.1 407.68 +/- 28.50 361.8
auto_diff 4096 518.37 +/- 32.10 119.04 +/- 26.46 1275.88 +/- 12.89 149.2 314.17 +/- 2.75 124.9
interp_2d 4096 146.05 +/- 3.03 81.34 +/- 10.73 1312.13 +/- 43.95 322.8 318.67 +/- 32.28 349.6
neu 4096 1538.78 +/- 23.44 394.43 +/- 21.09 1350.53 +/- 80.66 2003.6 330.96 +/- 17.81 1943.9
mtx_tridiag 4096 1380.73 +/- 72.60 2512.93 +/- 2260.89 7451.55 +/- 244.53 356.8 2795.65 +/- 6317.92 413.6
turb_mlt 4096 1199.69 +/- 22.10 297.82 +/- 8.13 283.67 +/- 1058.68 159.8 68.38 +/- 272.29 162.0
turb_tdc 4096 9333.87 +/- 84.45 2505.69 +/- 160.09 1562.54 +/- 245.87 335.5 391.66 +/- 42.00 356.6

6. Key Wave 1 Findings (\(N_{\mathrm{zones}} = 4096\))

  1. IFT + DualOrder1<6> on turb_mlt and turb_tdc: At 4 threads, Safe Rust runs turb_mlt in 300.97 us vs. 1797.47 us in MESA set_MLT (5.97x), and turb_tdc in 2566.56 us vs. 49494.47 us in MESA set_TDC (19.28x); batched GPU @jax.jit(jax.vmap) evaluates turb_tdc in 391.66 us per profile (126.37x).
  2. Workloads where Fortran is faster: At 4 threads, Fortran MESA is faster than Safe Rust on interp_2d (41.69 us vs. 70.69 us, 0.59x), and Reference Fortran batch Thomas (fast_block_thomas_solve) is faster on mtx_tridiag (196.10 us vs. 323.73 us, 0.61x).