You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Selecting a specific driver is an advanced feature intended for users who need to target a specific computational backend, such as a GPU. For most use cases, the default driver selection is sufficient.
394
+
395
+
Each algorithm in MatrixAlgebraKit can optionally accept a `driver` keyword argument to explicitly select the computational backend.
396
+
By default, the driver is set to `DefaultDriver()`, which automatically selects the most appropriate backend based on the input matrix type.
397
+
The available drivers are:
398
+
399
+
```@docs; canonical=false
400
+
MatrixAlgebraKit.DefaultDriver
401
+
MatrixAlgebraKit.LAPACK
402
+
MatrixAlgebraKit.CUSOLVER
403
+
MatrixAlgebraKit.ROCSOLVER
404
+
MatrixAlgebraKit.GLA
405
+
MatrixAlgebraKit.Native
406
+
```
407
+
408
+
For example, to force LAPACK for a generic matrix type, or to use a GPU backend:
409
+
410
+
```julia
411
+
using MatrixAlgebraKit
412
+
using MatrixAlgebraKit: LAPACK, CUSOLVER # driver types are not exported by default
413
+
414
+
# Default: driver is selected automatically based on the input type
415
+
U, S, Vᴴ =svd_compact(A)
416
+
U, S, Vᴴ =svd_compact(A; alg =SafeDivideAndConquer())
417
+
418
+
# Expert: explicitly select LAPACK
419
+
U, S, Vᴴ =svd_compact(A; alg =SafeDivideAndConquer(; driver =LAPACK()))
420
+
421
+
# Expert: use a GPU backend (requires loading the appropriate extension)
422
+
U, S, Vᴴ =svd_compact(A; alg =QRIteration(; driver =CUSOLVER()))
423
+
```
424
+
425
+
Similarly, for QR decompositions:
426
+
427
+
```julia
428
+
using MatrixAlgebraKit: LAPACK # driver types are not exported by default
429
+
430
+
# Default: driver is selected automatically
431
+
Q, R =qr_compact(A)
432
+
Q, R =qr_compact(A; alg =Householder())
433
+
434
+
# Expert: explicitly select a driver
435
+
Q, R =qr_compact(A; alg =Householder(; driver =LAPACK()))
436
+
```
437
+
391
438
## [Gauge choices](@id sec_gaugefix)
392
439
393
440
Both eigenvalue and singular value decompositions have residual gauge degrees of freedom even when the eigenvalues or singular values are unique.
0 commit comments