Skip to content

Commit c54fe34

Browse files
authored
[documentation] Add more details about BLAS and LAPACK backends (#418)
1 parent 2e63baa commit c54fe34

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ set_attribute(model, "hsllib", HSL_jll.libhsl_path)
274274
set_attribute(model, "linear_solver", "ma86")
275275
```
276276

277+
The available HSL solvers are `"ma27"`, `"ma57"`, `"ma86"`, `"ma87"`, and `"ma97"`.
278+
We recommend using either sequential BLAS and LAPACK backends or a multithreaded version
279+
limited to one thread when employing the linear solvers `"ma86"`, `"ma87"`, or `"ma97"`.
280+
These solvers already leverage parallelism via OpenMP, and enabling multiple threads in
281+
BLAS and LAPACK may result in thread oversubscription.
282+
277283
#### macOS users
278284

279285
Due to the security policy of macOS, Mac users may need to delete the quarantine
@@ -318,13 +324,26 @@ With Julia v1.9 or later, Ipopt and the linear solvers [MUMPS](https://mumps-sol
318324
[`libblastrampoline`](https://github.com/JuliaLinearAlgebra/libblastrampoline)
319325
(LBT), a library that can change between BLAS and LAPACK backends at runtime.
320326

321-
The default BLAS and LAPACK backend is [OpenBLAS](https://github.com/OpenMathLib/OpenBLAS).
327+
Note that the BLAS and LAPACK backends loaded at runtime must be compiled with 32-bit integers.
328+
The default BLAS and LAPACK backend is [OpenBLAS](https://github.com/OpenMathLib/OpenBLAS),
329+
and we rely on the Julia artifact `OpenBLAS32_jll.jl` if no backend is loaded before `using Ipopt`.
322330

323331
Using LBT, we can also switch dynamically to other BLAS backends such as Intel
324332
MKL, BLIS, and Apple Accelerate. Because Ipopt and the linear solvers heavily
325333
rely on BLAS and LAPACK routines, using an optimized backend for a particular
326334
platform can improve the performance.
327335

336+
### Sequential BLAS and LAPACK
337+
338+
If you have `ReferenceBLAS32_jll.jl` and `LAPACK32_jll.jl` installed,
339+
switch to sequential and [reference version of BLAS and LAPACK](https://github.com/Reference-LAPACK/lapack) with:
340+
```julia
341+
using ReferenceBLAS32_jll, LAPACK32_jll
342+
LinearAlgebra.BLAS.lbt_forward(libblas32)
343+
LinearAlgebra.BLAS.lbt_forward(liblapack32)
344+
using Ipopt
345+
```
346+
328347
### MKL
329348

330349
If you have [MKL.jl](https://github.com/JuliaLinearAlgebra/MKL.jl) installed,
@@ -337,17 +356,16 @@ using Ipopt
337356

338357
### BLIS
339358

340-
If you have [BLISBLAS.jl](https://github.com/JuliaLinearAlgebra/BLISBLAS.jl)
341-
installed, switch to BLIS by adding `using BLISBLAS` to your code:
359+
If you have `BLIS32_jll.jl` and `LAPACK32_jll.jl` installed,
360+
switch to [BLIS](https://github.com/flame/blis) with:
342361

343362
```julia
344-
using BLISBLAS
363+
using blis32_jll, LAPACK32_jll
364+
LinearAlgebra.BLAS.lbt_forward(blis32)
365+
LinearAlgebra.BLAS.lbt_forward(liblapack32)
345366
using Ipopt
346367
```
347368

348-
Note that this will replace OpenBLAS's BLAS functionality by BLIS. OpenBLAS will
349-
still be used for LAPACK functionality.
350-
351369
### AppleAccelerate
352370

353371
If you are using macOS ≥ v13.4 and you have [AppleAccelerate.jl](https://github.com/JuliaLinearAlgebra/AppleAccelerate.jl) installed, add `using AppleAccelerate` to your code:

0 commit comments

Comments
 (0)