Skip to content

Add Hybrid Solver#112

Open
maxpaik16 wants to merge 8 commits into
mainfrom
hybrid-solver
Open

Add Hybrid Solver#112
maxpaik16 wants to merge 8 commits into
mainfrom
hybrid-solver

Conversation

@maxpaik16

Copy link
Copy Markdown
Contributor

Added CPU and GPU implementations of hybrid linear solver. The CPU solver is only built if MPI is found, and the GPU solver is only built if CUDA is found.

Added cuDSS wrapper

Added test case to verify hybrid linear solvers are converging well for a system with ill-conditioning due to contact

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 10.34483% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.07%. Comparing base (e38cfac) to head (77e2142).

Files with missing lines Patch % Lines
src/polysolve/linear/hybrid_utils/DisjointSet.cpp 0.00% 18 Missing ⚠️
src/polysolve/linear/HypreSolver.cpp 30.00% 7 Missing ⚠️
src/polysolve/linear/HypreSolver.hpp 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (10.34%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #112      +/-   ##
==========================================
- Coverage   80.73%   80.07%   -0.67%     
==========================================
  Files          51       52       +1     
  Lines        2118     2138      +20     
  Branches      280      285       +5     
==========================================
+ Hits         1710     1712       +2     
- Misses        408      426      +18     
Flag Coverage Δ
polysolve 80.07% <10.34%> (-0.67%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread CMakeLists.txt

if(POLYSOLVE_WITH_MPI)
# If the option is ON (either via auto-detect or forced by the user), ensure it is actually found
find_package(MPI REQUIRED)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i have mixed feeling about this, i would rather have a warning and disalbe if no mpi

Comment thread CMakeLists.txt

# Silently detect MPI to set the default option
find_package(MPI QUIET)
if(MPI_CXX_FOUND)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

here too, the philosophy of polysolve is user select, if system dosent have it, warning then disable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think MPI should be disabled by default just like CUDA. Both are troubling dependencies.

m_nrows = A.rows();
m_ncols = A.cols();
m_nnz = A.nonZeros();

@iiiian iiiian Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's fine to support int32 index only, but please throw on large index somewhere. Do hybrid support int64 index type?

solvers.push_back("CPUHybrid");
#endif
#ifdef POLYSOLVE_WITH_GPU_HYBRID
solvers.push_back("GPUHybrid");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tests that require GPU to run should be hidden by default

Comment thread linear-solver-spec.json
"doc": "Use preconditioned residual norm for termination check."
},
{
"pointer": "/CPUHybrid",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is just my personal opinion but maybe setting other than tolerance should be in advanced? I don't think user would want to tweak stuff like gmm iter.

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.

3 participants