diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47a2431..494cf7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: julia-version: - - "1.7" + - "nightly" os: - ubuntu-latest - macos-latest diff --git a/LICENSE b/LICENSE index ba578b7..381bb1b 100644 --- a/LICENSE +++ b/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 @@ -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. diff --git a/Project.toml b/Project.toml index d537547..19db07f 100644 --- a/Project.toml +++ b/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" @@ -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" diff --git a/src/MKL.jl b/src/MKL.jl index 2a61d0f..06aaa9e 100644 --- a/src/MKL.jl +++ b/src/MKL.jl @@ -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