muSOLVER API Reference
Functions
| Name | |
|---|---|
| MUSOLVER_EXPORT mublasStatus_t | musolverXgetrs_bufferSize(mublasOperation_t trans, const int n, const int nrhs, int * buffersize) Calculates the required workspace buffer size for the GETRS function. |
| MUSOLVER_EXPORT mublasStatus_t | musolverXgetrs(mublasHandle_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 | musolverXgelsBatched_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 | musolverXgelsBatched(mublasHandle_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) 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 | musolverXgetrf_bufferSize(const int m, const int n, const bool pivot, int * buffersize) Computes the workspace size needed for LU factorization of a general m-by-n matrix A. |
| MUSOLVER_EXPORT mublasStatus_t | musolverXgetrf(mublasHandle_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 | musolverXgetriBatched(mublasHandle_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 | musolverXgetrfBatched_bufferSize(const int m, const int n, const bool pivot, 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 | musolverXgetrfBatched(mublasHandle_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 musolverXgetrs_bufferSize
MUSOLVER_EXPORT mublasStatus_t musolverXgetrs_bufferSize(
mublasOperation_t trans,
const int n,
const int nrhs,
int * buffersize
)
Calculates the required workspace buffer size for the GETRS function.
Parameters:
- trans mublasOperation_t.
Specifies the form of the system of equations. Determines whether the system is solved with , , or .
- n int. n >= 0.
The order of the system, i.e., the number of rows and columns of matrix A.
- nrhs int. nrhs >= 0.
The number of right-hand sides, i.e., the number of columns of matrix B.
- buffersize pointer to int.
The size of the workspace buffer required for the musolverXgetrs function. This value should be used to allocate sufficient memory for the buffer.
This function determines the size of the workspace buffer needed for the musolverXgetrs function. The buffer size is dependent on the size of the system of equations and the number of right-hand sides.
To obtain the buffer size, call this function before invoking musolverXgetrs. Allocate a buffer of at least the size returned by this function and pass it to musolverXgetrs as the buffer parameter.
The buffer size calculated by this function ensures that the internal workspace used during the solve operation has sufficient space.
MUSOLVER_EXPORT mublasStatus_t musolverSgetrs_bufferSize(mublasOperation_t trans,
const int n,
const int nrhs,
int* buffersize);
MUSOLVER_EXPORT mublasStatus_t musolverDgetrs_bufferSize(mublasOperation_t trans,
const int n,
const int nrhs,
int* buffersize);
MUSOLVER_EXPORT mublasStatus_t musolverCgetrs_bufferSize(mublasOperation_t trans,
const int n,
const int nrhs,
int* buffersize);
MUSOLVER_EXPORT mublasStatus_t musolverZgetrs_bufferSize(mublasOperation_t trans,
const int n,
const int nrhs,
int* buffersize);
function musolverXgetrs
MUSOLVER_EXPORT mublasStatus_t musolverXgetrs(
mublasHandle_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 mublasHandle_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 mublasStatus_t musolverSgetrs(mublasHandle_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 mublasStatus_t musolverDgetrs(mublasHandle_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 mublasStatus_t musolverCgetrs(mublasHandle_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 mublasStatus_t musolverZgetrs(mublasHandle_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 musolverXgelsBatched_bufferSize
MUSOLVER_EXPORT mublasStatus_t musolverXgelsBatched_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 mublasStatus_t musolverCgelsBatched_bufferSize(mublasOperation_t trans,
const int m,
const int n,
const int nrhs,
const int batch_count,
int* buffer_size);
function musolverXgelsBatched
MUSOLVER_EXPORT mublasStatus_t musolverXgelsBatched(
mublasHandle_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
)
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
mublasHandle_t
A handle to the cuBLAS 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 mublasStatus_t musolverCgelsBatched(mublasHandle_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);
function musolverXgetrf_bufferSize
MUSOLVER_EXPORT mublasStatus_t musolverXgetrf_bufferSize(
const int m,
const int n,
const bool pivot,
int * buffersize
)
Computes the workspace size needed for LU factorization of a general m-by-n matrix A.
Parameters:
- m int. m >= 0. The number of rows of the matrix A.
- n int. n >= 0. The number of columns of the matrix A.
- pivot bool. Indicates whether pivoting is used. If true, pivoting is performed; otherwise, it is not.
- 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 mublasStatus_t musolverSgetrf_bufferSize(const int m,
const int n,
const bool pivot,
int* buffersize);
MUSOLVER_EXPORT mublasStatus_t musolverDgetrf_bufferSize(const int m,
const int n,
const bool pivot,
int* buffersize);
MUSOLVER_EXPORT mublasStatus_t musolverCgetrf_bufferSize(const int m,
const int n,
const bool pivot,
int* buffersize);
MUSOLVER_EXPORT mublasStatus_t musolverZgetrf_bufferSize(const int m,
const int n,
const bool pivot,
int* buffersize);
function musolverXgetrf
MUSOLVER_EXPORT mublasStatus_t musolverXgetrf(
mublasHandle_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 mublasHandle_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 mublasStatus_t musolverSgetrf(mublasHandle_t handle,
const int m,
const int n,
float* A,
const int lda,
int* ipiv,
int* info,
void* buffer);
MUSOLVER_EXPORT mublasStatus_t musolverDgetrf(mublasHandle_t handle,
const int m,
const int n,
double* A,
const int lda,
int* ipiv,
int* info,
void* buffer);
MUSOLVER_EXPORT mublasStatus_t musolverCgetrf(mublasHandle_t handle,
const int m,
const int n,
muComplex* A,
const int lda,
int* ipiv,
int* info,
void* buffer);
MUSOLVER_EXPORT mublasStatus_t musolverZgetrf(mublasHandle_t handle,
const int m,
const int n,
muDoubleComplex* A,
const int lda,
int* ipiv,
int* info,
void* buffer);
function musolverXgetriBatched
MUSOLVER_EXPORT mublasStatus_t musolverXgetriBatched(
mublasHandle_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:
-
handlemublasHandle_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 mublasStatus_t musolverSgetriBatched(mublasHandle_t handle,
const int n,
float* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count);
MUSOLVER_EXPORT mublasStatus_t musolverDgetriBatched(mublasHandle_t handle,
const int n,
double* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count);
MUSOLVER_EXPORT mublasStatus_t musolverCgetriBatched(mublasHandle_t handle,
const int n,
muComplex* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count);
MUSOLVER_EXPORT mublasStatus_t musolverZgetriBatched(mublasHandle_t handle,
const int n,
muDoubleComplex* const A[],
const int lda,
int* ipiv,
const int strideP,
int* info,
const int batch_count);
function musolverXgetrfBatched_bufferSize
MUSOLVER_EXPORT mublasStatus_t musolverXgetrfBatched_bufferSize(
const int m,
const int n,
const bool pivot,
const int batch_count,
int * buffersize
)
Computes the required buffer size for a batched LU factorization of general m-by-n matrices.
Parameters:
-
mint. .
The number of rows in each matrix in the batch. -
nint. .
The number of columns in each matrix in the batch. -
pivotbool.
Specifies whether pivoting is applied during the factorization. Iftrue, pivoting is performed; otherwise, it is not. -
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 mublasStatus_t musolverSgetrfBatched_bufferSize(
const int m, const int n, const bool pivot, const int batch_count, int* buffersize);
MUSOLVER_EXPORT mublasStatus_t musolverDgetrfBatched_bufferSize(
const int m, const int n, const bool pivot, const int batch_count, int* buffersize);
MUSOLVER_EXPORT mublasStatus_t musolverCgetrfBatched_bufferSize(
const int m, const int n, const bool pivot, const int batch_count, int* buffersize);
MUSOLVER_EXPORT mublasStatus_t musolverZgetrfBatched_bufferSize(
const int m, const int n, const bool pivot, const int batch_count, int* buffersize);
function musolverXgetrfBatched
MUSOLVER_EXPORT mublasStatus_t musolverXgetrfBatched(
mublasHandle_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 mublasStatus_t musolverSgetrfBatched(mublasHandle_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 mublasStatus_t musolverDgetrfBatched(mublasHandle_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 mublasStatus_t musolverCgetrfBatched(mublasHandle_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 mublasStatus_t musolverZgetrfBatched(mublasHandle_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);

