Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f469ac5
ABBA GMRES Commit
JeffZ594 Feb 20, 2026
d7716e2
Added check for preconditioner being set
JeffZ594 Feb 22, 2026
7ab3e29
Use Preconditioner Class for ABBAGMRES
JeffZ594 Feb 24, 2026
df69725
Apply pre-commmit fixes
JeffZ594 Feb 23, 2026
d8c6f39
Apply pre-commmit fixes
JeffZ594 Feb 24, 2026
0104791
Update resolve/PreconditionerMatvec.cpp
JeffZ594 Feb 25, 2026
1032c26
Update resolve/LinSolverIterativeFGMRES.cpp
JeffZ594 Feb 25, 2026
d2a590e
Update resolve/Preconditioner.hpp
JeffZ594 Feb 25, 2026
4bb1fac
Apply pre-commmit fixes
JeffZ594 Feb 25, 2026
0588909
Renamed PreconditionerMatvec to PreconditionerABBA
JeffZ594 Feb 25, 2026
8c899bd
Apply pre-commmit fixes
JeffZ594 Feb 25, 2026
e620de1
Fix left preconditioning and add corresponding tests
kakeueda Mar 4, 2026
8e55d7d
Fix typo and some comments
kakeueda Mar 4, 2026
2714e54
Apply precommit and update CHANGELOG.md
kakeueda Mar 4, 2026
b0f3ebb
Update CHANGELOG.md
kakeueda Mar 4, 2026
8be5465
Use preconditioned bnorm in RandFGMRES
kakeueda Mar 4, 2026
68807d0
Apply pre-commmit fixes
kakeueda Mar 4, 2026
f34279f
Remove unnecessary variables
kakeueda Mar 4, 2026
25d85e8
Apply pre-commmit fixes
kakeueda Mar 4, 2026
ca953b9
[skip ci] Update CHANGELOG.md
pelesh Mar 18, 2026
4d36a83
Fix norm evaluation in GMRES
kakeueda Mar 19, 2026
03175f7
Fix naming and error check
kakeueda Mar 19, 2026
1c28d2e
[skip ci] Move #pragma above
kakeueda Mar 19, 2026
4238c7f
[skip ci] Fix typo
kakeueda Mar 19, 2026
258c058
Apply suggestions from code review
shakedregev Mar 19, 2026
581a946
Fix naming and comment
kakeueda Mar 19, 2026
36cebb1
Refactor preconditioner side to use enum
kakeueda Apr 2, 2026
d83452c
Apply formatting
kakeueda Apr 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,6 @@ It is seamless from the user perspective and fixed many bugs.

16. Updated MatrixHandler::addConst to return integer error codes instead of void.

17. Added a preconditioner interface class so users can define thier own preconditioners.
17. Added a preconditioner interface class so users can define their own preconditioners.

18. Added left preconditioning support for GMRES and a user-defined preconditioner class.
6 changes: 3 additions & 3 deletions examples/ExampleHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ namespace ReSolve
}

res_->copyFromExternal(r_, memspace_, memspace_);
real_type norm = computeResidualNorm(*A_, *x_, *res_, memspace_);
real_type rnorm = norm2(*r_, memspace_);
real_type norm = computeResidualNorm(*A_, *x_, *res_, memspace_);
real_type rhs_norm = norm2(*r_, memspace_);

std::cout << "\t2-Norm of the residual: "
<< std::scientific << std::setprecision(16)
<< norm / rnorm << "\n";
<< norm / rhs_norm << "\n";
}

/// Summary of direct solve
Expand Down
4 changes: 2 additions & 2 deletions examples/experimental/r_KLU_rf_FGMRES_reuse_factorization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ int main(int argc, char* argv[])
<< status << std::endl;
vec_rhs->copyFromExternal(rhs, ReSolve::memory::HOST, ReSolve::memory::DEVICE);
status = Rf->solve(vec_rhs, vec_x);
ReSolve::PreconditionerLU precond_lu(Rf);
FGMRES->setPreconditioner(&precond_lu);
ReSolve::PreconditionerLU preconditioner(Rf);
FGMRES->setPreconditioner(&preconditioner);
}
// if (i%2!=0) vec_x->setToZero(ReSolve::memory::DEVICE);
real_type norm_x = vector_handler->dot(vec_x, vec_x, ReSolve::memory::DEVICE);
Expand Down
4 changes: 2 additions & 2 deletions examples/gpuRefactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ int gpuRefactor(int argc, char* argv[])
{
// Setup iterative refinement
FGMRES.resetMatrix(A);
ReSolve::PreconditionerLU precond_lu(&Rf);
FGMRES.setPreconditioner(&precond_lu);
ReSolve::PreconditionerLU preconditioner(&Rf);
FGMRES.setPreconditioner(&preconditioner);

// If refactorization produced finite solution do iterative refinement
if (std::isfinite(helper.getNormRelativeResidual()))
Expand Down
4 changes: 2 additions & 2 deletions examples/kluFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ int main(int argc, char* argv[])
{
// Setup iterative refinement
FGMRES.setup(A);
ReSolve::PreconditionerLU precond_lu(&KLU);
FGMRES.setPreconditioner(&precond_lu);
ReSolve::PreconditionerLU preconditioner(&KLU);
FGMRES.setPreconditioner(&preconditioner);

// If refactorization produced finite solution do iterative refinement
if (std::isfinite(helper.getNormRelativeResidual()))
Expand Down
4 changes: 2 additions & 2 deletions examples/kluRefactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ int main(int argc, char* argv[])
{
// Setup iterative refinement
FGMRES.setup(A);
ReSolve::PreconditionerLU precond_lu(KLU);
FGMRES.setPreconditioner(&precond_lu);
ReSolve::PreconditionerLU preconditioner(KLU);
FGMRES.setPreconditioner(&preconditioner);

// If refactorization produced finite solution do iterative refinement
if (std::isfinite(helper.getNormRelativeResidual()))
Expand Down
11 changes: 6 additions & 5 deletions examples/randGmres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int runGmresExample(int argc, char* argv[])

GramSchmidt GS(&vector_handler, GramSchmidt::CGS2);

precon_type Precond(&workspace);
precon_type precondition_solver(&workspace);
LinSolverIterativeRandFGMRES FGMRES(&matrix_handler,
&vector_handler,
LinSolverIterativeRandFGMRES::cs,
Expand Down Expand Up @@ -170,15 +170,16 @@ int runGmresExample(int argc, char* argv[])

matrix_handler.setValuesChanged(true, memspace);

Precond.setup(A);
FGMRES.setRestart(150);
FGMRES.setMaxit(2500);
FGMRES.setTol(1e-12);
FGMRES.setup(A);

FGMRES.resetMatrix(A);
ReSolve::PreconditionerLU precond_lu(&Precond);
FGMRES.setPreconditioner(&precond_lu);

ReSolve::PreconditionerLU preconditioner(&precondition_solver);
preconditioner.setup(A);

FGMRES.setPreconditioner(&preconditioner);
FGMRES.setFlexible(1);

FGMRES.solve(vec_rhs, vec_x);
Expand Down
19 changes: 15 additions & 4 deletions examples/sysGmres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ void printHelpInfo()
std::cout << "\t-g <gs method> \tGram-Schmidt method: cgs1, cgs2, or mgs (default 'cgs2').\n";
std::cout << "\t-s <sketching method> \tSketching method: count or fwht (default 'count')\n";
std::cout << "\t-x <flexible> \tEnable flexible: yes or no (default 'yes')\n\n";
std::cout << "\t-p <preconditioner side> \tPreconditioner side: left or right (default 'right')\n\n";
}

//
Expand All @@ -56,7 +57,8 @@ static int sysGmres(int argc, char* argv[]);
static void processInputs(std::string& method,
std::string& gs,
std::string& sketch,
std::string& flexible);
std::string& flexible,
std::string& side);

/// Main function selects example to be run
int main(int argc, char* argv[])
Expand Down Expand Up @@ -164,7 +166,10 @@ int sysGmres(int argc, char* argv[])
opt = options.getParamFromKey("-x");
std::string flexible = opt ? (*opt).second : "yes";

processInputs(method, gs, sketch, flexible);
opt = options.getParamFromKey("-p");
std::string side = opt ? (*opt).second : "right";

processInputs(method, gs, sketch, flexible, side);

std::cout << "Matrix file: " << matrix_pathname << "\n"
<< "RHS file: " << rhs_pathname << "\n";
Expand Down Expand Up @@ -247,7 +252,7 @@ int sysGmres(int argc, char* argv[])
// Set up the preconditioner
if (return_code == 0)
{
status = solver.preconditionerSetup();
status = solver.preconditionerSetup(side);
std::cout << "solver.preconditionerSetup returned status: " << status << "\n";
if (status != 0)
{
Expand Down Expand Up @@ -281,7 +286,7 @@ int sysGmres(int argc, char* argv[])
return return_code;
}

void processInputs(std::string& method, std::string& gs, std::string& sketch, std::string& flexible)
void processInputs(std::string& method, std::string& gs, std::string& sketch, std::string& flexible, std::string& side)
{
if (method == "randgmres")
{
Expand Down Expand Up @@ -314,4 +319,10 @@ void processInputs(std::string& method, std::string& gs, std::string& sketch, st
std::cout << "Setting flexible to the default (yes).\n\n";
flexible = "yes";
}

if ((side != "left") && (side != "right"))
{
std::cout << "Preconditioning side " << side << " not recognized.\n";
std::cout << "Setting preconditioning side to the default (right).\n\n";
}
}
2 changes: 2 additions & 0 deletions resolve/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(ReSolve_SRC
SystemSolver.cpp
Preconditioner.cpp
PreconditionerLU.cpp
PreconditionerUserMatrix.cpp
)

set(ReSolve_KLU_SRC LinSolverDirectKLU.cpp)
Expand Down Expand Up @@ -52,6 +53,7 @@ set(ReSolve_HEADER_INSTALL
MemoryUtils.hpp
Preconditioner.hpp
PreconditionerLU.hpp
PreconditionerUserMatrix.hpp
)

set(ReSolve_KLU_HEADER_INSTALL LinSolverDirectKLU.hpp)
Expand Down
Loading
Loading