Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loading Pardiso on mac when MKL does not support it #95

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ library.
### MKL PARDISO

By default Julia, will automatically install a suitable MKL for your platform.
Note that if you use a mac you will need to pin `MKL_jll` to version 2022.

If you rather use a self installed MKL follow these instructions:

* Set the `MKLROOT` environment variable. See the [MKL getting started
Expand All @@ -33,7 +35,7 @@ If you rather use a self installed MKL follow these instructions:

### PARDISO 6.0

* Put the PARDISO library `libpardiso600-WIN-X86-64.dll`, `libpardiso600-GNUXXX-X86-64.so` or
* Put the PARDISO library `libpardiso600-WIN-X86-64.dll`, `libpardiso600-GNUXXX-X86-64.so` or
`libpardiso600-MACOS-X86-64.dylib` in a folder somewhere and set the environment variable `JULIA_PARDISO` to that folder.
For example, create an entry `ENV["JULIA_PARDISO"] = "/Users/Someone/Pardiso"` in the
`.julia/config/startup.jl` file and download the Pardiso library to that folder.
Expand Down Expand Up @@ -128,8 +130,8 @@ which gives
julia> S
5×5 Array{Float64,2}:
-0.121404 1.49473 -1.25965 7.40326 0.571538
-19.4928 -7.71151 12.9496 -7.13646 -20.4194
9.88029 3.35502 -7.2346 1.70651 13.9759
-19.4928 -7.71151 12.9496 -7.13646 -20.4194
9.88029 3.35502 -7.2346 1.70651 13.9759
-9.06094 -5.86454 7.44917 -2.54985 -9.17327
-33.7006 -17.8323 20.2588 -19.5863 -37.6132
```
Expand Down
8 changes: 5 additions & 3 deletions src/Pardiso.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
const PARDISO_LOADED = Ref(false)

function __init__()
if !LOCAL_MKL_FOUND
if MKL_jll.is_available()
libmkl_rt[] = MKL_jll.libmkl_rt_path
else
elseif LOCAL_MKL_FOUND

Check warning on line 114 in src/Pardiso.jl

View check run for this annotation

Codecov / codecov/patch

src/Pardiso.jl#L114

Added line #L114 was not covered by tests
if Sys.iswindows()
libmkl_rt[] = "mkl_rt"
elseif Sys.isapple()
Expand All @@ -130,7 +130,9 @@

# This is apparently needed for MKL to not get stuck on 1 thread when
# libpardiso is loaded in the block below...
get_nprocs_mkl()
if libmkl_rt[] !== ""
get_nprocs_mkl()
end

if PARDISO_LIB_FOUND
try
Expand Down
3 changes: 3 additions & 0 deletions src/mkl_pardiso.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
end

function MKLPardisoSolver()
if !MKL_jll.is_available()
error("MKL is not available no this platform")

Check warning on line 17 in src/mkl_pardiso.jl

View check run for this annotation

Codecov / codecov/patch

src/mkl_pardiso.jl#L17

Added line #L17 was not covered by tests
end
pt = zeros(Int, 64)
iparm = zeros(MklInt, 64)
mtype = REAL_NONSYM
Expand Down
Loading