Repository navigation
[gpu-2] Benchmark script for VlasovAmpere and VlasovMaxwell - #735
Merged
Merged
Conversation
max-models
marked this pull request as draft
October 8, 2026 13:34
max-models
added this pull request to stack #729
October 12, 2026 12:10
max-models
force-pushed
the
gpu-2-vlasov-benchmark
branch
from
October 12, 2026 12:32
a753483 to
71356ad
Compare
max-models
marked this pull request as ready for review
October 12, 2026 19:05
spossann
reviewed
Oct 13, 2026
spossann
left a comment
Member
There was a problem hiding this comment.
Let's use the scope-profiler instead.
profiling/benchmarks/vlasov_benchmark.py runs a fixed number of time steps of a standard problem on the NumPy or CuPy backend and reports setup time, time per step and per propagator, cost per marker and step, and the host/device transfers of the time loop (optionally as JSON). - Cases: weak Landau damping (both models, the verification tests' setup) and the Weibel instability (Vlasov-Maxwell, Kraus et al. 2017: anisotropic Maxwellian, B3 seed). - Sizes smoke / standard / large (8 cells x 50 ppc, 32 x 1000, 128 x 20000), all overridable. - Every timed region ends with xp.synchronize(); times are the maximum over MPI ranks. - On the fake CuPy the CUDA launches are emulated, as a no-GPU check of the device code path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
max-models
force-pushed
the
gpu-2-vlasov-benchmark
branch
from
October 13, 2026 08:07
dc14651 to
0db6d8a
Compare
spossann
approved these changes
Oct 13, 2026
max-models
added a commit
that referenced
this pull request
Oct 13, 2026
Building multiple polar projector and mass-preconditioner instances repeatedly factorizes identical matrices and creates duplicate device copies. This change shares live 1D and poloidal factors across the polar spaces of one Derham object. **Stack:** based on `gpu-2-vlasov-benchmark` (#735), as the next PR in the GPU stack. The cache matches exact canonical sparse matrix contents and dtype, solver kind and ILU settings, Schur pole masks/outer factors, and backend/device. It reuses both host factorizations and their cached GPU solves. Boundary-condition and transposed variants share only when their matrices and configurations actually match. Updated mass weights obtain new poloidal factors while retaining unchanged 1D factors. Entries use weak references: live solvers keep their factors, while obsolete factors and their keys are released when no solver uses them. Different Derham objects have separate caches. In the small-cylinder fixture, constructing all four solve variants for P0–P3 reduces sparse LU calls from **88 to 9**, and dense Schur LU calls from **24 to 8**. Validation: - Cache tests cover sparse storage normalization, exact value/dtype matching, solver settings, Schur structure, transpose separation, mass-weight updates, lifetime cleanup and isolation between Derham objects/backends. - Serial polar/cache/backend regression suite: **57 passed, 19 skipped**. - Two MPI ranks, polar and cache tests: **50 passed, 1 skipped per rank**. - NVIDIA T1000, CuPy 14.2.0: **7 GPU cases passed**, including both mappings and all three solvers; shared-device-factor reuse also passes after the final ownership change. - Reusing warmed GPU factors introduces no cunumpy host/device transfers. - Ruff lint/formatting, `git diff --check`, and commit hooks passed. Assembly kernels compiled with GNU/Fortran for local verification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solves the following issue(s):
The "first CPU vs GPU timing" item of #689, tracked in #650. This PR provides the script and a CPU baseline. The GPU numbers come from running it on the H100 (#687).
Stack: gpu-2. Merge it after gpu-1 (
gpu-1-vlasov-ampere-e2e), which is its base, once all the CUDA PRs are in.Core changes:
New script
profiling/benchmarks/vlasov_benchmark.py. It runs a fixed number of time steps of a standard problem withVlasovAmpereOneSpeciesorVlasovMaxwellOneSpecies, on the NumPy or the CuPy backend, and reports:cunumpy.profiling.count_transfers);--json), to compare runs.Cases:
landauweibelAll runs use
alpha = 1,epsilon = -1, as the verification tests do. The initial magnetic energy of the Weibel seed matches the analytic value (1.2551e-8 vs 1.2566e-8). The growth rate was not checked, since that needs thousands of steps.Sizes:
smoke(8 cells × 50 ppc, 3 steps),standard(32 × 1000, 20 steps),large(128 × 20000 = 2.56M markers, 20 steps). Grid, degree, ppc, steps and dt can all be overridden.Timing details:
xp.synchronize(), and times are the maximum over MPI ranks.--no-propagator-timing.CUNUMPY_FAKE_CUPY=1 ... --backend cupy --size smoke), the CUDA launches are emulated on the CPU. That checks the device code path without a GPU, but its times are not GPU timings, and the report says so.CPU baseline (NumPy,
--size standard: 32k markers, 20 steps, 1 rank, Apple M-series laptop):VlasovAmpereCouplingshareTesting: all three cases at
--size smokeand--size standardon NumPy; VlasovMaxwellweibelat--size smokeon the fake CuPy (all four propagators ran, with no host kernels and no host-to-device copies in the time loop). Not run on a GPU.Documentation changes: the script's docstring (usage, cases, sizes, CPU reference).
🤖 Generated with Claude Code