11
22function __init__ ()
3- MKLpkgid = Base. PkgId (Base. UUID (" 33e6dc65-8f57-5167-99aa-e5a354878fb2" ), " MKL" )
4- mklpath = Base. locate_package (MKLpkgid)
5- if mklpath != nothing
6- libpath = normpath (joinpath (dirname (mklpath), " ../deps/usr/lib" ))
7- push! (Libdl. DL_LOAD_PATH, libpath)
8- elseif isempty (Libdl. find_library (rtlib))
9- error (" Could not find MKL shared libraries. Please add MKL.jl or install MKL via the intel website. See the github repository for more details.)" )
10- end
3+ check_deps ()
114
12- Libdl. dlopen (rtlib, RTLD_GLOBAL)
13- Libdl. dlopen (corelib, RTLD_GLOBAL) # maybe only needed on mac
14- Libdl. dlopen (lib, RTLD_GLOBAL)
5+ Libdl. dlopen (libmkl_core, Libdl . RTLD_GLOBAL)
6+ Libdl. dlopen (libmkl_rt, Libdl . RTLD_GLOBAL) # maybe only needed on mac
7+ Libdl. dlopen (libmkl_vml_avx, Libdl . RTLD_GLOBAL)
158
169end
1710
@@ -30,15 +23,15 @@ const _BINARY = []
3023
3124Base. show (io:: IO , m:: VMLAccuracy ) = print (io, m == VML_LA ? " VML_LA" :
3225 m == VML_HA ? " VML_HA" : " VML_EP" )
33- vml_get_mode () = ccall ((:_vmlGetMode , lib ), Cuint, ())
34- vml_set_mode (mode:: Integer ) = (ccall ((:_vmlSetMode , lib ), Cuint, (UInt,), mode); nothing )
26+ vml_get_mode () = ccall ((:_vmlGetMode , libmkl_vml_avx ), Cuint, ())
27+ vml_set_mode (mode:: Integer ) = (ccall ((:_vmlSetMode , libmkl_vml_avx ), Cuint, (UInt,), mode); nothing )
3528
3629vml_set_accuracy (m:: VMLAccuracy ) = vml_set_mode ((vml_get_mode () & ~ 0x03 ) | m. mode)
3730vml_get_accuracy () = VMLAccuracy (vml_get_mode () & 0x3 )
3831
3932vml_set_mode ((vml_get_mode () & ~ 0x0000FF00 ))
4033function vml_check_error ()
41- vml_error = ccall ((:_vmlClearErrStatus , lib ), Cint, ())
34+ vml_error = ccall ((:_vmlClearErrStatus , libmkl_vml_avx ), Cint, ())
4235 if vml_error != 0
4336 if vml_error == 1
4437 throw (DomainError (- 1 , " This function does not support arguments outside its domain" ))
@@ -76,7 +69,7 @@ function def_unary_op(tin, tout, jlname, jlname!, mklname;
7669 @eval begin
7770 function ($ jlname!)(out:: Array{$tout,N} , A:: Array{$tin,N} ) where {N}
7871 size (out) == size (A) || throw (DimensionMismatch ())
79- ccall (($ mklfn, lib ), Nothing, (Int, Ptr{$ tin}, Ptr{$ tout}), length (A), A, out)
72+ ccall (($ mklfn, libmkl_vml_avx ), Nothing, (Int, Ptr{$ tin}, Ptr{$ tout}), length (A), A, out)
8073 vml_check_error ()
8174 return out
8275 end
@@ -91,7 +84,7 @@ function def_unary_op(tin, tout, jlname, jlname!, mklname;
9184 end )
9285 function ($ jlname)(A:: Array{$tin} )
9386 out = similar (A, $ tout)
94- ccall (($ mklfn, lib ), Nothing, (Int, Ptr{$ tin}, Ptr{$ tout}), length (A), A, out)
87+ ccall (($ mklfn, libmkl_vml_avx ), Nothing, (Int, Ptr{$ tin}, Ptr{$ tout}), length (A), A, out)
9588 vml_check_error ()
9689 return out
9790 end
@@ -109,14 +102,14 @@ function def_binary_op(tin, tout, jlname, jlname!, mklname, broadcast)
109102 $ (isempty (exports) ? nothing : Expr (:export , exports... ))
110103 function ($ jlname!)(out:: Array{$tout,N} , A:: Array{$tin,N} , B:: Array{$tin,N} ) where {N}
111104 size (out) == size (A) == size (B) || $ (broadcast ? :(return broadcast! ($ jlname, out, A, B)) : :(throw (DimensionMismatch ())))
112- ccall (($ mklfn, lib ), Nothing, (Int, Ptr{$ tin}, Ptr{$ tin}, Ptr{$ tout}), length (A), A, B, out)
105+ ccall (($ mklfn, libmkl_vml_avx ), Nothing, (Int, Ptr{$ tin}, Ptr{$ tin}, Ptr{$ tout}), length (A), A, B, out)
113106 vml_check_error ()
114107 return out
115108 end
116109 function ($ jlname)(A:: Array{$tout,N} , B:: Array{$tin,N} ) where {N}
117110 size (A) == size (B) || $ (broadcast ? :(return broadcast ($ jlname, A, B)) : :(throw (DimensionMismatch ())))
118111 out = similar (A)
119- ccall (($ mklfn, lib ), Nothing, (Int, Ptr{$ tin}, Ptr{$ tin}, Ptr{$ tout}), length (A), A, B, out)
112+ ccall (($ mklfn, libmkl_vml_avx ), Nothing, (Int, Ptr{$ tin}, Ptr{$ tin}, Ptr{$ tout}), length (A), A, B, out)
120113 vml_check_error ()
121114 return out
122115 end
0 commit comments