@@ -17,26 +17,45 @@ You can also install directly from source
1717 cd scs-python
1818 python -m pip install .
1919
20+ Linear solver backends
21+ ----------------------
22+
23+ The pre-built wheels and a from-source install always include two CPU linear
24+ solvers that require no additional dependencies:
25+
26+ - :code: `QDLDL ` — the default sparse direct solver (bundled with SCS).
27+ - :code: `CPU_INDIRECT ` — the sparse matrix-free solver based on conjugate
28+ gradients.
29+
30+ The remaining backends require either a platform-specific library (Apple
31+ Accelerate, MKL) or a build-time flag plus an external dependency (LAPACK for
32+ dense, CUDA + cuDSS for GPU). Each section below describes what to install and
33+ how to enable the backend. See :ref: `linear_solver ` for an overview of each
34+ solver and :ref: `python_interface ` for how to select one at runtime.
35+
2036Apple Accelerate (macOS)
2137""""""""""""""""""""""""
2238
2339On macOS the Apple Accelerate backend is built and included automatically —
2440no extra install flags are needed. It uses the Accelerate framework's sparse
2541LDL\ :sup: `T` solver, which is optimized for Apple hardware including Apple
26- Silicon. See :ref: `here <python_interface >` for how to select Accelerate when
27- solving.
42+ Silicon. The default :code: `linear_solver=scs.LinearSolver.AUTO ` selects the
43+ bundled QDLDL on macOS; opt in to Accelerate explicitly with
44+ :code: `linear_solver=scs.LinearSolver.ACCELERATE `.
2845
2946MKL
3047"""
3148
32- If you have MKL, you can install the MKL Pardiso interface using
49+ The pre-built wheels (:code: `pip install scs `) include MKL on x86_64 Linux and
50+ Windows. When installing from source, you can enable MKL with:
3351
3452.. code :: bash
3553
3654 python -m pip install -Csetup-args=-Dlink_mkl=true .
3755
38- See :ref: `here <python_interface >` for how to enable MKL when solving. MKL is
39- typically faster than the built-in linear system solver.
56+ When using the default :code: `linear_solver=scs.LinearSolver.AUTO `, MKL is
57+ selected automatically on Linux and Windows if available. MKL is
58+ typically faster than the built-in QDLDL linear system solver.
4059
4160The published Linux x86_64 wheels prefer the threaded MKL variant and include
4261the Intel OpenMP runtime (:code: `libiomp5 `). Windows currently falls back to
@@ -56,21 +75,71 @@ also checks that the process-wide MKL interface layer matches the LP64/ILP64
5675mode it was compiled for, and fails early if another library already set an
5776incompatible MKL interface.
5877
59- GPU
60- """
78+ Dense direct (LAPACK)
79+ """""""""""""""""""""
80+
81+ The :ref: `dense direct solver <dense >` reduces the KKT system to a smaller
82+ Gram matrix and factorizes it with LAPACK's Cholesky routines. It is well
83+ suited to small-to-medium problems with a dense constraint matrix :math: `A`,
84+ where dense BLAS/LAPACK outperforms sparse factorization.
6185
62- If you have a GPU and cuDSS installed you can install the GPU direct sparse
63- solver using
86+ Build from source with:
87+
88+ .. code :: bash
89+
90+ python -m pip install -Csetup-args=-Duse_lapack=true .
91+
92+ This requires BLAS and LAPACK development headers to be discoverable by
93+ :code: `pkg-config `. Most platforms satisfy this out of the box (Apple
94+ Accelerate on macOS, OpenBLAS / MKL on Linux, MKL on Windows). Select the
95+ backend at runtime with
96+ :code: `linear_solver=scs.LinearSolver.CPU_DENSE `.
97+
98+ GPU direct (cuDSS)
99+ """"""""""""""""""
100+
101+ The :ref: `cuDSS backend <cudss_solver >` runs the sparse direct factorization
102+ and solves on an NVIDIA GPU via `NVIDIA cuDSS
103+ <https://developer.nvidia.com/cudss> `_. For large problems it is typically
104+ substantially faster than any CPU backend.
105+
106+ **Prerequisites. ** The build links against both the CUDA runtime and cuDSS,
107+ so you need all of the following installed and discoverable by
108+ :code: `pkg-config ` / the linker before running :code: `pip install `:
109+
110+ 1. An NVIDIA GPU with a recent CUDA-capable driver.
111+ 2. The `CUDA Toolkit <https://developer.nvidia.com/cuda-downloads >`_
112+ (provides :code: `nvcc `, the CUDA runtime headers, and :code: `cuda.pc `
113+ used by the build).
114+ 3. The `cuDSS library <https://developer.nvidia.com/cudss-downloads >`_ (ships
115+ a :code: `cudss.pc ` pkg-config file). cuDSS is also available on
116+ `conda-forge <https://anaconda.org/conda-forge/libcudss >`_ as
117+ :code: `libcudss ` / :code: `libcudss-dev `.
118+
119+ Make sure the directories containing :code: `cuda.pc ` and :code: `cudss.pc ` are
120+ on :code: `PKG_CONFIG_PATH `, and that the corresponding shared libraries are on
121+ :code: `LD_LIBRARY_PATH ` (Linux) at runtime. A typical Linux environment looks
122+ like:
123+
124+ .. code :: bash
125+
126+ export PATH=/usr/local/cuda/bin:$PATH
127+ export PKG_CONFIG_PATH=/usr/local/cuda/lib64/pkgconfig:/opt/nvidia/cudss/lib64/pkgconfig:$PKG_CONFIG_PATH
128+ export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/opt/nvidia/cudss/lib64:$LD_LIBRARY_PATH
129+
130+ **Install. ** Once the prerequisites are in place, build SCS with:
64131
65132.. code :: bash
66133
67134 python -m pip install -Csetup-args=-Dlink_cudss=true -Csetup-args=-Dint32=true .
68135
69- See :ref: `here <python_interface >` for how to enable the GPU when solving. The
70- sparse direct GPU solver is typically very fast.
136+ The :code: `int32=true ` flag is required because cuDSS only supports 32-bit
137+ integer indices. Select the backend at runtime with
138+ :code: `linear_solver=scs.LinearSolver.CUDSS `.
71139
72- See `here <https://colab.research.google.com/drive/1POCgDNFg8fycHMI9T9N6V3iHFhXRthjn?usp=sharing >`_ for an example colab where the cuDSS version of SCS, along with
73- required dependencies, is installed and used.
140+ See `this Colab notebook <https://colab.research.google.com/drive/1POCgDNFg8fycHMI9T9N6V3iHFhXRthjn?usp=sharing >`_
141+ for a worked end-to-end example that installs CUDA, cuDSS, and the cuDSS
142+ build of SCS, then solves a problem on a GPU.
74143
75144.. _python_spectral_install :
76145
@@ -107,8 +176,12 @@ You can install with OpenMP parallelization support using
107176
108177 python legacy_setup.py install --scs --openmp
109178
110- You can install the GPU indirect solver using
179+ You can install the :ref: ` GPU indirect solver < gpu_indirect >` using
111180
112181.. code :: bash
113182
114183 python legacy_setup.py install --scs --gpu
184+
185+ The GPU indirect solver is effectively deprecated; the cuDSS direct solver
186+ above is the recommended GPU backend.
187+
0 commit comments