Skip to content

Conversation

ChrisRackauckas-Claude
Copy link
Contributor

Summary

  • Adds OpenBLASLUFactorization as a new solver that directly calls OpenBLAS_jll
  • Provides an alternative to MKLLUFactorization that doesn't require MKL
  • Implements the same interface and functionality as MKLLUFactorization

Implementation Details

This PR introduces OpenBLASLUFactorization, which mirrors the existing MKLLUFactorization but uses OpenBLAS_jll directly instead of MKL. Key features:

  • Direct OpenBLAS calls: Uses OpenBLAS_jll directly without going through libblastrampoline for optimal performance
  • Pre-allocated workspace: Avoids allocations during solving, following the same pattern as MKL implementation
  • Type support: Handles Float32, Float64, ComplexF32, and ComplexF64
  • Consistent interface: Follows the same AbstractFactorization interface as other solvers

Testing

The implementation has been tested locally with all supported types and produces identical results to the standard LUFactorization:

julia> A = rand(10, 10); b = rand(10);
julia> prob = LinearProblem(A, b);
julia> sol_openblas = solve(prob, OpenBLASLUFactorization());
julia> sol_default = solve(prob, LUFactorization());
julia> norm(sol_openblas.u - sol_default.u)
2.7755575615628914e-17

Use Case

This solver is particularly useful for:

  • Systems where MKL is not available or desired
  • Environments that prefer open-source BLAS implementations
  • Benchmarking and comparison between different BLAS backends

🤖 Generated with Claude Code

claude and others added 6 commits August 20, 2025 09:04
- Implement OpenBLASLUFactorization as a direct wrapper over OpenBLAS_jll
- Add getrf! and getrs! functions for LU factorization and solving
- Support Float32, Float64, ComplexF32, and ComplexF64 types
- Include proper module structure and exports
- Add OpenBLAS_jll as a dependency
- Tests confirm functionality matches existing LUFactorization
- Add OpenBLASLUFactorization to basictests.jl alongside other factorizations
- Include in resolve.jl subtype iteration tests
- Add to preferences.jl algorithm availability tests
- Remove separate test file in favor of integrated testing
- Add detailed docstring with performance characteristics and usage examples
- Include OpenBLASLUFactorization in solver documentation alongside MKL and AppleAccelerate
- Update algorithm selection guide to mention OpenBLAS as an option for large dense matrices
- Document when to use OpenBLAS vs other BLAS implementations
- Remove redundant import of LinearAlgebra items that are already available via using LinearAlgebra
- Qualify all uses of BlasInt, LU, require_one_based_indexing, and checksquare with LinearAlgebra prefix
- Add OpenBLAS_jll = "0.3" to compat section in Project.toml
- Apply JuliaFormatter with SciMLStyle to ensure consistent formatting
- Remove separate module structure, follow MKL's pattern exactly
- Conditionally check for OpenBLAS_jll availability using is_available()
- Keep OpenBLAS_jll as a dependency (required even for stdlib packages)
- Simplify implementation without nested @static checks
- Tests conditionally run based on LinearSolve.useopenblas flag
ChrisRackauckas and others added 2 commits August 20, 2025 17:21
- Added LoadOpenBLAS_JLL preference with default value true
- Users can now disable OpenBLAS via preferences
- Matches the existing MKL preference pattern
@ChrisRackauckas-Claude
Copy link
Contributor Author

Latest Updates

Added preference system for OpenBLAS loading as requested:

  • Added LoadOpenBLAS_JLL preference with default value true
  • Users can now disable OpenBLAS via preferences, matching the MKL pattern
  • The implementation follows the exact same pattern as MKL:
if Preferences.@load_preference("LoadOpenBLAS_JLL", true)
    using OpenBLAS_jll: OpenBLAS_jll
    const useopenblas = OpenBLAS_jll.is_available()
else
    const useopenblas = false
end

This allows users to disable OpenBLAS if they prefer to use their system BLAS or another implementation.

The implementation is now feature-complete and matches the MKL implementation pattern in all aspects:

  • Direct BLAS calls bypassing libblastrampoline
  • Pre-allocated workspace to avoid allocations
  • Preference system for conditional loading
  • Full integration with the test suite
  • Documentation included

🤖 Generated with Claude Code

@ChrisRackauckas ChrisRackauckas merged commit 2ff3977 into SciML:main Aug 20, 2025
131 of 136 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.

3 participants