Skip to content

Commit 0c40844

Browse files
committed
resurrect
1 parent d87629a commit 0c40844

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ MKL_jll = "856f044c-d86e-5d09-b602-aeab76dc8ba7"
1010
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
1111

1212
[compat]
13-
MKL_jll = "2022.1"
13+
MKL_jll = "2023.1"
1414
julia = "1.8"
15+
Preferences = "1.4"
1516

1617
[extras]
1718
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@
44

55
MKL.jl is a Julia package that allows users to use the Intel MKL library for Julia's underlying BLAS and LAPACK, instead of OpenBLAS, which Julia ships with by default. Julia includes [libblastrampoline](https://github.com/staticfloat/libblastrampoline), which enables picking a BLAS and LAPACK library at runtime. A [JuliaCon 2021 talk](https://www.youtube.com/watch?v=t6hptekOR7s) provides details on this mechanism.
66

7-
This package requires Julia 1.7+
7+
This package requires Julia 1.7+.
88

9-
## Usage
10-
11-
If you want to use `MKL.jl` in your project, make sure it is the first package you load before any other package. It is essential that MKL be loaded before other packages so that it can find the Intel OMP library and avoid [issues resulting out of GNU OMP being loaded first](https://github.com/JuliaPackaging/BinaryBuilder.jl/issues/700).
9+
## Installation
1210

13-
## Installation (Julia 1.7 and newer):
11+
To install the package execute
1412

15-
Adding the package will replace the system BLAS and LAPACK with MKL provided ones at runtime. Note that the MKL package has to be loaded in every new Julia process. Upon quitting and restarting, Julia will start with the default OpenBLAS.
1613
```julia
1714
julia> using Pkg; Pkg.add("MKL")
1815
```
1916

20-
## To Check Installation:
17+
## Usage
18+
19+
Loading the package (`using MKL`) will replace the system BLAS and LAPACK with MKL provided ones at runtime. Make sure it is the first package you load before any other package. It is essential that MKL be loaded before other packages so that it can find the Intel OMP library and avoid [issues resulting out of GNU OMP being loaded first](https://github.com/JuliaPackaging/BinaryBuilder.jl/issues/700).
20+
21+
Note that the MKL package has to be loaded in every new Julia process. Upon quitting and restarting, Julia will start with the default OpenBLAS.
22+
23+
## Check
2124

2225
```julia
2326
julia> using LinearAlgebra
@@ -41,12 +44,10 @@ Note that you can put `using MKL` into your `startup.jl` to make Julia automatic
4144

4245
We use ILP64 by default on 64-bit systems, and LP64 on 32-bit systems.
4346

44-
## Using a preinstalled Intel MKL
47+
## Using a system-provided Intel MKL
4548

46-
If you already have an Intel MKL installation available (as on most HPC clusters), you can use the the environment variable `JULIA_MKL_PATH` or the [preference](https://github.com/JuliaPackaging/Preferences.jl) `mkl_path` to hint MKL.jl to the `libmkl_rt` library. Specifically, the options are:
49+
If you want to use a system-provided Intel MKL installation, you can set the [preference](https://github.com/JuliaPackaging/Preferences.jl) `mkl_path` to hint MKL.jl to the corresponding `libmkl_rt` library. Specifically, the options are:
4750

4851
* `mkl_jll` (default): Download and install MKL via [MKL_jll.jl](https://github.com/JuliaBinaryWrappers/MKL_jll.jl).
49-
* `system`: The package will try to automatically locate the libmkl_rt library (i.e. find it on the linker search path).
52+
* `system`: The package will try to automatically locate the system-provided libmkl_rt library (i.e. find it on the linker search path).
5053
* `path/to/my/libmkl_rt.<EXT>`: Explicit path to the `libmkl_rt.<EXT>` where `<EXT>` is the shared library extension of the system at hand (e.g. `.so`, `.dll`, `.dylib`)
51-
52-
Note that, in contrast to the preference, the environment variable only has an effect when MKL.jl is (re-)precompiled. To force a change of the MKL path after the compilation has happened, use the function `MKL.set_mkl_path`, which takes the options listed above as input. The usecase for the environment variable convenience is for automated installs such as CI systems, where the initial default choice should be set with no human interaction whatsoever.

src/MKL.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ using Preferences
44
using Libdl
55
using LinearAlgebra
66

7-
# Choose an MKL provider/path; taking an explicit preference as the first choice,
8-
# but if nothing is set as a preference, fall back to an environment variable,
9-
# and if that is not given, fall back to the default choice of `MKL_jll`.
10-
# Note: The environment variable is only read at (.ji) compile time and
11-
# not(!) every time before loading the package.
7+
# Choose an MKL path; taking an explicit preference as the first choice,
8+
# but if nothing is set as a preference, fall back to the default choice of `MKL_jll`.
129
const mkl_path = lowercase(something(
1310
@load_preference("mkl_path", nothing),
14-
get(ENV, "JULIA_MKL_PATH", nothing),
1511
"mkl_jll",
1612
)::String)
1713

@@ -38,7 +34,7 @@ function set_mkl_path(path)
3834
isfile(path) || error("The provided argument $path doesn't seem to be a valid path to libmkl_rt.")
3935
end
4036
@set_preferences!("mkl_path" => path)
41-
@info("New MKL provider/path set; please restart Julia to see this take effect", path)
37+
@info("New MKL preference set; please restart Julia to see this take effect", path)
4238
end
4339

4440
using LinearAlgebra

0 commit comments

Comments
 (0)