Skip to content

[Core Refactor / Performance]: Remove the external Rust / Fortran / C packages and accelerate the sparse solver in native Rust#7

Merged
QuentinWach merged 10 commits into
mainfrom
rust_backend
May 17, 2026
Merged

[Core Refactor / Performance]: Remove the external Rust / Fortran / C packages and accelerate the sparse solver in native Rust#7
QuentinWach merged 10 commits into
mainfrom
rust_backend

Conversation

@QuentinWach
Copy link
Copy Markdown
Collaborator

@QuentinWach QuentinWach commented May 17, 2026

Closes #6 and #3.

Summary by CodeRabbit

  • New Features

    • Portable native sparse eigensolver with runtime profiling support
  • Documentation

    • Expanded with platform support details, source build instructions, and algorithm performance information
  • Refactor

    • Simplified public API by consolidating backend options
  • Tests

    • Added slow-test markers for improved test organization

Review Change Stack

- Updated `pyproject.toml` to remove unnecessary features from the Rust backend configuration.
- Expanded `README.md` to include detailed information on supported platforms and source builds, clarifying installation requirements and usage instructions.
- Modified GitHub workflows to separate testing for portable and accelerated backends, improving CI structure and clarity.
- Added slow test markers in `test_mode_solver_fixtures.py` to better categorize test execution times.
…solvers

- Updated `build.rs` to switch from ARPACK to UMFPACK backend configuration.
- Removed ARPACK dependencies from `Cargo.toml` and `Cargo.lock`, streamlining the project.
- Added a new benchmark for eigenvalue solvers in `benchmarks/eigensolver_backend_benchmark.rs` to evaluate performance.
- Updated `README.md` to reflect changes in backend requirements and installation instructions.
- Modified testing workflows to focus on UMFPACK backend, ensuring clarity in CI processes.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

📝 Walkthrough

Walkthrough

This PR replaces ARPACK/UMFPACK backend solvers with a portable native Rust sparse shift-invert eigensolver featuring AMD ordering, LU factorization, Arnoldi iteration, and detailed profiling. Dependencies, build configuration, public APIs, benchmarks, CI workflows, and documentation are updated throughout to support the portable implementation.

Changes

Portable Native Eigensolver Migration

Layer / File(s) Summary
Build configuration and dependency cleanup
Cargo.toml, pyproject.toml
Removes arpack-sys, russell_lab, and russell_sparse optional dependencies; adds amd crate; removes arpack-backend and umfpack-backend feature flags; adds benchmark binary targets; removes build.rs script declaration.
Native shift-invert eigensolver implementation
src/eigensolve.rs
Introduces ShiftInvertProfile for profiling major solver phases (LU factorization, Arnoldi, orthogonalization, Hessenberg eigensolve, residual computation, sorting). Adds selected_sparse_shift_invert_native_eigenpairs and profile_sparse_shift_invert_native_eigenpairs entry points. Implements SparseLu with AMD ordering and rlu LU factorization, ArnoldiBasis for Krylov subspace management with one reorthogonalization pass per step, checkpoint-driven candidate eigenpair extraction with convergence/stability checks, and candidate selection via shift-distance/residual sorting. Removes ARPACK/UMFPACK-specific public functions and glue.
Public API consolidation and exports
src/diagonal_solver.rs, src/python_api.rs
Removes backend-specific re-exports (selected_sparse_shift_invert_arpack_eigenpairs, selected_sparse_shift_invert_umfpack_eigenpairs) and retains only selected_sparse_shift_invert_eigenpairs. Removes ARPACK/UMFPACK-specific residual tests, keeping generic test with looser tolerance. Removes PyO3-exposed has_umfpack_backend_py function.
Benchmark problem setup and binaries
benchmarks/eigensolver_benchmark_problem.rs, benchmarks/eigensolver_backend_benchmark.rs, benchmarks/eigensolver_phase_benchmark.rs, benchmarks/compare_mode_solver_fixtures.py
Adds eigensolver_benchmark_problem.rs with strip_operator to construct test problems from grid parameters and tensors, plus parse_grids and numeric helpers. Adds eigensolver_backend_benchmark.rs binary to time the native solver and output CSV with best/mean timing and max residual. Adds eigensolver_phase_benchmark.rs binary to profile internal solver phases extracted from ShiftInvertProfile. Updates compare_mode_solver_fixtures.py to add and pass through krylov_dim parameter.
CI/CD workflows and test organization
.github/workflows/publish.yml, .github/workflows/tests.yml, tests/test_mode_solver_fixtures.py
Removes system library installation from publish.yml. Renames test job to test-portable (excludes slow tests, no system libs) and adds test-full job (Python 3.13, all tests including slow). Marks three fixture-comparison tests as @pytest.mark.slow.
Documentation and release notes
CHANGELOG.md, README.md, docs/release.md
Adds changelog entry for portable native Rust sparse eigensolver with AMD ordering, packed LU, adaptive Arnoldi, and no external dependencies. Expands README with Supported Platforms section, Source Builds section with build instructions, and detailed Performance explanation of the solver approach. Updates "Why Use It?" section to emphasize grid-first API and portable Rust backend. Updates release.md to clarify Windows wheel deferral rationale.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 A native solver hops into place,
AMD ordering sets the pace,
No more backends to chase—
Arnoldi reigns in portable grace,
LU factors pack with speed and space! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.65% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main refactoring: removing external Fortran/C packages (ARPACK, UMFPACK, Russell) and implementing a native Rust sparse eigensolver, which is reflected throughout all major code changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rust_backend

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@QuentinWach QuentinWach self-assigned this May 17, 2026
@QuentinWach QuentinWach merged commit b872b38 into main May 17, 2026
5 of 6 checks passed
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.

Arnoldi work: do fewer steps and make each step cheaper Smoke-test the built macOS wheel in an environment without the Homebrew library path etc.

1 participant