Skip to content

Refactor SystemSolver - #477

Merged
shakedregev merged 16 commits into
developfrom
slaven/system-solver-refactor
Oct 5, 2026
Merged

shakedregev merged 16 commits into
developfrom
slaven/system-solver-refactor

Conversation

@pelesh

@pelesh pelesh commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Refactor SystemSolver class to check configuration conflicts.

Proposed changes

Add helper functions to check and fix conflicts in configuration options and to reduce code duplication.

Checklist

  • All tests pass (make test and make test_install per testing instructions). Code tested on
    • CPU backend
    • CUDA backend
    • HIP backend
  • I have manually run the non-experimental examples and verified that residuals are close to machine precision. (In your build directory run: ./examples/<your_example>.exe -h to get instructions how to run examples). Code tested on:
    • CPU backend
    • CUDA backend
    • HIP backend
  • Code compiles cleanly with flags -Wall -Wpedantic -Wconversion -Wextra.
  • The new code follows Re::Solve style guidelines.
  • There are unit tests for the new code.
  • The new code is documented.
  • The feature branch is rebased with respect to the target branch.
  • I have updated CHANGELOG.md to reflect the changes in this PR. If this is a minor PR that is part of a larger fix already included in the file, state so.

Further comments

The diff in SystemSolver.cpp is pretty big, I suggest reviewing as new file, not the differences with respect to earlier version.

@kakeueda

kakeueda commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Looks good, it's nice to see smart pointers used in the class.
All tests and examples also passed on my local CUDA setup (NVIDIA GeForce RTX 5050 Laptop GPU).

@shakedregev shakedregev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still need to test this. On general it looks good. We may want to switch out the quiet defaulting as I flagged in one place.

Comment thread resolve/LinSolverDirectKLU.cpp Resolved
Comment thread resolve/SystemSolver.cpp Resolved
Comment thread resolve/SystemSolver.cpp Resolved
Comment thread resolve/SystemSolver.cpp Resolved
Comment thread resolve/SystemSolver.cpp
Comment on lines +1089 to +1094
if (ir_method_ != "none")
{
out::warning() << "Incorrect input: iterative refinement cannot be enabled "
<< "together with iterative solve method '" << solve_method_
<< "'. Setting refinement method to 'none' ...\n";
ir_method_ = "none";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I prefer to throw an error here. We cannot know if the user intended to use an iterative solver without refinement, or wanted to use a direct solver with refinement. Same applies to other places in the code.

Co-authored-by: Shaked Regev <35384901+shakedregev@users.noreply.github.com>

@shakedregev shakedregev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests pass. Leaving it up to you if we want to make the defaulting fixes this time around or in another PR.

@shakedregev
shakedregev merged commit f850ecd into develop Oct 5, 2026
@shakedregev
shakedregev deleted the slaven/system-solver-refactor branch October 5, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants