Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 7 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ 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]
LAPACK32_jll = "3.12"
LAPACK_jll = "3.12"
blis32_jll = "1.0"
blis_jll = "1.0"
julia = "1.8"
julia = "1.9"

[extras]
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Expand Down
17 changes: 13 additions & 4 deletions src/BLISBLAS.jl
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
module BLISBLAS

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"))
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"))
return nothing
end

function __init__()
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)
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!")
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