Skip to content

Commit

Permalink
Update BLISBLAS.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Jun 8, 2024
1 parent a5fb3f8 commit db7ad21
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.8'
- '1.9'
- '1.10'
- 'nightly'
os:
Expand Down
6 changes: 5 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ authors = ["Carsten Bauer <[email protected]> and contributors"]
version = "0.1.1"

[deps]
LAPACK32_jll = "17f450c3-bd24-55df-bb84-8c51b4b939e3"
LAPACK_jll = "51474c39-65e3-53ba-86ba-03b1b862ec14"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
blis32_jll = "e47b3055-b30e-52b1-9cd4-aea7f6c39f40"
blis_jll = "6136c539-28a5-5bf0-87cc-b183200dce32"

[compat]
blis_jll = "1.0"
LAPACK32_jll = "3.12"
LAPACK_jll = "3.12"
blis32_jll = "1.0"
blis_jll = "1.0"
julia = "1.9"

[extras]
Expand Down
23 changes: 13 additions & 10 deletions src/BLISBLAS.jl
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
module BLISBLAS

using blis32_jll
using blis_jll
using blis32_jll, LAPACK32_jll
using blis_jll, LAPACK_jll
using LinearAlgebra

function get_num_threads()
ret = @ccall blis.bli_thread_get_num_threads()::Cint
ret == -1 && throw(ErrorException("return value was -1"))
ret = @ccall blis32.bli_thread_get_num_threads()::Cint
ret == -1 && throw(ErrorException("return value was -1"))

Check warning on line 11 in src/BLISBLAS.jl

View check run for this annotation

Codecov / codecov/patch

src/BLISBLAS.jl#L10-L11

Added lines #L10 - L11 were not covered by tests
return ret
end

function set_num_threads(nthreads)
ret = @ccall blis.bli_thread_set_num_threads(nthreads::Cint)::Cvoid
ret == -1 && throw(ErrorException("return value was -1"))
ret = @ccall blis32.bli_thread_set_num_threads(nthreads::Cint)::Cvoid
ret == -1 && throw(ErrorException("return value was -1"))

Check warning on line 19 in src/BLISBLAS.jl

View check run for this annotation

Codecov / codecov/patch

src/BLISBLAS.jl#L18-L19

Added lines #L18 - L19 were not covered by tests
return nothing
end

function __init__()
if blis32_jll.is_available()
BLAS.lbt_forward(blis32, clear=false)
else
@warn("blis32_jll artifact doesn't seem to be available for your platform!")
end
if blis_jll.is_available()
BLAS.lbt_forward(blis, clear=false)
blis_available = blis32_jll.is_available() && blis_jll.is_available()
if blis_available
BLAS.lbt_forward(blis32, clear=true)
BLAS.lbt_forward(liblapack32)
BLAS.lbt_forward(blis)
BLAS.lbt_forward(liblapack)

Check warning on line 29 in src/BLISBLAS.jl

View check run for this annotation

Codecov / codecov/patch

src/BLISBLAS.jl#L24-L29

Added lines #L24 - L29 were not covered by tests
else
@warn("blis_jll artifact doesn't seem to be available for your platform!")
@warn("The artifacts blis_jll and blis32_jll are not available for your platform!")

Check warning on line 31 in src/BLISBLAS.jl

View check run for this annotation

Codecov / codecov/patch

src/BLISBLAS.jl#L31

Added line #L31 was not covered by tests
end
end

Expand Down
13 changes: 8 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using Libdl

function blas()
libs = BLAS.get_config().loaded_libs
lib = lowercase(basename(last(libs).libname))
if contains(lib, "openblas")
libs = map(lib -> lowercase(basename(lib.libname)), libs)
if mapreduce(lib -> contains(lib, "openblas"), |, libs)
return :openblas
elseif contains(lib, "blis")
elseif mapreduce(lib -> contains(lib, "blis"), |, libs)
return :blis
else
return :unknown
Expand All @@ -33,8 +33,11 @@ end
end

@testset "BLAS" begin
# run all BLAS tests of the LinearAlgebra stdlib (i.e. LinearAlgebra/test/blas.jl)
# run all BLAS and LAPACK tests of the LinearAlgebra stdlib:
# - LinearAlgebra/test/blas.jl
# - LinearAlgebra/test/lapack.jl
linalg_stdlib_test_path = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
include(joinpath(linalg_stdlib_test_path, "blas.jl"))
joinpath(linalg_stdlib_test_path, "blas.jl") |> include
joinpath(linalg_stdlib_test_path, "lapack.jl") |> include
end
end

0 comments on commit db7ad21

Please sign in to comment.