-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only define methods on SuiteSparse.UMFPACK if GPL libs present #21
Only define methods on SuiteSparse.UMFPACK if GPL libs present #21
Conversation
@amartinhuertas, might you be able to take a look? thanks! |
Thanks for the PR! I was not aware of this issue. The fix that you submitted provenly solves the precompilation error. However, I wonder whether if- constructs of the type
should also go to other parts of the code to avoid other potential errors. (I agree precompilation is the most annoying). Whats your view on this? |
i couldn't see any other code paths that would error without GPL libraries -- did you have any in mind? The e.g given using SparseMatricesCSR, SparseArrays, LinearAlgebra
Bi = 0;
I = [1,1,2,2,2,3,3];
J = [1,2,1,2,3,2,3];
V = [4.0,1.0,-1.0,4.0,1.0,-1.0,4.0];
CSR = sparsecsr(Val(Bi),I,J,V); in Julia with GPL libs julia> fact = lu(CSR);
julia> typeof(fact)
Transpose{Float64, SuiteSparse.UMFPACK.UmfpackLU{Float64, Int64}}
julia> lu!(fact, CSR)
Transpose of SuiteSparse.UMFPACK.UmfpackLU{Float64, Int64}
L factor:
3×3 SparseMatrixCSC{Float64, Int64} with 5 stored entries:
1.0 ⋅ ⋅
⋅ 1.0 ⋅
-0.208333 0.208333 1.0
U factor:
3×3 SparseMatrixCSC{Float64, Int64} with 5 stored entries:
0.8 ⋅ 0.2
⋅ 0.8 -0.2
⋅ ⋅ 0.75 whereas without GPL libs julia> fact = lu(CSR);
julia> typeof(fact)
Transpose{Float64, LU{Float64, SparseMatrixCSC{Float64, Int64}, Vector{Int64}}}
julia> lu!(fact, CSR)
ERROR: MethodError: no method matching lu!(::Transpose{Float64, LU{Float64, SparseMatrixCSC{Float64, Int64}, Vector{Int64}}}, ::SparseMatrixCSR{0, Float64, Int64}) but at least the package and any dependents are now loadable (i.e. now only this one codepath doesn't work without GPL libs, rather than the whole package) |
Ok, thanks for the explanation. Once the tests pass, I will accept the PR. |
Codecov Report
@@ Coverage Diff @@
## master #21 +/- ##
=======================================
Coverage 86.17% 86.17%
=======================================
Files 3 3
Lines 246 246
=======================================
Hits 212 212
Misses 34 34
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks, @amartinhuertas! Would it be possible to get a new patch release of this package which includes this fix please? 🙏 |
Yes. Patch release already triggered. |
thanks! |
Fix package on Julia versions built without GPL libraries (i.e. with
USE_GPL_LIBS=0
)This is so packages depending on SparseMatricesCSR.jl will still compile, even on Julia versions built without GPL libraries. Prompted by dmlc/XGBoost.jl#157
Before we'd get
Now the package compiles as expected