Port ILU to GPU - #2858
Merged
Merged
Conversation
Colored-iterative forward/backward substitution needed too many sweeps to be useful on stiffer systems (e.g. large RANS cases with highly anisotropic near-wall cells), so the triangular solves go back to exact, level-scheduled kernels (one pass, no sweep count). The factorization stays colored/iterative, which converges quickly regardless of matrix stiffness. LINEAR_SOLVER_ILU_GPU_SWEEPS is now a single scalar (build sweeps only) instead of a 3-entry array, since the solves no longer sweep. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Consolidates LINEAR_SOLVER_ILU_FILL_IN, LINEAR_SOLVER_ILU_LEVEL_SCHEDULING, and LINEAR_SOLVER_ILU_GPU_SWEEPS behind one struct/getter (GetIluOptions), following the same pattern already used for other option families (e.g. CMGOptions). Config keys and defaults are unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
pcarruscag
commented
Aug 8, 2026
- CSysMatrix.hpp: trim member-doc comments down to what the members are, drop design/alternatives narrative and CUDA-graph rationale duplicated at the call sites. - CSysMatrix.cpp: factor repeated GPU LDU free/alloc sequences into local helper lambdas (freeLDU, reused GPUAllocAndInit/GPUAllocAndCopy); factor the repeated "GPU dispatch unavailable" error into one GPUNotAvailable(CURRENT_FUNCTION) helper. - Move the static nVar==nEqn / nVar*nVar<=1024 validity checks for the GPU Jacobi/ILU/SpMV paths from every Build/Compute call into Initialize(), where CUDA and the block size are already known and the check only needs to run once. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Single-seed RCM grows from one peripheral, minimum-degree node, so the number of BFS levels tracks the mesh graph diameter. Since the GPU ILU triangular solves are level-scheduled (one kernel launch per level), this produces hundreds of narrow, serialized launches on large meshes. Adds RCM_NUM_SEEDS (default 1, unchanged behavior) to seed the RCM growth from multiple fronts chosen by farthest-point sampling, which bounds the number of levels by the seed set's covering radius instead of the full component diameter while keeping the ordering locally RCM-like around each front. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Picking numSeeds seeds by restarting a full multi-source BFS for each one costs O(numSeeds * (V+E)) and dominates SetRCM_Ordering for large numSeeds. Maintaining the nearest-seed distance incrementally instead - relaxing only the points a new seed brings strictly closer - reuses prior work across rounds and keeps the total cost close to a single BFS. Measured on oneram6 (38k points): 121ms -> 11ms for 128 seeds. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Prints, once per rank-reduced worst case, the number of colors used to schedule the factorization and the number of levels used to schedule the triangular solves, plus their average group size. Narrow levels are the direct symptom of a mesh needing more RCM_NUM_SEEDS. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Initialize() runs once per multigrid level, so the report was printed once per level; a function-local static now gates it to a single print per run. Also trims the message to the two numbers that matter. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
9 tasks
pcarruscag
pushed a commit
that referenced
this pull request
Sep 1, 2026
This PR ports the LU-SGS preconditioner to GPU ## Proposed Changes This PR introduces a build phase for the LU-SGS preconditioner where the inverse of the diagonal D is calculated to facilitate the compute phase. Then, forward and backward sweeps are implemented through custom CUDA kernels matching the logic of the CPU section (except for the inverse of D, which is directly multiplied in the GPU logic). These kernels are managed by the compute method on GPU which maintains the MPI communications. ## Related Work This PR follows the discussion of #2843 . Kernel level dependencies are managed as for the ILU preconditioner proposed in #2858 . ## Validation CPU and GPU implementations of the LU-SGS preconditioner are compared for validation of this PR on the rae2822 test-case. After one iteration, the first, preconditioned Krylov vector is compared finding matching results down to machine precision. Residuals are compared after 100 iterations finding matching results. ## TO-DO - [X] complete with the quantized_mode option path; - [ ] run benchmarks on modern GPUs. Current evaluations on a P620 are inconclusive; - [ ] profiling of the custom kernels; ## PR Checklist *Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.* - [X] I am submitting my contribution to the develop branch. - [X] My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson). - [X] My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/). - [X] I used the pre-commit hook to prevent dirty commits and used `pre-commit run --all` to format old commits. - [ ] I have added a test case that demonstrates my contribution, if necessary. - [ ] I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary. --------- Co-authored-by: Nijso <bigfootedrockmidget@hotmail.com>
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.
PR Checklist
pre-commit run --allto format old commits.