Skip to content

Commit 46553a1

Browse files
authored
Merge pull request #6 from amontoison/blis32_jll
Upgrade BLISBLAS.jl
2 parents 9b7ecea + a6ae8cb commit 46553a1

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- os: macOS-latest
3131
arch: aarch64
3232
version: '1'
33-
33+
3434
steps:
3535
- uses: actions/checkout@v5
3636
- uses: julia-actions/setup-julia@v2

Project.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ authors = ["Carsten Bauer <[email protected]> and contributors"]
44
version = "0.2.0"
55

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

1013
[compat]
14+
blis32_jll = "2"
1115
blis_jll = "2"
16+
LAPACK32_jll = "3.12"
17+
LAPACK_jll = "3.12"
1218
julia = "1.12"
1319

1420
[extras]

src/BLISBLAS.jl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
11
module BLISBLAS
22

3-
using blis_jll
3+
using blis32_jll, LAPACK32_jll
4+
using blis_jll, LAPACK_jll
45
using LinearAlgebra
56

67
function get_num_threads()
78
ret = @ccall blis.bli_thread_get_num_threads()::Cint
89
ret == -1 && throw(ErrorException("return value was -1"))
10+
ret = @ccall blis32.bli_thread_get_num_threads()::Cint
11+
ret == -1 && throw(ErrorException("return value was -1"))
912
return ret
1013
end
1114

1215
function set_num_threads(nthreads)
1316
ret = @ccall blis.bli_thread_set_num_threads(nthreads::Cint)::Cvoid
1417
ret == -1 && throw(ErrorException("return value was -1"))
18+
ret = @ccall blis32.bli_thread_set_num_threads(nthreads::Cint)::Cvoid
19+
ret == -1 && throw(ErrorException("return value was -1"))
1520
return nothing
1621
end
1722

1823
function __init__()
19-
if blis_jll.is_available()
20-
BLAS.lbt_forward(blis, clear=true)
24+
blis_available = blis32_jll.is_available() && blis_jll.is_available()
25+
if blis_available
26+
BLAS.lbt_forward(blis32, clear=true)
27+
BLAS.lbt_forward(liblapack32)
28+
BLAS.lbt_forward(blis, suffix_hint="64_")
29+
BLAS.lbt_forward(liblapack, suffix_hint="64_")
2130
else
22-
@warn("blis_jll artifact doesn't seem to be available for your platform!")
31+
@warn("The artifacts blis_jll and blis32_jll are not available for your platform!")
2332
end
2433
end
2534

test/runtests.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ using Libdl
55

66
function blas()
77
libs = BLAS.get_config().loaded_libs
8-
lib = lowercase(basename(last(libs).libname))
9-
if contains(lib, "openblas")
8+
libs = map(lib -> lowercase(basename(lib.libname)), libs)
9+
if mapreduce(lib -> contains(lib, "openblas"), |, libs)
1010
return :openblas
11-
elseif contains(lib, "blis")
11+
elseif mapreduce(lib -> contains(lib, "blis"), |, libs)
1212
return :blis
1313
else
1414
return :unknown
@@ -33,9 +33,11 @@ end
3333
end
3434

3535
@testset "BLAS" begin
36-
# run all BLAS tests of the LinearAlgebra stdlib (i.e. LinearAlgebra/test/blas.jl)
37-
#linalg_stdlib_test_path = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
38-
#include(joinpath(linalg_stdlib_test_path, "blas.jl"))
39-
include("./blas.jl")
36+
# run all BLAS and LAPACK tests of the LinearAlgebra stdlib:
37+
# - LinearAlgebra/test/blas.jl
38+
# - LinearAlgebra/test/lapack.jl
39+
linalg_stdlib_test_path = joinpath(dirname(pathof(LinearAlgebra)), "..", "test")
40+
joinpath(linalg_stdlib_test_path, "blas.jl") |> include
41+
joinpath(linalg_stdlib_test_path, "lapack.jl") |> include
4042
end
4143
end

0 commit comments

Comments
 (0)