Skip to content

Commit

Permalink
Merge pull request #48435 from giordano/mg/libblas
Browse files Browse the repository at this point in the history
Fix `Base.libblas_name`/`Base.liblapack_name`
  • Loading branch information
staticfloat authored Feb 3, 2023
2 parents bebff47 + cdc6eaf commit d02516e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
9 changes: 5 additions & 4 deletions base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,6 @@ end
include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "build_h.jl")) # include($BUILDROOT/base/build_h.jl)
include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "version_git.jl")) # include($BUILDROOT/base/version_git.jl)

# These used to be in build_h.jl and are retained for backwards compatibility
const libblas_name = "libblastrampoline"
const liblapack_name = "libblastrampoline"

# numeric operations
include("hashing.jl")
include("rounding.jl")
Expand Down Expand Up @@ -290,6 +286,11 @@ include("sysinfo.jl")
include("libc.jl")
using .Libc: getpid, gethostname, time

# These used to be in build_h.jl and are retained for backwards compatibility.
# NOTE: keep in sync with `libblastrampoline_jll.libblastrampoline`.
const libblas_name = "libblastrampoline" * (Sys.iswindows() ? "-5" : "")
const liblapack_name = libblas_name

# Logging
include("logging.jl")
using .CoreLogging
Expand Down
8 changes: 8 additions & 0 deletions stdlib/LinearAlgebra/test/blas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module TestBLAS

using Test, LinearAlgebra, Random
using LinearAlgebra: BlasReal, BlasComplex
using Libdl: dlsym, dlopen
fabs(x::Real) = abs(x)
fabs(x::Complex) = abs(real(x)) + abs(imag(x))

Expand Down Expand Up @@ -713,4 +714,11 @@ end
end
end

# Make sure we can use `Base.libblas_name`. Avoid causing
# https://github.com/JuliaLang/julia/issues/48427 again.
@testset "libblas_name" begin
dot_sym = dlsym(dlopen(Base.libblas_name), "cblas_ddot" * (Sys.WORD_SIZE == 64 ? "64_" : ""))
@test 23.0 === @ccall $(dot_sym)(2::Int, [2.0, 3.0]::Ref{Cdouble}, 1::Int, [4.0, 5.0]::Ref{Cdouble}, 1::Int)::Cdouble
end

end # module TestBLAS
1 change: 1 addition & 0 deletions stdlib/libblastrampoline_jll/src/libblastrampoline_jll.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ artifact_dir = ""
libblastrampoline_handle = C_NULL
libblastrampoline_path = ""

# NOTE: keep in sync with `Base.libblas_name` and `Base.liblapack_name`.
const libblastrampoline = if Sys.iswindows()
"libblastrampoline-5.dll"
elseif Sys.isapple()
Expand Down

0 comments on commit d02516e

Please sign in to comment.