Skip to content

Use LinearAlgebra.BLAS.liblapack instead of Base.liblapack_name - #166

Merged
lostella merged 1 commit into
JuliaFirstOrder:masterfrom
greekera1000:use-linearalgebra-liblapack
Sep 29, 2026
Merged

lostella merged 1 commit into
JuliaFirstOrder:masterfrom
greekera1000:use-linearalgebra-liblapack

Conversation

@greekera1000

Copy link
Copy Markdown
Contributor

On Julia nightly, dspev! and dspevV! segfault when calling LAPACK. They use ccall with Base.liblapack_name, which on nightly loads libblastrampoline without connecting it to OpenBLAS, so the LAPACK function pointer is null.

This PR replaces Base.liblapack_name with LinearAlgebra.BLAS.liblapack in both calls. That loads libblastrampoline the proper way on nightly, and it exists in every Julia version since 1.0, so older versions are unaffected. Julia maintainers are also planning to remove or deprecate Base.libblas_name/liblapack_name, so this moves the package off them ahead of time.

See the upstream discussion in JuliaLang/julia#63432. where @staticfloat suggested to update package will be a helpfull work

Tested on Julia nightly and 1.12.x: all tests pass.
disclosure : claude helped

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia v1)

Time benchmarks
master 185dc75... master / 185dc75...
IndBallL1/Float32 4.07 ± 0.27 μs 4.1 ± 0.28 μs 0.993 ± 0.095
IndBallL1/Float64 5.65 ± 0.36 μs 5.81 ± 0.4 μs 0.972 ± 0.092
IndBox/Float32 9.21 ± 0.17 μs 9.21 ± 0.17 μs 1 ± 0.026
IndBox/Float64 9.61 ± 0.46 μs 9.64 ± 0.61 μs 0.997 ± 0.079
IndExpPrimal/Float32 0.192 ± 0.0045 ms 0.19 ± 0.0045 ms 1.01 ± 0.034
IndExpPrimal/Float64 0.19 ± 0.0059 ms 0.189 ± 0.006 ms 1.01 ± 0.045
IndNonnegative/Float32 1.68 ± 1.7 μs 1.97 ± 1.6 μs 0.853 ± 1.1
IndNonnegative/Float64 3.02 ± 2.7 μs 3.86 ± 2 μs 0.782 ± 0.81
IndPSD/("ComplexF64", 10) 18.9 ± 0.42 μs 18.9 ± 0.44 μs 1 ± 0.032
IndPSD/("ComplexF64", 20) 0.0707 ± 0.0015 ms 0.0707 ± 0.0012 ms 1 ± 0.028
IndPSD/("ComplexF64", 50) 0.567 ± 0.014 ms 0.569 ± 0.015 ms 0.997 ± 0.036
IndPSD/("Float64", 10) 14.8 ± 0.37 μs 14.8 ± 0.35 μs 1 ± 0.035
IndPSD/("Float64", 20) 0.0477 ± 0.0011 ms 0.047 ± 0.0014 ms 1.02 ± 0.038
IndPSD/("Float64", 50) 0.285 ± 0.012 ms 0.279 ± 0.012 ms 1.02 ± 0.061
IndSimplex/Float32 21.9 ± 0.84 μs 23.7 ± 0.74 μs 0.924 ± 0.046
IndSimplex/Float64 26.5 ± 1.8 μs 27.7 ± 1.4 μs 0.96 ± 0.082
LeastSquares/("ComplexF64", "(11, 5)", 0, 0) 1.15 ± 0.02 μs 1.14 ± 0.021 μs 1.01 ± 0.026
LeastSquares/("ComplexF64", "(11, 5)", 0, 1) 1.5 ± 0.061 μs 1.54 ± 0.07 μs 0.975 ± 0.059
LeastSquares/("ComplexF64", "(11, 5)", 1, 0) 10.5 ± 0.31 μs 10.7 ± 0.39 μs 0.983 ± 0.046
LeastSquares/("ComplexF64", "(11, 5)", 1, 1) 1.5 ± 0.05 μs 1.5 ± 0.07 μs 0.999 ± 0.057
LeastSquares/("ComplexF64", "(5, 11)", 0, 0) 1.35 ± 0.021 μs 1.34 ± 0.03 μs 1.01 ± 0.027
LeastSquares/("ComplexF64", "(5, 11)", 0, 1) 1.77 ± 0.081 μs 1.73 ± 0.08 μs 1.02 ± 0.066
LeastSquares/("ComplexF64", "(5, 11)", 1, 0) 10.7 ± 0.32 μs 10.8 ± 0.34 μs 0.985 ± 0.043
LeastSquares/("ComplexF64", "(5, 11)", 1, 1) 1.65 ± 0.08 μs 1.69 ± 0.08 μs 0.976 ± 0.066
LeastSquares/("Float64", "(11, 5)", 0, 0) 1.02 ± 0.019 μs 1 ± 0.021 μs 1.02 ± 0.029
LeastSquares/("Float64", "(11, 5)", 0, 1) 1.34 ± 0.069 μs 1.34 ± 0.05 μs 1 ± 0.063
LeastSquares/("Float64", "(11, 5)", 1, 0) 10.3 ± 0.31 μs 10.2 ± 0.38 μs 1.01 ± 0.048
LeastSquares/("Float64", "(11, 5)", 1, 1) 1.14 ± 0.089 μs 1.15 ± 0.08 μs 0.991 ± 0.1
LeastSquares/("Float64", "(5, 11)", 0, 0) 1.19 ± 0.02 μs 1.18 ± 0.02 μs 1.01 ± 0.024
LeastSquares/("Float64", "(5, 11)", 0, 1) 1.51 ± 0.05 μs 1.53 ± 0.05 μs 0.987 ± 0.046
LeastSquares/("Float64", "(5, 11)", 1, 0) 10.5 ± 0.28 μs 10.5 ± 0.35 μs 0.994 ± 0.042
LeastSquares/("Float64", "(5, 11)", 1, 1) 1.33 ± 0.091 μs 1.43 ± 0.09 μs 0.93 ± 0.086
NormL2/Float32 4.43 ± 0.85 μs 4.51 ± 0.55 μs 0.982 ± 0.22
NormL2/Float64 10.3 ± 3.2 μs 10.3 ± 3.1 μs 0.999 ± 0.44
time_to_load 0.976 ± 0.0049 s 0.997 ± 0.013 s 0.978 ± 0.014
Memory benchmarks
master 185dc75... master / 185dc75...
IndBallL1/Float32 10 allocs: 10.4 kB 10 allocs: 10.4 kB 1
IndBallL1/Float64 10 allocs: 20.5 kB 10 allocs: 20.5 kB 1
IndBox/Float32 1 allocs: 16 B 1 allocs: 16 B 1
IndBox/Float64 1 allocs: 16 B 1 allocs: 16 B 1
IndExpPrimal/Float32 11 k allocs: 0.179 MB 11 k allocs: 0.179 MB 1
IndExpPrimal/Float64 11 k allocs: 0.179 MB 11 k allocs: 0.179 MB 1
IndNonnegative/Float32 1 allocs: 16 B 1 allocs: 16 B 1
IndNonnegative/Float64 1 allocs: 16 B 1 allocs: 16 B 1
IndPSD/("ComplexF64", 10) 19 allocs: 11.9 kB 19 allocs: 11.9 kB 1
IndPSD/("ComplexF64", 20) 22 allocs: 29.2 kB 22 allocs: 29.2 kB 1
IndPSD/("ComplexF64", 50) 23 allocs: 0.116 MB 23 allocs: 0.116 MB 1
IndPSD/("Float64", 10) 16 allocs: 5.88 kB 16 allocs: 5.88 kB 1
IndPSD/("Float64", 20) 18 allocs: 14 kB 18 allocs: 14 kB 1
IndPSD/("Float64", 50) 19 allocs: 0.0564 MB 19 allocs: 0.0564 MB 1
IndSimplex/Float32 24 allocs: 0.0344 MB 24 allocs: 0.0344 MB 1
IndSimplex/Float64 26 allocs: 0.0685 MB 26 allocs: 0.0685 MB 1
LeastSquares/("ComplexF64", "(11, 5)", 0, 0) 7 allocs: 1.05 kB 7 allocs: 1.05 kB 1
LeastSquares/("ComplexF64", "(11, 5)", 0, 1) 17 allocs: 1.14 kB 17 allocs: 1.14 kB 1
LeastSquares/("ComplexF64", "(11, 5)", 1, 0) 0.059 k allocs: 4.6 kB 0.059 k allocs: 4.6 kB 1
LeastSquares/("ComplexF64", "(11, 5)", 1, 1) 17 allocs: 1.17 kB 17 allocs: 1.17 kB 1
LeastSquares/("ComplexF64", "(5, 11)", 0, 0) 7 allocs: 1.05 kB 7 allocs: 1.05 kB 1
LeastSquares/("ComplexF64", "(5, 11)", 0, 1) 17 allocs: 1.14 kB 17 allocs: 1.14 kB 1
LeastSquares/("ComplexF64", "(5, 11)", 1, 0) 0.059 k allocs: 4.6 kB 0.059 k allocs: 4.6 kB 1
LeastSquares/("ComplexF64", "(5, 11)", 1, 1) 17 allocs: 1.17 kB 17 allocs: 1.17 kB 1
LeastSquares/("Float64", "(11, 5)", 0, 0) 7 allocs: 0.609 kB 7 allocs: 0.609 kB 1
LeastSquares/("Float64", "(11, 5)", 0, 1) 17 allocs: 0.984 kB 17 allocs: 0.984 kB 1
LeastSquares/("Float64", "(11, 5)", 1, 0) 0.059 k allocs: 3.96 kB 0.059 k allocs: 3.96 kB 1
LeastSquares/("Float64", "(11, 5)", 1, 1) 17 allocs: 1.02 kB 17 allocs: 1.02 kB 1
LeastSquares/("Float64", "(5, 11)", 0, 0) 7 allocs: 0.609 kB 7 allocs: 0.609 kB 1
LeastSquares/("Float64", "(5, 11)", 0, 1) 17 allocs: 0.984 kB 17 allocs: 0.984 kB 1
LeastSquares/("Float64", "(5, 11)", 1, 0) 0.059 k allocs: 3.96 kB 0.059 k allocs: 3.96 kB 1
LeastSquares/("Float64", "(5, 11)", 1, 1) 17 allocs: 1.02 kB 17 allocs: 1.02 kB 1
NormL2/Float32 1 allocs: 16 B 1 allocs: 16 B 1
NormL2/Float64 1 allocs: 16 B 1 allocs: 16 B 1
time_to_load 0.2 k allocs: 11.8 kB 0.2 k allocs: 11.8 kB 1

@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.37%. Comparing base (947dfed) to head (185dc75).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #166      +/-   ##
==========================================
+ Coverage   94.33%   94.37%   +0.03%     
==========================================
  Files          80       80              
  Lines        2596     2596              
==========================================
+ Hits         2449     2450       +1     
+ Misses        147      146       -1     

☔ 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.

@lostella lostella left a comment

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.

Thank you so much @greekera1000!

@lostella
lostella merged commit b801f05 into JuliaFirstOrder:master Sep 29, 2026
10 checks passed
@greekera1000
greekera1000 deleted the use-linearalgebra-liblapack branch September 29, 2026 16:52
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