Skip to content

Commit

Permalink
USE LBT 5.0.1 and the new MKL ILP64 suffixes
Browse files Browse the repository at this point in the history
Also have the ability to load LP64 simultaneously
Bump version number and Julia dependency to 1.8
Remove all the old 1.6 stuff
  • Loading branch information
Viral B. Shah committed Mar 3, 2022
1 parent 42e5ec3 commit cbbaacd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
julia-version:
- "1.7"
- "nightly"
os:
- ubuntu-latest
- macos-latest
Expand Down
7 changes: 4 additions & 3 deletions LICENSE
@@ -1,6 +1,9 @@
MKL.jl is licensed under the MIT license. It has a dependency on the Intel MKL.
The license of Intel MKL can be found at https://software.intel.com/en-us/license/intel-simplified-software-license.

MIT License

Copyright (c) 2018 Julia Computing, Inc.
Copyright (c) 2018-22 Julia Computing, Inc. and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,5 +22,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

The license of Intel MKL can be found at https://software.intel.com/en-us/license/intel-simplified-software-license.
6 changes: 3 additions & 3 deletions Project.toml
@@ -1,6 +1,6 @@
name = "MKL"
uuid = "33e6dc65-8f57-5167-99aa-e5a354878fb2"
version = "0.5.0"
version = "0.6.0"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand All @@ -9,8 +9,8 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MKL_jll = "856f044c-d86e-5d09-b602-aeab76dc8ba7"

[compat]
MKL_jll = "2021, 2022"
julia = "1.7"
MKL_jll = "2022"
julia = "1.8"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
23 changes: 16 additions & 7 deletions src/MKL.jl
Expand Up @@ -26,32 +26,41 @@ end

function set_threading_layer(layer::Threading = THREADING_SEQUENTIAL)
err = ccall((:MKL_Set_Threading_Layer, libmkl_rt), Cint, (Cint,), layer)
err == -1 && throw(ErrorException("return value was -1"))
err == -1 && throw(ErrorException("MKL_Set_Threading_Layer() returned -1"))
return nothing
end

function set_interface_layer(interface = Base.USE_BLAS64 ? INTERFACE_ILP64 : INTERFACE_LP64)
function set_interface_layer(interface::Interface = INTERFACE_LP64)
err = ccall((:MKL_Set_Interface_Layer, libmkl_rt), Cint, (Cint,), interface)
err == -1 && throw(ErrorException("return value was -1"))
err == -1 && throw(ErrorException("MKL_Set_Interface_Layer() returned -1"))
return nothing
end

function __init__()
if MKL_jll.is_available()
set_interface_layer()
if Sys.isapple()
set_threading_layer(THREADING_SEQUENTIAL)
else
set_threading_layer(THREADING_INTEL)
end
BLAS.lbt_forward(libmkl_rt, clear=true)
# MKL 2022 and onwards have 64_ for ILP64 suffixes. The LP64 interface
# includes LP64 APIs for the non-suffixed symbols and ILP64 API for the
# 64_ suffixed symbols. LBT4 in Julia is necessary for this to work.
set_interface_layer(INTERFACE_LP64)
if Base.USE_BLAS64
# Load ILP64 forwards
BLAS.lbt_forward(libmkl_rt; clear=true, suffix_hint="64")
# Load LP64 forward
BLAS.lbt_forward(libmkl_rt; suffix_hint="")
else
BLAS.lbt_forward(libmkl_rt; clear=true, suffix_hint="")
end
end
end

function mklnorm(x::Vector{Float64})
ccall((:dnrm2_, libmkl_rt), Float64,
(Ref{MKLBlasInt}, Ptr{Float64}, Ref{MKLBlasInt}),
length(x), x, 1)
(Ref{MKLBlasInt}, Ptr{Float64}, Ref{MKLBlasInt}), length(x), x, 1)
end

end # module

0 comments on commit cbbaacd

Please sign in to comment.