From a5fb3f846331834cf6ffb4558c5281a9654f9019 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Tue, 9 May 2023 23:24:21 -0400 Subject: [PATCH 1/2] Add blis32_jll --- Project.toml | 4 +++- src/BLISBLAS.jl | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 4c8d53a..ab7f09e 100644 --- a/Project.toml +++ b/Project.toml @@ -5,11 +5,13 @@ version = "0.1.1" [deps] 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" -julia = "1.8" +blis32_jll = "1.0" +julia = "1.9" [extras] Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" diff --git a/src/BLISBLAS.jl b/src/BLISBLAS.jl index 3e4d2ac..45e2393 100644 --- a/src/BLISBLAS.jl +++ b/src/BLISBLAS.jl @@ -1,5 +1,6 @@ module BLISBLAS +using blis32_jll using blis_jll using LinearAlgebra @@ -16,6 +17,11 @@ function set_num_threads(nthreads) 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) else From db7ad21759e76131aef9e864e65482063780acbc Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Fri, 7 Jun 2024 23:49:52 -0400 Subject: [PATCH 2/2] Update BLISBLAS.jl --- .github/workflows/CI.yml | 2 +- Project.toml | 6 +++++- src/BLISBLAS.jl | 23 +++++++++++++---------- test/runtests.jl | 13 ++++++++----- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 18bb9b3..06159fc 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,7 +20,7 @@ jobs: fail-fast: false matrix: version: - - '1.8' + - '1.9' - '1.10' - 'nightly' os: diff --git a/Project.toml b/Project.toml index ab7f09e..5dd7039 100644 --- a/Project.toml +++ b/Project.toml @@ -4,13 +4,17 @@ authors = ["Carsten Bauer 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] diff --git a/src/BLISBLAS.jl b/src/BLISBLAS.jl index 45e2393..a1bdaee 100644 --- a/src/BLISBLAS.jl +++ b/src/BLISBLAS.jl @@ -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")) 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 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) 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 diff --git a/test/runtests.jl b/test/runtests.jl index 6cd7af5..3d6ceb1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 @@ -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