pub unsafe extern "C" fn cusolverDnXsyevBatched(
handle: cusolverDnHandle_t,
params: cusolverDnParams_t,
jobz: cusolverEigMode_t,
uplo: cublasFillMode_t,
n: i64,
dataTypeA: cudaDataType,
A: *mut c_void,
lda: i64,
dataTypeW: cudaDataType,
W: *mut c_void,
computeType: cudaDataType,
bufferOnDevice: *mut c_void,
workspaceInBytesOnDevice: size_t,
bufferOnHost: *mut c_void,
workspaceInBytesOnHost: size_t,
info: *mut c_int,
batchSize: i64,
) -> cusolverStatus_tExpand description
The helper functions below can calculate the sizes needed for pre-allocated buffer.
The following routine:
computes eigenvalues and eigenvectors of a sequence of symmetric (Hermitian) $n \times n$ matrices: $$ A_j\V_j = V_j\\Lambda_j $$
where $\Lambda_j$ is a real $n \times n$ diagonal matrix. $V_j$ is an $n \times n$ unitary matrix. The diagonal elements of $\Lambda_j$ are the eigenvalues of $A_j$ in ascending order.
syevBatched performs an eigendecomposition on each matrix. It requires that all matrices are of the same size n and are packed in a contiguous way,
$$
\begin{split}A = \begin{pmatrix}
{A0} & {A1} & \cdots \\
\end{pmatrix}\end{split}
$$
Each matrix is column-major with leading dimension lda, so the formula for random access is $A_{k}\operatorname{(i,j)} = {A\lbrack\ i\ +\ lda\*j\ +\ lda\*n\*k\rbrack}$.
The parameter W also contains the eigenvalues of each matrix in a contiguous way,
$$
\begin{split}W = \begin{pmatrix}
{W0} & {W1} & \cdots \\
\end{pmatrix}\end{split}
$$
The formula for random access of W is $W_{k}\operatorname{(j)} = {W\lbrack\ j\ +\ n\*k\rbrack}$.
The user has to provide device and host working space which are pointed to by the input parameters bufferOnDevice and bufferOnHost. The input parameters workspaceInBytesOnDevice and workspaceInBytesOnHost denote the size in bytes of the device and host working space, and returned by cusolverDnXsyevBatched_bufferSize.
The output parameter info is an integer array of size batchSize. If the function returns cusolverStatus_t::CUSOLVER_STATUS_INVALID_VALUE, the first element info\[0\] = -i (less than zero) indicates the i-th parameter is wrong (not counting handle). Otherwise, if info\[i\] > 0, syevBatched does not converge on the i-th matrix.
If jobz = cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR, $A_{j}$ contains the orthonormal eigenvectors of the matrix $A_{j}$.
Note that the problem size is limited by the condition nldabatchSize<=INT32_MAX primarily due to the current implementation constraints.
Algorithms supported by cusolverDnXsyevBatched
cusolverAlgMode_t::CUSOLVER_ALG_0 or NULL | Default. May switch between algorithms for best performance. |
cusolverAlgMode_t::CUSOLVER_ALG_1 | Uses a single algorithm for consistent accuracy over all n. |
List of input arguments for cusolverDnXsyevBatched_bufferSize and cusolverDnXsyevBatched:
The generic API has three different types, dataTypeA is data type of the matrix A, dataTypeW is data type of the array W and computeType is compute type of the operation. cusolverDnXsyevBatched only supports the following four combinations:
Valid combination of data type and compute type
| DataTypeA | DataTypeW | ComputeType | Meaning |
|---|---|---|---|
CUDA_R_32F | CUDA_R_32F | CUDA_R_32F | SSYEVBATCHED |
CUDA_R_64F | CUDA_R_64F | CUDA_R_64F | DSYEVBATCHED |
CUDA_C_32F | CUDA_R_32F | CUDA_C_32F | CSYEVBATCHED |
CUDA_C_64F | CUDA_R_64F | CUDA_C_64F | ZSYEVBATCHED |
§Parameters
handle: Handle to the cuSolverDN library context.params: Structure with information collected bycusolverDnSetAdvOptions.jobz: Specifies options to either compute eigenvalue only or compute eigen-pair:jobz=cusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTOR: Compute eigenvalues only;jobz=cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR: Compute eigenvalues and eigenvectors.uplo: Specifies which part ofAis stored.uplo=cublasFillMode_t::CUBLAS_FILL_MODE_LOWER: Lower triangle ofAis stored.uplo=cublasFillMode_t::CUBLAS_FILL_MODE_UPPER: Upper triangle ofAis stored.n: Number of rows (or columns) of matrixA.dataTypeA: Data type of arrayA.A: Array of dimensionlda * n * batchSizewithldais not less thanmax(1,n). Ifuplo=cublasFillMode_t::CUBLAS_FILL_MODE_UPPER, the leading n-by-n upper triangular part ofAjcontains the upper triangular part of the matrixAj. Ifuplo=cublasFillMode_t::CUBLAS_FILL_MODE_LOWER, the leading n-by-n lower triangular part ofAjcontains the lower triangular part of the matrixAj. On exit, ifjobz=cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR, andinfo\[j\]= 0,Ajcontains the orthonormal eigenvectors of the matrixAj. Ifjobz=cusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTOR, the contents ofAjare destroyed.lda: Leading dimension of two-dimensional array used to store matrixAj.ldais not less thanmax(1,n).dataTypeW: Data type of arrayW.W: A real array of dimensionn * batchSize. The eigenvalue values ofAj, in ascending order, i.e., sorted so thatWj(i) <= Wj(i+1).computeType: Data type of computation.bufferOnDevice: Device workspace. Array of typevoidof sizeworkspaceInBytesOnDevicebytes.workspaceInBytesOnDevice: Size in bytes ofbufferOnDevice, returned bycusolverDnXsyevBatched_bufferSize.bufferOnHost: Host workspace. Array of typevoidof sizeworkspaceInBytesOnHostbytes.workspaceInBytesOnHost: Size in bytes ofbufferOnHost, returned bycusolverDnXsyevBatched_bufferSize.info: An integer array of dimensionbatchSize. IfcusolverStatus_t::CUSOLVER_STATUS_INVALID_VALUEis returned,info\[0\] = -i(less than zero) indicatesi-thparameter is wrong (not counting handle). Otherwise, ifinfo\[i\] = 0, the operation is successful. Ifinfo\[i\] > 0,syevBatcheddoes not converge on thei-thmatrix.batchSize: Number of matrices.batchSizeis not less than 1.
§Return value
cusolverStatus_t::CUSOLVER_STATUS_INTERNAL_ERROR: An internal operation failed.cusolverStatus_t::CUSOLVER_STATUS_INVALID_VALUE: Invalid parameters were passed (n<0, ornldabatchSize>INT32_MAX, orlda<max(1,n), orjobzis notcusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTORoruplois notcublasFillMode_t::CUBLAS_FILL_MODE_LOWERorcublasFillMode_t::CUBLAS_FILL_MODE_UPPERorbatchSize<0).cusolverStatus_t::CUSOLVER_STATUS_NOT_INITIALIZED: The library was not initialized.cusolverStatus_t::CUSOLVER_STATUS_SUCCESS: The operation completed successfully.