Skip to content

Commit

Permalink
Merge pull request #21 from nickrobinson251/npr/guard-gpl-libs
Browse files Browse the repository at this point in the history
Only define methods on SuiteSparse.UMFPACK if GPL libs present
  • Loading branch information
amartinhuertas authored Jan 16, 2023
2 parents dbe71cf + 79a5a6f commit d26c461
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SparseMatricesCSR"
uuid = "a0a7dd2c-ebf4-11e9-1f05-cf50bc540ca1"
authors = ["Víctor Sande <[email protected]>", "Francesc Verdugo <[email protected]>"]
version = "0.6.6"
version = "0.6.7"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
4 changes: 4 additions & 0 deletions src/SparseMatrixCSR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ function LinearAlgebra.lu(a::SparseMatrixCSR{1})
Transpose(lu(SparseMatrixCSC(a.m,a.n,a.rowptr,a.colval,a.nzval)))
end

if Base.USE_GPL_LIBS

function LinearAlgebra.lu!(
translu::Transpose{T,<:SuiteSparse.UMFPACK.UmfpackLU{T}},
a::SparseMatrixCSR{1}) where {T}
Expand All @@ -154,6 +156,8 @@ function LinearAlgebra.lu!(
Transpose(lu!(translu.parent,SparseMatrixCSC(a.m,a.n,rowptr,colval,a.nzval)))
end

end # Base.USE_GPL_LIBS

size(S::SparseMatrixCSR) = (S.m, S.n)
IndexStyle(::Type{<:SparseMatrixCSR}) = IndexCartesian()
function getindex(A::SparseMatrixCSR{Bi,T}, i0::Integer, i1::Integer) where {Bi,T}
Expand Down
14 changes: 9 additions & 5 deletions test/SparseMatrixCSR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,14 @@ for Bi in (0,1)
end
end

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]
test_lu(0,I,J,V)
test_lu(1,I,J,V)
if Base.USE_GPL_LIBS # `lu!` requires `SuiteSparse.UMFPACK`
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]
test_lu(0,I,J,V)
test_lu(1,I,J,V)
else
@warn "Tests run without GPL libraries."
end

end # module

6 comments on commit d26c461

@amartinhuertas
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/76203

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.7 -m "<description of version>" d26c461eefbd27550529e06e2cafae24265657ea
git push origin v0.6.7

@nickrobinson251
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks!

@amartinhuertas
Copy link
Member Author

Choose a reason for hiding this comment

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

@fverdugo ... Tagbot did not generate the new release + tag in this repo. Thus, it seems that we have a similar problem than the one we had in partitionedarrays.

@nickrobinson251 have you ever had a problem like this in your Julia repos ?

@amartinhuertas
Copy link
Member Author

Choose a reason for hiding this comment

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

Looking at the logs the error is:

https://github.com/gridap/SparseMatricesCSR.jl/actions/runs/3986449212/jobs/6835042714#step:3:44

Thus it does not seem to be the same cause as the error we have in partitionedarrays

@amartinhuertas
Copy link
Member Author

Choose a reason for hiding this comment

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

ok. I fixed this. I followed the instructions here. https://discourse.julialang.org/t/latest-version-of-docs-not-published-github-actions-tagbot/50634/19

This solves both the tagbot error and the deployment of documentation error.

Please sign in to comment.