Skip to content

Add new application: petsc-gmres - #87

Merged
yoshifuminakamura merged 1 commit into
RIKEN-RCCS:developfrom
william-dawson:add-petsc-gmres
Aug 28, 2026
Merged

Add new application: petsc-gmres#87
yoshifuminakamura merged 1 commit into
RIKEN-RCCS:developfrom
william-dawson:add-petsc-gmres

Conversation

@william-dawson

@william-dawson william-dawson commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

A PETSc KSP (GMRES + GAMG) benchmark, verified on Rikyu, Fugaku, and R-CCS Cloud's DGX Spark. [code:petsc-gmres]

@yoshifuminakamura

Copy link
Copy Markdown
Collaborator

Thanks for the detailed validation notes. One current blocker is DCO: the check is failing on this draft PR. Could you please add Signed-off-by lines to the commits that are missing them, or otherwise update the branch so the DCO check passes?

@william-dawson

Copy link
Copy Markdown
Contributor Author

GPU scaling re-measured under the iterate-only FOM

Per Suzuki-san's recommendation, the FOM now measures only the GMRES iterate (ksp_iter_time_s), with KSPSetUp called explicitly before the timed KSPSolve so GAMG setup is excluded. Re-measured on Rikyu (GB200 NVL4, 2026-08-17):

GPUs solve_time_s (old, setup-inclusive) ksp_iter_time_s (new, iterate-only) relative L2
1 1.55 0.129 0.0443346
2 5.81 0.211 0.0342875
4 6.04 0.183 0.03154

Setup was 91-97% of the old FOM — even more dominant than the 70% -log_view reported. Under the iterate-only FOM, 1 GPU still wins (0.129s), but the gap narrowed from ~4x to ~1.5x. Notably, 4 GPUs now beats 2 GPUs (0.183 vs 0.211), reversing the old near-tie — the iterate does parallelize, just not enough at 943k rows (~236k rows/GPU at 4 GPUs) to overtake 1 GPU. A larger matrix is the honest next test of whether multi-GPU can win under the iterate-only FOM.

Correctness held throughout (L2 in the expected 0.03-0.04 band, bit-identical to the old runs at each GPU count).

@william-dawson

Copy link
Copy Markdown
Contributor Author

stokes2 matrix — full three-machine results (iterate-only FOM)

Switched the benchmark matrix from audikw_1 (943k rows, SPD structural mechanics) to stokes2 (4.26M rows, Stokes flow saddle-point system, generated via Gmsh/FreeFEM by Suzuki-san). Already in PETSc binary format (FreeFEM ObjectView = MatView), so no mtx2petsc conversion needed. KSPSolve is ~10× KSPSetUp (confirmed via -log_view), so the iterate dominates — the iterate-only FOM is the right metric.

Rikyu (GB200 NVL4, GPU, 1 rank/GPU)

GPUs ksp_iter_time_s iterations relative L2 speedup
1 1.497 232 0.2516 1.00x
2 0.932 200 0.2566 1.61x
4 0.683 193 0.2278 2.19x

Multi-GPU now wins — at ~1M rows/GPU there is enough work to amortize communication. Compare with audikw_1 under the same FOM: 1 GPU 0.129s, 4 GPU 0.183s (1.41× slower). The larger matrix flips the conclusion.

Fugaku (A64FX, multi-node CPU, 48 ranks/node, f-pt queue)

nodes ranks ksp_iter_time_s relative L2 speedup
1 48 44.881 0.2663 1.00x
2 96 28.532 0.2582 1.57x
4 192 16.777 0.2317 2.67x
8 384 15.959 0.2641 2.81x

Clean scaling through 4 nodes (2.67× at 4× ranks), then nearly flat 4→8 (2.81× at 8× ranks) — communication wall hits ~192 ranks for this problem size on A64FX.

DGX Spark (GB10 Blackwell, 1 GPU)

machine GPU ksp_iter_time_s relative L2
Rikyu B200 1.497 0.2516
DGX Spark GB10 21.430 0.2516

Correctness bit-identical (L2 0.251638 on both). 14.3× slowdown on GB10 vs B200 — larger than audikw_1's 5.2×, since the larger matrix stresses memory bandwidth more and GB10 has a smaller bandwidth budget.

Summary

All three machines validated via test_submit.sh with the stokes2.dat data staged at the per-system paths in run.sh. The f-pt queue was used for the Fugaku multi-node runs (wider node range than small); the committed list.csv/system.csv stay on small.

@william-dawson
william-dawson marked this pull request as ready for review August 17, 2026 10:01
@william-dawson
william-dawson marked this pull request as draft August 17, 2026 10:01
@yoshifuminakamura

Copy link
Copy Markdown
Collaborator

@william-dawson #134 has been merged into develop/main and addresses the common scheduler/CI side that came up while reviewing this PR.

Could you please rebase #87 onto the latest develop and update it accordingly?

  • Fugaku project group selection should now use BK_ALLOCATION_PROJECT_ID, so the BK_PJM_GROUP / scripts/test_submit.sh change in this PR should be dropped.
  • The RC_DGXSP MATHLIBS assignment should be fixed; the current glob-in-scalar-assignment form is caught by the new warning-level shellcheck for changed app scripts.
  • After rebasing, please rerun CI against the latest develop.

This should keep #87 focused on the petsc-gmres app addition while the common scheduler/CI handling stays in #134.

@yoshifuminakamura

Copy link
Copy Markdown
Collaborator

@william-dawson Thanks for the update. I checked the latest head and the previous blocker around the DGX Spark MATHLIBS glob is fixed. The PR is also based on the current develop, CI is green, and I do not see the large input data included in the PR.

One small cleanup before review/merge: programs/petsc-gmres/src/GMRES-PETSc.cpp still has an old top-of-file comment that refers to audikw_1, MatrixMarket, and .petscbin, while the app has moved to stokes2.dat generated via FreeFEM/ObjectView. Could you update that comment so it matches the current README/run.sh behavior?

If that is the only remaining item on your side, please also mark the PR ready for review / undraft after the cleanup.

@william-dawson
william-dawson marked this pull request as ready for review August 28, 2026 03:19
@william-dawson

Copy link
Copy Markdown
Contributor Author

Updated the top-of-file comment and usage string in GMRES-PETSc.cpp to replace the stale audikw_1 / MatrixMarket / .petscbin references with stokes2 / FreeFEM ObjectView / stokes2.dat, matching the current README and run.sh. Also corrected SPD matrixStokes flow saddle-point system and solve wall-timeGMRES-iterate wall-time to reflect the iterate-only FOM. PR is marked ready for review.

@william-dawson
william-dawson force-pushed the add-petsc-gmres branch 2 times, most recently from 92aedbd to 4273bb8 Compare August 28, 2026 07:00
A PETSc KSP (GMRES + GAMG) benchmark, verified on Rikyu, Fugaku, and
R-CCS Cloud's DGX Spark.

FOM measures the GMRES iteration only: KSPSetUp runs untimed before
the timed KSPSolve, so GAMG setup is excluded. A per-routine
breakdown -- MatMult, KSPSolve, SF pack/unpack, from PETSc's
-log_view -- ships as both a results/fom_details.txt artifact and
SECTION lines. BK_PETSC_GMRES_RESTART overrides the GMRES restart
parameter; BK_PETSC_GMRES_MATRIX selects the benchmark matrix.

The benchmark matrix is stokes2, a 4.26M-row / 256M-nnz Stokes-flow
saddle-point system.

On Rikyu, PETSc builds with CUDA; run.sh uses -mat_type aijcusparse
and binds each MPI rank to a distinct GPU via CUDA_VISIBLE_DEVICES,
with a CUDA context established before PetscInitialize calls
MPI_Init so multi-node GPU runs work correctly. On Fugaku, the app
stages its matrix data on group storage volume /vol0005 via the
/vol0500 mount alias. build.sh anchors the vendored source to its own
script location, so the build resolves regardless of the caller's
working directory.

Signed-off-by: William Dawson <william.dawson@riken.jp>
Co-Authored-By: Claude <noreply@anthropic.com>
@yoshifuminakamura
yoshifuminakamura merged commit 31688d0 into RIKEN-RCCS:develop Aug 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants