Linear System Solvers

The linear system solver is a core part of the OSQP algorithm. Depending on the problem instance, different linear system solvers can greatly speedup or reduce the computation time of OSQP. To set the preferred linear system solver, see Linear Systems Solvers.

Dynamic shared library loading

OSQP dynamically loads the shared libraries related to the selected external solver. Thus, there is no need to link it at compile time. The only requirement is that the shared library related to the solver is in the library path of the operating system

Operating system Path variable Extension
Linux LD_LIBRARY_PATH .so
Mac DYLD_LIBRARY_PATH .dylib
Windows PATH .dll

SuiteSparse LDL

OSQP comes with SuiteSparse LDL internally installed. It does not require any external shared library. SuiteSparse LDL is a sparse direct solver that works well for most small to medium sized problems. However, its becomes not really efficient for large scale problems since it is not multi-threaded.

MKL Pardiso

MKL Pardiso is an efficient multi-threaded linear system solver that works well for large scale problems part of the Intel Math Kernel Library. Intel offers free lincenses for MKL for most non-commercial applications.

Install with MKL

We can install MKL Pardiso by using the standard MKL installer. The main library to be loaded is called libmkl_rt. To add it, together with its dependencies, to your path, just execute the automatic MKL script.

Operating system Script
Linux source $MKLROOT/bin/mklvars.sh intel64
Mac source $MKLROOT/bin/mklvars.sh intel64
Windows %MKLROOT%\mklvars.bat intel64

where MKLROOT is the MKL installation directory.

Install with Anaconda

Anaconda Python distribution comes with the intel MKL libraries preinstalled including MKL Pardiso. To use this version, the Anaconda libraries folders have to be added to the system path. In particular, given the Anaconda installation directory ANACONDA_ROOT, we need to add the following folders:

  • libmkl_rt: This library is located in the folder ANACONDA_ROOT/pkgs/mkl-VERSION/lib where VERSION is the version of the mkl package.
  • libiomp: This library is located in the folder ANACONDA_ROOT/pkgs/intel-openmp-VERSION/lib where VERSION is the version of the intel-openmp package.