Skip to content

Disable debug info printing for HykktSolver - #475

Merged
pelesh merged 7 commits into
developfrom
andrew/hykkt-solver-refactor-printing
Sep 25, 2026
Merged

pelesh merged 7 commits into
developfrom
andrew/hykkt-solver-refactor-printing

Conversation

@andrewxu319

Copy link
Copy Markdown
Collaborator

Description

HykktSolver prints debug info (conjugate gradient iteration count and error, and overall solver error). This change disables this by default and instead logs it with verbosity level misc. Resolves #474.

Proposed changes

Log debug info using the logger.

Set logger verbosity level to EVERYTHING in HykktSolverTests and HykktSCCGTests before calling solve.

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

… final error by default. Log them with verbosity level misc.
@andrewxu319
andrewxu319 requested a review from pelesh September 24, 2026 02:36
@andrewxu319

Copy link
Copy Markdown
Collaborator Author

I don't have HiOp set up, so I didn't test it there.

@pelesh pelesh 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.

In principle, solver should not print data for routine operations. This is something that can be monitored with debugger.

The solver should only log the error messages such as in the case when it does not converge after max number of iterations is reached.

If we need solver statistics, we should store number of iterations, error norms, etc., in member variables, but this is beyond the scope of this PR. Here I suggest simply removing solver outputs except in the case of convergence failure.

Comment thread resolve/hykkt/HyKKTSolver.cpp Resolved
Comment thread tests/unit/hykkt/HykktSCCGTests.hpp Resolved
Comment thread tests/unit/hykkt/HykktSolverTests.hpp Resolved
@pelesh pelesh added the bug Something isn't working label Sep 24, 2026
@andrewxu319

Copy link
Copy Markdown
Collaborator Author

In principle, solver should not print data for routine operations. This is something that can be monitored with debugger.

The solver should only log the error messages such as in the case when it does not converge after max number of iterations is reached.

If we need solver statistics, we should store number of iterations, error norms, etc., in member variables, but this is beyond the scope of this PR. Here I suggest simply removing solver outputs except in the case of convergence failure.

Fixed. I moved all prints from the solvers into the tests themselves. Made solve() return relevant quantities in as return values. HykktSolver used to return different values depending on whether ||b|| == 0 (either ||Ax-b|| / ||b|| or ||Ax-b||). I standardized this by making solve() always return ||Ax-b|| and letting the caller (such as the test module) compute ||b|| if needed.

@andrewxu319
andrewxu319 requested a review from pelesh September 24, 2026 15:56

@pelesh pelesh 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.

Two minor issues to address and we are ready to merge.

Comment thread tests/unit/hykkt/HykktSolverTests.hpp Resolved
@pelesh

pelesh commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

I standardized this by making solve() always return ||Ax-b|| and letting the caller (such as the test module) compute ||b|| if needed.

To be consistent with the rest of Re::Solve code, the solve() function should return only 0, if successful or error code otherwise. The error norm should be returned by a separate function. You already have errorCheck() function. Why not use that in the tests?

@andrewxu319

Copy link
Copy Markdown
Collaborator Author

I standardized this by making solve() always return ||Ax-b|| and letting the caller (such as the test module) compute ||b|| if needed.

To be consistent with the rest of Re::Solve code, the solve() function should return only 0, if successful or error code otherwise. The error norm should be returned by a separate function. You already have errorCheck() function. Why not use that in the tests?

Fixed. Now both solve() functions only return a status code (0 or 1). Added getters for error in both solvers, and for iteration count in SchurComplementConjugateGradient. The tests use these getters and only print when they fail.

@pelesh
pelesh merged commit 935d1d4 into develop Sep 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: HyKKT prints debugging output on stdout

2 participants