muSOLVER API Reference
Functions
| Name | |
|---|---|
| MUSOLVER_EXPORT mublasStatus_t | musolverDnXgetrs(musolverDnHandle_t handle, const mublasOperation_t trans, const int n, const int nrhs, float * A, const int lda, const int * ipiv, float * B, const int ldb, void * buffer) GETRS solves a system of n linear equations on n variables in its factorized form. |
| MUSOLVER_EXPORT mublasStatus_t | musolverDnXgelsBatched_bufferSize(mublasOperation_t trans, const int m, const int n, const int nrhs, const int batch_count, int * buffer_size) Computes the size of the workspace buffer required for solving a batch of generalized least squares problems. |
| MUSOLVER_EXPORT mublasStatus_t | musolverDnXgelsBatched(musolverDnHandle_t handle, mublasOperation_t trans, const int m, const int n, const int nrhs, float *const A[], const int lda, float *const B[], const int ldb, int * info, const int batch_count, void * buffer) GELS_BATCHED solves a batch of overdetermined (or underdetermined) linear systems defined by a set of m-by-n matrices , and corresponding matrices , using the QR factorizations computed by GEQRF_BATCHED (or the LQ factorizations computed by GELQF_BATCHED). |
| MUSOLVER_EXPORT mublasStatus_t | musolverDnXgetrf_bufferSize(musolverDnHandle_t handle, const int m, const int n, float* A, const int lda, int * buffersize) Computes the workspace size needed for LU factorization of a general m-by-n matrix A. |
| MUSOLVER_EXPORT mublasStatus_t | musolverDnXgetrf(musolverDnHandle_t handle, const int m, const int n, float * A, const int lda, int * ipiv, int * info, void * buffer) GETRF computes the LU factorization of a general m-by-n matrix A using partial pivoting with row interchanges. |
| MUSOLVER_EXPORT mublasStatus_t | musolverDnXgetriBatched(musolverDnHandle_t handle, const int n, float *const A[], const int lda, int * ipiv, const int strideP, int * info, const int batch_count) GETRI_BATCHED inverts a batch of general n-by-n matrices using the LU factorization computed by GETRF_BATCHED. |
| MUSOLVER_EXPORT mublasStatus_t | musolverDnXgetrfBatched_bufferSize(musolverDnHandle_t handle, const int m, const int n, float* const A[], const int lda, const int batch_count, int * buffersize) Computes the required buffer size for a batched LU factorization of general m-by-n matrices. |
| MUSOLVER_EXPORT mublasStatus_t | musolverDnXgetrfBatched(musolverDnHandle_t handle, const int m, const int n, float *const A[], const int lda, int * ipiv, const int strideP, int * info, const int batch_count, void * buffer) GETRF_BATCHED computes the LU factorization of a batch of general m-by-n matrices using partial pivoting with row interchanges. |
Functions Documentation
function musolverDnXgetrs
MUSOLVER_EXPORT musolverStatus_t musolverDnXgetrs(
musolverDnHandle_t handle,
const mublasOperation_t trans,
const int n,
const int nrhs,
float * A,
const int lda,
const int * ipiv,
float * B,
const int ldb,
void * buffer
)
GETRS solves a system of n linear equations on n variables in its factorized form.
Parameters:
- handle musolverDnHandle_t.
- trans mublasOperation_t.
Specifies the form of the system of equations.
- n int. n >= 0.
The order of the system, i.e. the number of columns and rows of A.
- nrhs int. nrhs >= 0.
The number of right hand sides, i.e., the number of columns of the matrix B.
- A pointer to type. Array on the GPU of dimension lda*n.
The factors L and U of the factorization A = PLU returned by GETRF.
- lda int. lda >= n.
The leading dimension of A.
- ipiv pointer to int. Array on the GPU of dimension n.
The pivot indices returned by GETRF.
- B pointer to type. Array on the GPU of dimension ldb*nrhs.
On entry, the right hand side matrix B. On exit, the solution matrix X.
- ldb int. ldb >= n.
The leading dimension of B.
- buffer pointer to void. Workspace buffer allocated for the factorization process. The size of this buffer should be determined by a previous call to
[musolverXgetrf_bufferSize()](#function-musolverxgetrf-buffersize). The buffer is used internally during the factorization process to store temporary data.
It solves one of the following systems, depending on the value of trans:
Matrix A is defined by its triangular factors as returned by GETRF.
MUSOLVER_EXPORT musolverStatus_t musolverDnSgetrs(musolverDnHandle_t handle,
const mublasOperation_t trans,
const int n,
const int nrhs,
float* A,
const int lda,
const int* ipiv,
float* B,
const int ldb,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnDgetrs(musolverDnHandle_t handle,
const mublasOperation_t trans,
const int n,
const int nrhs,
double* A,
const int lda,
const int* ipiv,
double* B,
const int ldb,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnCgetrs(musolverDnHandle_t handle,
const mublasOperation_t trans,
const int n,
const int nrhs,
muComplex* A,
const int lda,
const int* ipiv,
muComplex* B,
const int ldb,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnZgetrs(musolverDnHandle_t handle,
const mublasOperation_t trans,
const int n,
const int nrhs,
muDoubleComplex* A,
const int lda,
const int* ipiv,
muDoubleComplex* B,
const int ldb,
void* buffer);
function musolverDnXgelsBatched_bufferSize
MUSOLVER_EXPORT musolverStatus_t musolverDnXgelsBatched_bufferSize(
mublasOperation_t trans,
const int m,
const int n,
const int nrhs,
const int batch_count,
int * buffer_size
)
Computes the size of the workspace buffer required for solving a batch of generalized least squares problems.
Parameters:
- trans mublasOperation_t.
Specifies the form of the matrix operation (none, transpose, or conjugate transpose).
- m int. m >= 0.
The number of rows of the matrices ( A ).
- n int. n >= 0.
The number of columns of the matrices ( A ).
- nrhs int. nrhs >= 0.
The number of right-hand sides (i.e., the number of columns of the matrices ( B )).
- batch_count int. batch_count >= 0.
The number of matrices in the batch.
- buffer_size pointer to int.
On output, the size of the workspace buffer required for the computations. The size is given in bytes.
This function calculates the size of the buffer needed to perform the generalized least squares computation for a batch of matrices. The buffer size depends on the matrix dimensions, the number of right-hand sides, and the batch count.
The workspace buffer is used internally by the musolverXgelsBatched function to perform the computations. The buffer must be allocated with the size determined by this function before calling musolverXgelsBatched.
MUSOLVER_EXPORT musolverStatus_t musolverDnSgelsBatched_bufferSize(mublasOperation_t trans,
const int m,
const int n,
const int nrhs,
const int batch_count,
int* buffer_size);
MUSOLVER_EXPORT musolverStatus_t musolverDnDgelsBatched_bufferSize(mublasOperation_t trans,
const int m,
const int n,
const int nrhs,
const int batch_count,
int* buffer_size);
MUSOLVER_EXPORT musolverStatus_t musolverDnCgelsBatched_bufferSize(mublasOperation_t trans,
const int m,
const int n,
const int nrhs,
const int batch_count,
int* buffer_size);
MUSOLVER_EXPORT musolverStatus_t musolverDnZgelsBatched_bufferSize(mublasOperation_t trans,
const int m,
const int n,
const int nrhs,
const int batch_count,
int* buffer_size);
function musolverDnXgelsBatched
MUSOLVER_EXPORT musolverStatus_t musolverDnXgelsBatched(
musolverDnHandle_t handle,
mublasOperation_t trans,
const int m,
const int n,
const int nrhs,
float *const A[],
const int lda,
float *const B[],
const int ldb,
int * info,
const int batch_count,
void * buffer
)
GELS_BATCHED solves a batch of overdetermined (or underdetermined) linear systems defined by a set of matrices and corresponding matrices , using the QR factorizations computed by GEQRF_BATCHED (or the LQ factorizations computed by GELQF_BATCHED).
Parameters
-
handle
musolverDnHandle_t
A handle to the cuSOLVER library context. -
trans
mublasOperation_t
Specifies the form of the system of equations. -
m
int
The number of rows of all matrices in the batch. -
n
int
The number of columns of all matrices in the batch. -
nrhs
int
The number of columns of all matrices and in the batch, i.e., the columns on the right-hand side. -
A
Array of pointers to type. Each pointer points to an array on the GPU of dimension .On entry, the matrices . On exit, the QR (or LQ) factorizations of as returned by GEQRF_BATCHED (or GELQF_BATCHED).
-
lda
int
Specifies the leading dimension of matrices . -
B
Array of pointers to type. Each pointer points to an array on the GPU of dimension .On entry, the matrices . On exit, when , is overwritten by the solution vectors (and the residuals in the overdetermined cases) stored as columns.
-
ldb
int
Specifies the leading dimension of matrices . -
info
Pointer toint. Array ofbatch_countintegers on the GPU.If , the solution of was successful. If , the solution of could not be computed because the input matrix is rank-deficient; the -th diagonal element of its triangular factor is zero.
-
batch_count
int
The number of matrices in the batch.
For each instance in the batch, depending on the value of trans, the problem solved by this function is either of the form:
If (or in the case of transpose/conjugate transpose), the system is overdetermined, and a least-squares solution approximating is found by minimizing
If (or in the case of transpose/conjugate transpose), the system is underdetermined, and a unique solution for is chosen such that is minimal.
MUSOLVER_EXPORT musolverStatus_t musolverDnSgelsBatched(musolverDnHandle_t handle,
mublasOperation_t trans,
const int m,
const int n,
const int nrhs,
float* const A[],
const int lda,
float* const B[],
const int ldb,
int* info,
const int batch_count,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnDgelsBatched(musolverDnHandle_t handle,
mublasOperation_t trans,
const int m,
const int n,
const int nrhs,
double* const A[],
const int lda,
double* const B[],
const int ldb,
int* info,
const int batch_count,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnCgelsBatched(musolverDnHandle_t handle,
mublasOperation_t trans,
const int m,
const int n,
const int nrhs,
muComplex* const A[],
const int lda,
muComplex* const B[],
const int ldb,
int* info,
const int batch_count,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnZgelsBatched(musolverDnHandle_t handle,
mublasOperation_t trans,
const int m,
const int n,
const int nrhs,
muDoubleComplex* const A[],
const int lda,
muDoubleComplex* const B[],
const int ldb,
int* info,
const int batch_count,
void* buffer);
function musolverDnXgetrf_bufferSize
MUSOLVER_EXPORT musolverStatus_t musolverDnXgetrf_bufferSize(
musolverDnHandle_t handle,
const int m,
const int n,
float* A,
const int lda,
int * buffersize
)
Computes the workspace size needed for LU factorization of a general m-by-n matrix A.
Parameters:
- handle
musolverDnHandle_tA handle to the cuSOLVER library context. - m int. m >= 0. The number of rows of the matrix A.
- n int. n >= 0. The number of columns of the matrix A.
- A pointer to type. Array on the GPU of dimension lda*n. The data in A is used only to infer the matrix layout and data type when estimating the required workspace size.
- lda int. lda >= m. Specifies the leading dimension of matrices A.
- buffersize pointer to int. On output, the size of the workspace buffer needed for the LU factorization. The size is given in bytes.
This function calculates the size of the workspace buffer required for the LU factorization of a matrix A using partial pivoting with row interchanges. It is important to determine this buffer size before performing the LU factorization with the musolverXgetrf() function. The size is calculated based on the matrix dimensions and the pivoting option. This information is used to allocate adequate memory for the LU factorization operation.
MUSOLVER_EXPORT musolverStatus_t musolverDnSgetrf_bufferSize(musolverDnHandle_t handle,
const int m,
const int n,
float* A,
const int lda,
int* buffersize);
MUSOLVER_EXPORT musolverStatus_t musolverDnDgetrf_bufferSize(musolverDnHandle_t handle,
const int m,
const int n,
double* A,
const int lda,
int* buffersize);
MUSOLVER_EXPORT musolverStatus_t musolverCgetrf_bufferSize(musolverDnHandle_t handle,
const int m,
const int n,
muComplex* A,
const int lda,
int* buffersize);
MUSOLVER_EXPORT musolverStatus_t musolverZgetrf_bufferSize(musolverDnHandle_t handle,
const int m,
const int n,
muDoubleComplex* A,
const int lda,
int* buffersize);
function musolverDnXgetrf
MUSOLVER_EXPORT musolverStatus_t musolverDnXgetrf(
musolverDnHandle_t handle,
const int m,
const int n,
float * A,
const int lda,
int * ipiv,
int * info,
void * buffer
)
GETRF computes the LU factorization of a general m-by-n matrix A using partial pivoting with row interchanges.
Parameters:
- handle musolverDnHandle_t.
- m int. m >= 0.
The number of rows of the matrix A.
- n int. n >= 0.
The number of columns of the matrix A.
- A pointer to type. Array on the GPU of dimension lda*n.
On entry, the m-by-n matrix A to be factored. On exit, the factors L and U from the factorization. The unit diagonal elements of L are not stored.
- lda int. lda >= m.
Specifies the leading dimension of A.
- ipiv pointer to int. Array on the GPU of dimension min(m,n).
The vector of pivot indices. Elements of ipiv are 1-based indices. For 1 <= i <= min(m,n), the row i of the matrix was interchanged with row ipiv[i]. Matrix P of the factorization can be derived from ipiv.
- info pointer to a int on the GPU.
If info = 0, successful exit. If info = i > 0, U is singular. U[i,i] is the first zero pivot.
- buffer pointer to void. Workspace buffer allocated for the factorization process. The size of this buffer should be determined by a previous call to musolverXgetrf_bufferSize(). The buffer is used internally during the factorization process to store temporary data.
(This is the blocked Level-3-BLAS version of the algorithm. An optimized internal implementation without muBLAS calls could be executed with mid-size matrices if optimizations are enabled (default option). For more details, see the "Tuning muSOLVER performance" section of the Library Design Guide.)
The factorization has the form
where is a permutation matrix, is lower triangular with unit diagonal elements (lower trapezoidal if ), and is upper triangular (upper trapezoidal if ).
MUSOLVER_EXPORT musolverStatus_t musolverDnSgetrf(musolverDnHandle_t handle,
const int m,
const int n,
float* A,
const int lda,
int* ipiv,
int* info,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnDgetrf(musolverDnHandle_t handle,
const int m,
const int n,
double* A,
const int lda,
int* ipiv,
int* info,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnCgetrf(musolverDnHandle_t handle,
const int m,
const int n,
muComplex* A,
const int lda,
int* ipiv,
int* info,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnZgetrf(musolverDnHandle_t handle,
const int m,
const int n,
muDoubleComplex* A,
const int lda,
int* ipiv,
int* info,
void* buffer);
function musolverDnXgetriBatched
MUSOLVER_EXPORT musolverStatus_t musolverDnXgetriBatched(
musolverDnHandle_t handle,
const int n,
float *const A[],
const int lda,
int * ipiv,
const int strideP,
int * info,
const int batch_count
)
GETRI_BATCHED inverts a batch of general n-by-n matrices using the LU factorization computed by GETRF_BATCHED.
Parameters:
-
handlemusolverDnHandle_t. -
nint. .
The number of rows and columns of all matrices in the batch. -
AArray of pointers to type. Each pointer points to an array on the GPU of dimension .
On entry, the factors and of the factorization returned byGETRF_BATCHED.
On exit, the inverses of if ; otherwise, undefined. -
ldaint. .
Specifies the leading dimension of matrices . -
ipivPointer toint. Array on the GPU (the size depends on the value ofstrideP).
The pivot indices returned byGETRF_BATCHED. -
stridePint.
Stride from the start of one vector to the next one .
There is no restriction for the value ofstrideP. Normal use case is . -
infoPointer toint. Array ofbatch_countintegers on the GPU.
If , successful exit for inversion of .
If , is singular. is the first zero pivot. -
batch_countint. .
Number of matrices in the batch.
The inverse of matrix in the batch is computed by solving the linear system:
where is the lower triangular factor of with unit diagonal elements, and is the upper triangular factor.
MUSOLVER_EXPORT musolverStatus_t musolverSgetriBatched(musolverDnHandle_t handle,
const int n,
float* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count);
MUSOLVER_EXPORT musolverStatus_t musolverDgetriBatched(musolverDnHandle_t handle,
const int n,
double* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count);
MUSOLVER_EXPORT musolverStatus_t musolverCgetriBatched(musolverDnHandle_t handle,
const int n,
muComplex* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count);
MUSOLVER_EXPORT musolverStatus_t musolverZgetriBatched(musolverDnHandle_t handle,
const int n,
muDoubleComplex* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count);
function musolverDnXgetrfBatched_bufferSize
MUSOLVER_EXPORT musolverStatus_t musolverDnXgetrfBatched_bufferSize(
musolverDnHandle_t handle,
const int m,
const int n,
float* const A[],
const int lda,
const int batch_count,
int * buffersize
)
Computes the required buffer size for a batched LU factorization of general m-by-n matrices.
Parameters:
-
handlemusolverDnHandle_t. The handle to the cuSOLVER library context. -
mint. .
The number of rows in each matrix in the batch. -
nint. .
The number of columns in each matrix in the batch. -
AArray of pointers to type. Each pointer points to an array on the GPU of dimension .
Array on the GPU of dimension lda*n. The data in A is used only to infer the matrix layout and data type when estimating the required workspace size. -
ldaint. .
Specifies the leading dimension of matrices . -
batch_countint. .
The number of matrices in the batch. -
buffersizeint*.
Pointer to an integer where the required buffer size (in bytes) is returned.
This function calculates the size of the workspace buffer needed for performing LU factorization on a batch of matrices using the corresponding batched GETRF routine.
MUSOLVER_EXPORT musolverStatus_t musolverDnSgetrfBatched_bufferSize(
musolverDnHandle_t handle, const int m, const int n, float* const A[], const int lda, const int batch_count, int* buffersize);
MUSOLVER_EXPORT musolverStatus_t musolverDnDgetrfBatched_bufferSize(
musolverDnHandle_t handle, const int m, const int n, double* const A[], const int lda, const int batch_count, int* buffersize);
MUSOLVER_EXPORT musolverStatus_t musolverDnCgetrfBatched_bufferSize(
musolverDnHandle_t handle, const int m, const int n, muComplex* const A[], const int lda, const int batch_count, int* buffersize);
MUSOLVER_EXPORT musolverStatus_t musolverDnZgetrfBatched_bufferSize(
musolverDnHandle_t handle, const int m, const int n, muDoubleComplex* const A[], const int lda, const int batch_count, int* buffersize);
function musolverDnXgetrfBatched
MUSOLVER_EXPORT musolverStatus_t musolverDnXgetrfBatched(
musolverDnHandle_t handle,
const int m,
const int n,
float *const A[],
const int lda,
int * ipiv,
const int strideP,
int * info,
const int batch_count,
void * buffer
)
GETRF_BATCHED computes the LU factorization of a batch of general m-by-n matrices using partial pivoting with row interchanges.
Parameters:
-
handlemublasHandle_t. -
mint. .
The number of rows of all matrices in the batch. -
nint. .
The number of columns of all matrices in the batch. -
AArray of pointers to type. Each pointer points to an array on the GPU of dimension .
On entry, the matrices to be factored. On exit, the factors and from the factorizations. The unit diagonal elements of are not stored. -
ldaint. .
Specifies the leading dimension of matrices . -
ipivPointer toint. Array on the GPU (the size depends on the value ofstrideP).
Contains the vectors of pivot indices (corresponding to ).
Dimension of is . Elements of are 1-based indices. For each instance in the batch and for , the row of the matrix was interchanged with row .
Matrix of the factorization can be derived from . -
stridePint.
Stride from the start of one vector to the next one .
There is no restriction for the value ofstrideP. Normal use case is . -
infoPointer toint. Array ofbatch_countintegers on the GPU.
If , successful exit for factorization of .
If , is singular. is the first zero pivot. -
batch_countint. .
Number of matrices in the batch.
(This is the blocked Level-3-BLAS version of the algorithm. An optimized internal implementation without muBLAS calls could be executed with mid-size matrices if optimizations are enabled (default option). For more details, see the "Tuning muSOLVER performance" section of the Library Design Guide).
The factorization of matrix in the batch has the form:
where is a permutation matrix, is lower triangular with unit diagonal elements (lower trapezoidal if ), and is upper triangular (upper trapezoidal if ).
MUSOLVER_EXPORT musolverStatus_t musolverDnSgetrfBatched(musolverDnHandle_t handle,
const int m,
const int n,
float* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnDgetrfBatched(musolverDnHandle_t handle,
const int m,
const int n,
double* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnCgetrfBatched(musolverDnHandle_t handle,
const int m,
const int n,
muComplex* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count,
void* buffer);
MUSOLVER_EXPORT musolverStatus_t musolverDnZgetrfBatched(musolverDnHandle_t handle,
const int m,
const int n,
muDoubleComplex* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count,
void* buffer);

