Skip to content

Commit

Permalink
minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
carstenbauer committed Jul 20, 2021
1 parent fa0d197 commit 8e67f8c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ Libraries:

Note that you can put `using MKL` into your `startup.jl` to make Julia automatically use Intel MKL in every session.

To switch back to "using OpenBLAS" in an active session, you can run the following code

```julia
using OpenBLAS_jll
LinearAlgebra.BLAS.lbt_forward(OpenBLAS_jll.libopenblas_path; clear=true);
```

### Using a preinstalled Intel MKL

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:
Expand All @@ -38,7 +45,6 @@ If you already have an Intel MKL installation available (as on most HPC clusters

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.


## Installation (Julia 1.6 and older)

On older releases of Julia, a new system image build happens right after installation. If it doesn't (happens when MKL_jll.jl has been installed before), run the following command to build a new system image and restart Julia.
Expand All @@ -55,7 +61,7 @@ julia> BLAS.vendor() # replaced by BLAS.get_config() in Julia versions >= 1.7
:mkl
```

To revert back to OpenBLAS you currently need to reinstall Julia.
For Julia 1.6 and older, you need to reinstall Julia to revert back to using OpenBLAS.

## 64-bit vs 32-bit version of Intel MKL

Expand Down
3 changes: 1 addition & 2 deletions src/MKL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module MKL

using Preferences
using Libdl
using LinearAlgebra

# Choose an MKL provider/path; taking an explicit preference as the first choice,
# but if nothing is set as a preference, fall back to an environment variable,
Expand Down Expand Up @@ -42,8 +43,6 @@ end

is_lbt_available() = VERSION > v"1.7.0-DEV.641"

is_lbt_available() && using LinearAlgebra

if Base.USE_BLAS64
const MKLBlasInt = Int64
else
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using MKL
using Test

if MKL.is_lbt_available()
@test BLAS.get_config().loaded_libs[1].libname == libmkl_rt
@test BLAS.get_config().loaded_libs[1].libname == MKL.libmkl_rt
else
@test BLAS.vendor() == :mkl
end
Expand Down

0 comments on commit 8e67f8c

Please sign in to comment.