» 1. Introduction v13.0 | PDF | Archive cuSOLVER API Reference The API reference guide for cuSOLVER, a GPU accelerated library for decompositions and linear system solutions for both dense and sparse matrices. 1. Introduction The cuSolver library is a high-level package based on the cuBLAS and cuSPARSE libraries. It consists of two modules corresponding to two sets of API: The cuSolver API on a single GPU The cuSolverMG API on a single node multiGPU Each of these can be used independently or in concert with other toolkit libraries. To simplify the notation, cuSolver denotes single GPU API and cuSolverMg denotes multiGPU API. The intent of cuSolver is to provide useful LAPACK-like features, such as common matrix factorization and triangular solve routines for dense matrices, a sparse least-squares solver and an eigenvalue solver. In addition cuSolver provides a new refactorization library useful for solving sequences of matrices with a shared sparsity pattern. cuSolver combines three separate components under a single umbrella. The first part of cuSolver is called cuSolverDN, and deals with dense matrix factorization and solve routines such as LU, QR, SVD and LDLT, as well as useful utilities such as matrix and vector permutations. Next, cuSolverSP provides a new set of sparse routines based on a sparse QR factorization. Not all matrices have a good sparsity pattern for parallelism in factorization, so the cuSolverSP library also provides a CPU path to handle those sequential-like matrices. For those matrices with abundant parallelism, the GPU path will deliver higher performance. The library is designed to be called from C and C++. The final part is cuSolverRF, a sparse re-factorization package that can provide very good performance when solving a sequence of matrices where only the coefficients are changed but the sparsity pattern remains the same. The GPU path of the cuSolver library assumes data is already in the device memory. It is the responsibility of the developer to allocate memory and to copy data between GPU memory and CPU memory using standard CUDA runtime API routines, such as cudaMalloc(), cudaFree(), cudaMemcpy(), and cudaMemcpyAsync(). cuSolverMg is GPU-accelerated ScaLAPACK. By now, cuSolverMg supports 1-D column block cyclic layout and provides symmetric eigenvalue solver. Note The cuSolver library requires hardware with a CUDA Compute Capability (CC) of 5.0 or higher. Please see the CUDA C++ Programming Guide for a list of the Compute Capabilities corresponding to all NVIDIA GPUs. Note cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. 1.1. cuSolverDN: Dense LAPACK The cuSolverDN library was designed to solve dense linear systems of the form \\\[Ax = b\\\] where the coefficient matrix \\(A\\in R^{nxn}\\), right-hand-side vector \\(b\\in R^{n}\\) and solution vector \\(x\\in R^{n}\\) The cuSolverDN library provides QR factorization and LU with partial pivoting to handle a general matrix A, which may be non-symmetric. Cholesky factorization is also provided for symmetric/Hermitian matrices. For symmetric indefinite matrices, we provide Bunch-Kaufman (LDL) factorization. The cuSolverDN library also provides a helpful bidiagonalization routine and singular value decomposition (SVD). The cuSolverDN library targets computationally-intensive and popular routines in LAPACK, and provides an API compatible with LAPACK. The user can accelerate these time-consuming routines with cuSolverDN and keep others in LAPACK without a major change to existing code. 1.2. cuSolverSP: Sparse LAPACK The cuSolverSP library was mainly designed to a solve sparse linear system \\\[Ax = b\\\] and the least-squares problem \\\[x = {argmin}{||}A\*z - b{||}\\\] where sparse matrix \\(A\\in R^{mxn}\\), right-hand-side vector \\(b\\in R^{m}\\) and solution vector \\(x\\in R^{n}\\). For a linear system, we require m=n. The core algorithm is based on sparse QR factorization. The matrix A is accepted in CSR format. If matrix A is symmetric/Hermitian, the user has to provide a full matrix, ie fill missing lower or upper part. If matrix A is symmetric positive definite and the user only needs to solve \\(Ax = b\\), Cholesky factorization can work and the user only needs to provide the lower triangular part of A. On top of the linear and least-squares solvers, the cuSolverSP library provides a simple eigenvalue solver based on shift-inverse power method, and a function to count the number of eigenvalues contained in a box in the complex plane. Note cuSolverSp is deprecated and will be removed in a future major release. It is recommended migrating to a new sparse direct solver package, cuDSS, and you can find a transition example in CUDALibrarySamples/cuSOLVERSp2cuDSS for reference. 1.3. cuSolverRF: Refactorization The cuSolverRF library was designed to accelerate solution of sets of linear systems by fast re-factorization when given new coefficients in the same sparsity pattern \\\[A\_{i}x\_{i} = f\_{i}\\\] where a sequence of coefficient matrices \\(A\_{i}\\in R^{nxn}\\), right-hand-sides \\(f\_{i}\\in R^{n}\\) and solutions \\(x\_{i}\\in R^{n}\\) are given for i=1,...,k. The cuSolverRF library is applicable when the sparsity pattern of the coefficient matrices \\(A\_{i}\\) as well as the reordering to minimize fill-in and the pivoting used during the LU factorization remain the same across these linear systems. In that case, the first linear system (i=1) requires a full LU factorization, while the subsequent linear systems (i=2,...,k) require only the LU re-factorization. The later can be performed using the cuSolverRF library. Notice that because the sparsity pattern of the coefficient matrices, the reordering and pivoting remain the same, the sparsity pattern of the resulting triangular factors \\(L\_{i}\\) and \\(U\_{i}\\) also remains the same. Therefore, the real difference between the full LU factorization and LU re-factorization is that the required memory is known ahead of time. Note cuSolverRf is deprecated and will be removed in a future major release. It is recommended migrating to a new sparse direct solver package, cuDSS, and you can find a transition example in CUDALibrarySamples/cuSOLVERSp2cuDSS for reference. 1.4. Naming Conventions The cuSolverDN library provides two different APIs; legacy and generic. The functions in the legacy API are available for data types float, double, cuComplex, and cuDoubleComplex. The naming convention for the legacy API is as follows: cusolverDn where can be S, D, C, Z, or X, corresponding to the data types float, double, cuComplex, cuDoubleComplex, and the generic type, respectively. can be Cholesky factorization (potrf), LU with partial pivoting (getrf), QR factorization (geqrf) and Bunch-Kaufman factorization (sytrf). The functions in the generic API provide a single entry point for each routine and support for 64-bit integers to define matrix and vector dimensions. The naming convention for the generic API is data-agnostic and is as follows: cusolverDn where can be Cholesky factorization (potrf), LU with partial pivoting (getrf) and QR factorization (geqrf). The cuSolverSP library functions are available for data types float, double, cuComplex, and cuDoubleComplex. The naming convention is as follows: cusolverSp\[Host\] \[\] \[

\] where cuSolverSp is the GPU path and cusolverSpHost is the corresponding CPU path. can be S, D, C, Z, or X, corresponding to the data types float, double, cuComplex, cuDoubleComplex, and the generic type, respectively. The is csr, compressed sparse row format. The can be ls, lsq, eig, eigs, corresponding to linear solver, least-square solver, eigenvalue solver and number of eigenvalues in a box, respectively. The

can be v or m, corresponding to a vector or a matrix. describes which algorithm is used. For example, qr (sparse QR factorization) is used in linear solver and least-square solver. All of the functions have the return type cusolverStatus\_t and are explained in more detail in the chapters that follow. cuSolverSP API Routine Data format Operation Output format Based on csrlsvlu csr linear solver (ls) vector (v) LU (lu) with partial pivoting csrlsvqr csr linear solver (ls) vector (v) QR factorization (qr) csrlsvchol csr linear solver (ls) vector (v) Cholesky factorization (chol) csrlsqvqr csr least-square solver (lsq) vector (v) QR factorization (qr) csreigvsi csr eigenvalue solver (eig) vector (v) shift-inverse csreigs csr number of eigenvalues in a box (eigs) csrsymrcm csr Symmetric Reverse Cuthill-McKee (symrcm) The cuSolverRF library routines are available for data type double. Most of the routines follow the naming convention: cusolverRf\_ \_\[\[Host\]\](…) where the trailing optional Host qualifier indicates the data is accessed on the host versus on the device, which is the default. The can be Setup, Analyze, Refactor, Solve, ResetValues, AccessBundledFactors and ExtractSplitFactors. Finally, the return type of the cuSolverRF library routines is cusolverStatus\_t. 1.5. Asynchronous Execution The cuSolver library functions prefer to keep asynchronous execution as much as possible. Developers can always use the cudaDeviceSynchronize() function to ensure that the execution of a particular cuSolver library routine has completed. A developer can also use the cudaMemcpy() routine to copy data from the device to the host and vice versa, using the cudaMemcpyDeviceToHost and cudaMemcpyHostToDevice parameters, respectively. In this case there is no need to add a call to cudaDeviceSynchronize() because the call to cudaMemcpy() with the above parameters is blocking and completes only when the results are ready on the host. 1.6. Library Property The libraryPropertyType data type is an enumeration of library property types (that is, CUDA version X.Y.Z would yield MAJOR\_VERSION=X, MINOR\_VERSION=Y, PATCH\_LEVEL=Z). typedef enum libraryPropertyType\_t { MAJOR\_VERSION, MINOR\_VERSION, PATCH\_LEVEL } libraryPropertyType; The following code can show the version of cusolver library. int major=-1,minor=-1,patch=-1; cusolverGetProperty(MAJOR\_VERSION, &major); cusolverGetProperty(MINOR\_VERSION, &minor); cusolverGetProperty(PATCH\_LEVEL, &patch); printf("CUSOLVER Version (Major,Minor,PatchLevel): %d.%d.%d\\n", major,minor,patch); 1.7. High Precision Package The cusolver library uses high precision for iterative refinement when necessary. 2. Using the CUSOLVER API 2.1. General Description This chapter describes how to use the cuSolver library API. It is not a reference for the cuSolver API data types and functions; that is provided in subsequent chapters. 2.1.1. Thread Safety The library is thread-safe, and its functions can be called from multiple host threads. 2.1.2. Scalar Parameters In the cuSolver API, the scalar parameters can be passed by reference on the host. 2.1.3. Parallelism with Streams If the application performs several small independent computations, or if it makes data transfers in parallel with the computation, then CUDA streams can be used to overlap these tasks. The application can conceptually associate a stream with each task. To achieve the overlap of computation between the tasks, the developer should: Create CUDA streams using the function cudaStreamCreate(), and Set the stream to be used by each individual cuSolver library routine by calling, for example, cusolverDnSetStream(), just prior to calling the actual cuSolverDN routine. The computations performed in separate streams would then be overlapped automatically on the GPU, when possible. This approach is especially useful when the computation performed by a single task is relatively small, and is not enough to fill the GPU with work, or when there is a data transfer that can be performed in parallel with the computation. 2.1.4. How to Link cusolver Library cusolver library provides dynamic library libcusolver.so and static library libcusolver\_static.a. If the user links the application with libcusolver.so, libcublas.so, libcublasLt.so and libcusparse.so are also required. If the user links the application with libcusolver\_static.a, the following libraries are also needed, libcudart\_static.a, libculibos.a, libcusolver\_lapack\_static.a, libcusolver\_metis\_static.a, libcublas\_static.a and libcusparse\_static.a. 2.1.5. Link Third-party LAPACK Library Starting with CUDA 10.1 update 2, NVIDIA LAPACK library libcusolver\_lapack\_static.a is a subset of LAPACK and only contains GPU accelerated stedc and bdsqr. The user has to link libcusolver\_static.a with libcusolver\_lapack\_static.a in order to build the application successfully. Prior to CUDA 10.1 update 2, the user can replace libcusolver\_lapack\_static.a with a third-party LAPACK library, for example, MKL. In CUDA 10.1 update 2, the third-party LAPACK library no longer affects the behavior of cusolver library, neither functionality nor performance. Furthermore the user cannot use libcusolver\_lapack\_static.a as a standalone LAPACK library because it is only a subset of LAPACK. If you use libcusolver\_static.a, then you must link with libcusolver\_lapack\_static.a explicitly, otherwise the linker will report missing symbols. There are no symbol conflicts between libcusolver\_lapack\_static.a and other third-party LAPACK libraries, which allows linking the same application to libcusolver\_lapack\_static.a and another third-party LAPACK library. The libcusolver\_lapack\_static.a is built inside libcusolver.so. Hence, if you use libcusolver.so, then you don’t need to specify a LAPACK library. The libcusolver.so will not pick up any routines from the third-party LAPACK library even if you link the application with it. 2.1.6. Convention of info Each LAPACK routine returns an info which indicates the position of invalid parameter. If info = -i, then i-th parameter is invalid. To be consistent with base-1 in LAPACK, cusolver does not report invalid handle into info. Instead, cusolver returns CUSOLVER\_STATUS\_NOT\_INITIALIZED for invalid handle. 2.1.7. Usage of \_bufferSize There is no cudaMalloc inside cuSolver library, the user must allocate the device workspace explicitly. The routine xyz\_bufferSize is to query the size of workspace of the routine xyz, for example xyz = potrf. To make the API simple, xyz\_bufferSize follows almost the same signature of xyz even it only depends on some parameters, for example, device pointer is not used to decide the size of workspace. In most cases, xyz\_bufferSize is called in the beginning before actual device data (pointed to by a device pointer) is prepared or before the device pointer is allocated. In such case, the user can pass null pointer to xyz\_bufferSize without breaking the functionality. 2.1.8. cuSOLVERDn Logging cuSOLVERDn logging mechanism can be enabled by setting the following environment variables before launching the target application: CUSOLVERDN\_LOG\_LEVEL= \- where is one of the following levels: 0 - Off - logging is disabled (default) 1 - Error - only errors will be logged 2 - Trace - API calls that launch CUDA kernels will log their parameters and important information 3 - Hints - hints that can potentially improve the application’s performance 4 - Info - provides general information about the library execution, may contain details about heuristic status 5 - API Trace - API calls will log their parameter and important information CUSOLVERDN\_LOG\_MASK= \- where mask is a combination of the following masks: 0 - Off 1 - Error 2 - Trace 4 - Hints 8 - Info 16 - API Trace CUSOLVERDN\_LOG\_FILE= \- where file name is a path to a log file. File name may contain %i, that will be replaced with the process ID, for example \_%i.log. If CUSOLVERDN\_LOG\_FILE is not defined, the log messages are printed to stdout. Another option is to use the experimental cusolverDn logging API. See: cusolverDnLoggerSetCallback(), cusolverDnLoggerSetFile(), cusolverDnLoggerOpenFile(), cusolverDnLoggerSetLevel(), cusolverDnLoggerSetMask(), cusolverDnLoggerForceDisable(). 2.1.9. Deterministic Results Throughout this documentation, a function is declared as deterministic if it computes the exact same bitwise results for every execution with the same input parameters, hard- and software environment. Conversely, a non-deterministic function might compute bitwise different results due to a varying order of floating point operations, e.g., a sum s of four values a, b, c, d can be computed in different orders: s = (a + b) + (c + d) s = (a + (b + c)) + d s = a + (b + (c + d)) … Due to the non-associativity of floating point arithmetic, all results might be bitwise different. By default, cuSolverDN computes deterministic results. For improved performance of some functions, it is possible to allow non-deterministic results with cusolverDnSetDeterministicMode(). 2.1.10. Floating Point Emulation cuSOLVERDn leverages techniques for floating point emulation as described in cuBLAS 1.5 Floating Point Emulation for improved performance. Please note that all cusolverDn{Get,Set}Emulation\* APIs only affect execution, if a math mode, which allows floating point emulated math, is enabled. However, the corresponding configuration options, which affect floating point emulated math, can be set, regardless of the current math mode. Example: cusolverDnSetMathMode(handle, CUSOLVER\_DEFAULT\_MATH); cusolverDnSetEmulationStrategy(handle, EMULATION\_STRATEGY\_EAGER); cusolverDnXgetrf(handle,...); // default math cusolverDnSetMathMode(handle, CUSOLVER\_FP32\_EMULATED\_BF16X9\_MATH); cusolverDnXgetrf(handle,...); // FP32 emulated math with eager emulation strategy Note Please note that cuBLAS environment variables, enabling floating point emulated math, won’t affect the cuSOLVERDn internal cuBLAS handles. Note Please note that the workspace sizes returned by \*\_bufferSize APIs may depend on the math mode and emulation strategy. 2.2. cuSolver Types Reference 2.2.1. cuSolverDN Types The float, double, cuComplex, and cuDoubleComplex data types are supported. The first two are standard C data types, while the last two are exported from cuComplex.h. In addition, cuSolverDN uses some familiar types from cuBLAS. 2.2.1.1. cusolverDnHandle\_t This is a pointer type to an opaque cuSolverDN context, which the user must initialize by calling cusolverDnCreate() prior to calling any other library function. An uninitialized Handle object will lead to unexpected behavior, including crashes of cuSolverDN. The handle created and returned by cusolverDnCreate() must be passed to every cuSolverDN function. 2.2.1.2. cublasFillMode\_t The type indicates which part (lower or upper) of the dense matrix was filled and consequently should be used by the function. Value Meaning CUBLAS\_FILL\_MODE\_LOWER The lower part of the matrix is filled. CUBLAS\_FILL\_MODE\_UPPER The upper part of the matrix is filled. CUBLAS\_FILL\_MODE\_FULL The full matrix is filled. Notice that BLAS implementations often use Fortran characters ‘L’ or ‘l’ (lower) and ‘U’ or ‘u’ (upper) to describe which part of the matrix is filled. 2.2.1.3. cublasOperation\_t The cublasOperation\_t type indicates which operation needs to be performed with the dense matrix. Value Meaning CUBLAS\_OP\_N The non-transpose operation is selected. CUBLAS\_OP\_T The transpose operation is selected. CUBLAS\_OP\_C The conjugate transpose operation is selected. Notice that BLAS implementations often use Fortran characters ‘N’ or ‘n’ (non-transpose), ‘T’ or ‘t’ (transpose) and ‘C’ or ‘c’ (conjugate transpose) to describe which operations need to be performed with the dense matrix. 2.2.1.4. cusolverEigType\_t The cusolverEigType\_t type indicates which type of eigenvalue the solver is. Value Meaning CUSOLVER\_EIG\_TYPE\_1 A\*x = lambda\*B\*x CUSOLVER\_EIG\_TYPE\_2 A\*B\*x = lambda\*x CUSOLVER\_EIG\_TYPE\_3 B\*A\*x = lambda\*x Notice that LAPACK implementations often use Fortran integer 1 (A\*x = lambda\*B\*x), 2 (A\*B\*x = lambda\*x), 3 (B\*A\*x = lambda\*x) to indicate which type of eigenvalue the solver is. 2.2.1.5. cusolverEigMode\_t The cusolverEigMode\_t type indicates whether or not eigenvectors are computed. Value Meaning CUSOLVER\_EIG\_MODE\_NOVECTOR Only eigenvalues are computed. CUSOLVER\_EIG\_MODE\_VECTOR Both eigenvalues and eigenvectors are computed. Notice that LAPACK implementations often use Fortran character 'N' (only eigenvalues are computed), 'V' (both eigenvalues and eigenvectors are computed) to indicate whether or not eigenvectors are computed. 2.2.1.6. cusolverIRSRefinement\_t The cusolverIRSRefinement\_t type indicates which solver type would be used for the specific cusolver function. Most of our experimentation shows that CUSOLVER\_IRS\_REFINE\_GMRES is the best option. More details about the refinement process can be found in Azzam Haidar, Stanimire Tomov, Jack Dongarra, and Nicholas J. Higham. 2018. Harnessing GPU tensor cores for fast FP16 arithmetic to speed up mixed-precision iterative refinement solvers. In Proceedings of the International Conference for High Performance Computing, Networking, Storage, and Analysis (SC ‘18). IEEE Press, Piscataway, NJ, USA, Article 47, 11 pages. CUSOLVER\_IRS\_REFINE\_NOT\_SET Solver is not set; this value is what is set when creating the params structure. IRS solver will return an error. CUSOLVER\_IRS\_REFINE\_NONE No refinement solver, the IRS solver performs a factorization followed by a solve without any refinement. For example if the IRS solver was cusolverDnIRSXgesv(), this is equivalent to a Xgesv routine without refinement and where the factorization is carried out in the lowest precision. If for example the main precision was CUSOLVER\_R\_64F and the lowest was CUSOLVER\_R\_64F as well, then this is equivalent to a call to cusolverDnDgesv(). CUSOLVER\_IRS\_REFINE\_CLASSICAL Classical iterative refinement solver. Similar to the one used in LAPACK routines. CUSOLVER\_IRS\_REFINE\_GMRES GMRES (Generalized Minimal Residual) based iterative refinement solver. In recent study, the GMRES method has drawn the scientific community attention for its ability to be used as refinement solver that outperforms the classical iterative refinement method. Based on our experimentation, we recommend this setting. CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES Classical iterative refinement solver that uses the GMRES (Generalized Minimal Residual) internally to solve the correction equation at each iteration. We call the classical refinement iteration the outer iteration while the GMRES is called inner iteration. Note that if the tolerance of the inner GMRES is set very low, lets say to machine precision, then the outer classical refinement iteration will performs only one iteration and thus this option will behave like CUSOLVER\_IRS\_REFINE\_GMRES. CUSOLVER\_IRS\_REFINE\_GMRES\_GMRES Similar to CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES which consists of classical refinement process that uses GMRES to solve the inner correction system; here it is a GMRES (Generalized Minimal Residual) based iterative refinement solver that uses another GMRES internally to solve the preconditioned system. 2.2.1.7. cusolverDnIRSParams\_t This is a pointer type to an opaque cusolverDnIRSParams\_t structure, which holds parameters for the iterative refinement linear solvers such as cusolverDnXgesv(). Use corresponding helper functions described below to either Create/Destroy this structure or Set/Get solver parameters. 2.2.1.8. cusolverDnIRSInfos\_t This is a pointer type to an opaque cusolverDnIRSInfos\_t structure, which holds information about the performed call to an iterative refinement linear solver (such as cusolverDnXgesv()). Use corresponding helper functions described below to either Create/Destroy this structure or retrieve solve information. 2.2.1.9. cusolverDnFunction\_t The cusolverDnFunction\_t type indicates which routine needs to be configured by cusolverDnSetAdvOptions(). The value CUSOLVERDN\_GETRF corresponds to the routine Getrf. Value Meaning CUSOLVERDN\_GETRF Corresponds to Getrf. 2.2.1.10. cusolverAlgMode\_t The cusolverAlgMode\_t type indicates which algorithm is selected by cusolverDnSetAdvOptions(). The set of algorithms supported for each routine is described in detail along with the routine’s documentation. The default algorithm is CUSOLVER\_ALG\_0. The user can also provide NULL to use the default algorithm. 2.2.1.11. cusolverStatus\_t This is the same as cusolverStatus\_t in the sparse LAPACK section. 2.2.1.12. cusolverDnLoggerCallback\_t cusolverDnLoggerCallback\_t is a callback function pointer type. Parameters Parameter Memory In/out Description logLevel output See cuSOLVERDn Logging functionName output The name of the API that logged this message. message output The log message. Use the below function to set the callback function: cusolverDnLoggerSetCallback(). 2.2.1.13. cusolverDeterministicMode\_t The cusolverDeterministicMode\_t type indicates whether multiple cuSolver function executions with the same input have the same bitwise equal result (deterministic) or might have bitwise different results (non-deterministic). In comparison to cublasAtomicsMode\_t, which only includes the usage of atomic functions, cusolverDeterministicMode\_t includes all non-deterministic programming patterns. The deterministic mode can be set and queried using cusolverDnSetDeterministicMode() and cusolverDnGetDeterministicMode() routines, respectively. Value Meaning CUSOLVER\_DETERMINISTIC\_RESULTS Compute deterministic results. CUSOLVER\_ALLOW\_NON\_DETERMINISTIC\_RESULTS Allow non-deterministic results. 2.2.1.14. cusolverMathMode\_t The cusolverMathMode\_t type is used in cusolverDnSetMathMode() to choose compute precision modes as defined in the following table: Value Meaning CUSOLVER\_DEFAULT\_MATH This is the default math mode. Tensor Cores will be used whenever possible. CUSOLVER\_FP32\_EMULATED\_BF16X9\_MATH Use FP32 emulation according to the configured emulation strategy (see cusolverDnSetEmulationStrategy()). 2.2.1.15. cusolverStorevMode\_t Specifies how the vectors which define the elementary reflectors are stored. Value Meaning CUBLAS\_STOREV\_COLUMNWISE Columnwise. CUBLAS\_STOREV\_ROWWISE Rowwise. 2.2.1.16. cusolverDirectMode\_t Specifies the order in which the elementary reflectors are multiplied to form the block reflector. Value Meaning CUBLAS\_DIRECT\_FORWARD Forward. CUBLAS\_DIRECT\_BACKWARD Backward. 2.2.2. cuSolverSP Types The float, double, cuComplex, and cuDoubleComplex data types are supported. The first two are standard C data types, while the last two are exported from cuComplex.h. 2.2.2.1. cusolverSpHandle\_t This is a pointer type to an opaque cuSolverSP context, which the user must initialize by calling cusolverSpCreate() prior to calling any other library function. An uninitialized Handle object will lead to unexpected behavior, including crashes of cuSolverSP. The handle created and returned by cusolverSpCreate() must be passed to every cuSolverSP function. 2.2.2.2. cusparseMatDescr\_t We have chosen to keep the same structure as exists in cuSPARSE to describe the shape and properties of a matrix. This enables calls to either cuSPARSE or cuSOLVER using the same matrix description. typedef struct { cusparseMatrixType\_t MatrixType; cusparseFillMode\_t FillMode; cusparseDiagType\_t DiagType; cusparseIndexBase\_t IndexBase; } cusparseMatDescr\_t; Please read documentation of the cuSPARSE Library to understand each field of cusparseMatDescr\_t. 2.2.2.3. cusolverStatus\_t This is a status type returned by the library functions and it can have the following values. CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The cuSolver library was not initialized. This is usually caused by the lack of a prior call, an error in the CUDA Runtime API called by the cuSolver routine, or an error in the hardware setup. To correct: call cusolverDnCreate() prior to the function call; and check that the hardware, an appropriate version of the driver, and the cuSolver library are correctly installed. CUSOLVER\_STATUS\_ALLOC\_FAILED Resource allocation failed inside the cuSolver library. This is usually caused by a cudaMalloc() failure. To correct: prior to the function call, deallocate previously allocated memory as much as possible. CUSOLVER\_STATUS\_INVALID\_VALUE An unsupported value or parameter was passed to the function (a negative vector size, for example). To correct: ensure that all the parameters being passed have valid values. CUSOLVER\_STATUS\_ARCH\_MISMATCH The function requires a feature absent from the device architecture; usually caused by the lack of support for atomic operations or double precision. To correct: compile and run the application on a device with compute capability 5.0 or above. CUSOLVER\_STATUS\_EXECUTION\_FAILED The GPU program failed to execute. This is often caused by a launch failure of the kernel on the GPU, which can be caused by multiple reasons. To correct: check that the hardware, an appropriate version of the driver, and the cuSolver library are correctly installed. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal cuSolver operation failed. This error is usually caused by a cudaMemcpyAsync() failure. To correct: check that the hardware, an appropriate version of the driver, and the cuSolver library are correctly installed. Also, check that the memory passed as a parameter to the routine is not being deallocated prior to the routine’s completion. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported by this function. This is usually caused by passing an invalid matrix descriptor to the function. To correct: check that the fields in descrA were set correctly. CUSOLVER\_STATUS\_NOT\_SUPPORTED The parameter combination is not supported, for example batched version is not supported or M < N is not supported. To correct: consult the documentation, and use a supported configuration. 2.2.3. cuSolverRF Types cuSolverRF only supports double. 2.2.3.1. cusolverRfHandle\_t The cusolverRfHandle\_t is a pointer to an opaque data structure that contains the cuSolverRF library handle. The user must initialize the handle by calling cusolverRfCreate() prior to any other cuSolverRF library calls. The handle is passed to all other cuSolverRF library calls. 2.2.3.2. cusolverRfMatrixFormat\_t The cusolverRfMatrixFormat\_t is an enum that indicates the input/output matrix format assumed by the cusolverRfSetupDevice(), cusolverRfSetupHost(), cusolverRfResetValues(), cusolveRfExtractBundledFactorsHost() and cusolverRfExtractSplitFactorsHost() routines. Value Meaning CUSOLVER\_MATRIX\_FORMAT\_CSR Matrix format CSR is assumed. (default) CUSOLVER\_MATRIX\_FORMAT\_CSC Matrix format CSC is assumed. 2.2.3.3. cusolverRfNumericBoostReport\_t The cusolverRfNumericBoostReport\_t is an enum that indicates whether numeric boosting (of the pivot) was used during the cusolverRfRefactor() and cusolverRfSolve() routines. The numeric boosting is disabled by default. Value Meaning CUSOLVER\_NUMERIC\_BOOST\_NOT\_USED Numeric boosting not used. (default) CUSOLVER\_NUMERIC\_BOOST\_USED Numeric boosting used. 2.2.3.4. cusolverRfResetValuesFastMode\_t The cusolverRfResetValuesFastMode\_t is an enum that indicates the mode used for the cusolverRfResetValues() routine. The fast mode requires extra memory and is recommended only if very fast calls to cusolverRfResetValues() are needed. Value Meaning CUSOLVER\_RESET\_VALUES\_FAST\_MODE\_OFF Fast mode disabled. (default) CUSOLVER\_RESET\_VALUES\_FAST\_MODE\_ON Fast mode enabled. 2.2.3.5. cusolverRfFactorization\_t The cusolverRfFactorization\_t is an enum that indicates which (internal) algorithm is used for refactorization in the cusolverRfRefactor() routine. Value Meaning CUSOLVER\_FACTORIZATION\_ALG0 Algorithm 0. (default) CUSOLVER\_FACTORIZATION\_ALG1 Algorithm 1. CUSOLVER\_FACTORIZATION\_ALG2 Algorithm 2. Domino-based scheme. 2.2.3.6. cusolverRfTriangularSolve\_t The cusolverRfTriangularSolve\_t is an enum that indicates which (internal) algorithm is used for triangular solve in the cusolverRfSolve() routine. Value Meaning CUSOLVER\_TRIANGULAR\_SOLVE\_ALG1 Algorithm 1. (default) CUSOLVER\_TRIANGULAR\_SOLVE\_ALG2 Algorithm 2. Domino-based scheme. CUSOLVER\_TRIANGULAR\_SOLVE\_ALG3 Algorithm 3. Domino-based scheme. 2.2.3.7. cusolverRfUnitDiagonal\_t The cusolverRfUnitDiagonal\_t is an enum that indicates whether and where the unit diagonal is stored in the input/output triangular factors in the cusolverRfSetupDevice(), cusolverRfSetupHost() and cusolverRfExtractSplitFactorsHost() routines. Value Meaning CUSOLVER\_UNIT\_DIAGONAL\_STORED\_L Unit diagonal is stored in lower triangular factor (default). CUSOLVER\_UNIT\_DIAGONAL\_STORED\_U Unit diagonal is stored in upper triangular factor. CUSOLVER\_UNIT\_DIAGONAL\_ASSUMED\_L Unit diagonal is assumed in lower triangular factor. CUSOLVER\_UNIT\_DIAGONAL\_ASSUMED\_U Unit diagonal is assumed in upper triangular factor. 2.2.3.8. cusolverStatus\_t The cusolverStatus\_t is an enum that indicates success or failure of the cuSolverRF library call. It is returned by all the cuSolver library routines, and it uses the same enumerated values as the sparse and dense Lapack routines. 2.3. cuSolver Formats Reference 2.3.1. Index Base Format Both one-based and zero-based indexing are supported in cuSolver. 2.3.2. Vector (Dense) Format The vectors are assumed to be stored linearly in memory. For example, the vector \\\[\\begin{split}x = \\begin{pmatrix} x\_1 \\\\ x\_2 \\\\ \\vdots \\\\ x\_n \\end{pmatrix}\\end{split}\\\] is represented as \\\[\\begin{split}\\begin{pmatrix} x\_1 & x\_2 & \\ldots & x\_n \\\\ \\end{pmatrix}\\end{split}\\\] 2.3.3. Matrix (Dense) Format The dense matrices are assumed to be stored in column-major order in memory. The sub-matrix can be accessed using the leading dimension of the original matrix. For example, the m\*n (sub-)matrix \\\[\\begin{split}\\begin{pmatrix} a\_{1,1} & \\cdots & a\_{1,n} \\\\ a\_{2,1} & \\cdots & a\_{2,n} \\\\ \\vdots \\\\ a\_{m,1} & \\cdots & a\_{m,n} \\\\ \\end{pmatrix}\\end{split}\\\] is represented as \\\[\\begin{split}\\begin{pmatrix} a\_{1,1} & \\ldots & a\_{1,n} \\\\ a\_{2,1} & \\ldots & a\_{2,n} \\\\ \\vdots & \\ddots & \\vdots \\\\ a\_{m,1} & \\ldots & a\_{m,n} \\\\ \\vdots & \\ddots & \\vdots \\\\ a\_{{lda},1} & \\ldots & a\_{{lda},n} \\\\ \\end{pmatrix}\\end{split}\\\] with its elements arranged linearly in memory as \\\[\\begin{split}\\begin{pmatrix} a\_{1,1} \\quad a\_{2,1} \\quad \\ldots \\quad a\_{m,1} \\quad \\ldots \\quad a\_{lda,1} \\quad \\ldots \\quad a\_{1,n} \\quad a\_{2,n} \\quad \\ldots \\quad a\_{m,n} \\quad \\ldots \\quad a\_{lda,n} \\\\ \\end{pmatrix}\\end{split}\\\] where lda \\(\\geq\\) m is the leading dimension of A. 2.3.4. Matrix (CSR) Format In CSR format the matrix is represented by the following parameters: Parameter Type Size Meaning n (int) The number of rows (and columns) in the matrix. nnz (int) The number of non-zero elements in the matrix. csrRowPtr (int \*) n+1 The array of offsets corresponding to the start of each row in the arrays csrColInd and csrVal. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix. csrColInd (int \*) nnz The array of column indices corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. csrVal (S|D|C|Z)\* nnz The array of values corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. Note that in our CSR format, sparse matrices are assumed to be stored in row-major order, in other words, the index arrays are first sorted by row indices and then within each row by column indices. Also it is assumed that each pair of row and column indices appears only once. For example, the 4x4 matrix \\\[\\begin{split}A = \\begin{pmatrix} {1.0} & {3.0} & {0.0} & {0.0} \\\\ {0.0} & {4.0} & {6.0} & {0.0} \\\\ {2.0} & {5.0} & {7.0} & {8.0} \\\\ {0.0} & {0.0} & {0.0} & {9.0} \\\\ \\end{pmatrix}\\end{split}\\\] is represented as \\\[\\begin{split}{csrRowPtr} = \\begin{pmatrix} 0 & 2 & 4 & 8 & 9 \\\\ \\end{pmatrix}\\end{split}\\\] \\\[\\begin{split}{csrColInd} = \\begin{pmatrix} 0 & 1 & 1 & 2 & 0 & 1 & 2 & 3 & 3 \\\\ \\end{pmatrix}\\end{split}\\\] \\\[\\begin{split}{csrVal} = \\begin{pmatrix} 1.0 & 3.0 & 4.0 & 6.0 & 2.0 & 5.0 & 7.0 & 8.0 & 9.0 \\\\ \\end{pmatrix}\\end{split}\\\] 2.3.5. Matrix (CSC) Format In CSC format the matrix is represented by the following parameters: Parameter Type Size Meaning n (int) The number of rows (and columns) in the matrix. nnz (int) The number of non-zero elements in the matrix. cscColPtr (int \*) n+1 The array of offsets corresponding to the start of each column in the arrays cscRowInd and cscVal. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix. cscRowInd (int \*) nnz The array of row indices corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by column and by row within each column. cscVal (S|D|C|Z)\* nnz The array of values corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by column and by row within each column. Note that in our CSC format, sparse matrices are assumed to be stored in column-major order, in other words, the index arrays are first sorted by column indices and then within each column by row indices. Also it is assumed that each pair of row and column indices appears only once. For example, the 4x4 matrix \\\[\\begin{split}A = \\begin{pmatrix} {1.0} & {3.0} & {0.0} & {0.0} \\\\ {0.0} & {4.0} & {6.0} & {0.0} \\\\ {2.0} & {5.0} & {7.0} & {8.0} \\\\ {0.0} & {0.0} & {0.0} & {9.0} \\\\ \\end{pmatrix}\\end{split}\\\] is represented as \\\[\\begin{split}{cscColPtr} = \\begin{pmatrix} 0 & 2 & 5 & 7 & 9 \\\\ \\end{pmatrix}\\end{split}\\\] \\\[\\begin{split}{cscRowInd} = \\begin{pmatrix} 0 & 2 & 0 & 1 & 2 & 1 & 2 & 2 & 3 \\\\ \\end{pmatrix}\\end{split}\\\] \\\[\\begin{split}{cscVal} = \\begin{pmatrix} 1.0 & 2.0 & 3.0 & 4.0 & 5.0 & 6.0 & 7.0 & 8.0 & 9.0 \\\\ \\end{pmatrix}\\end{split}\\\] 2.4. cuSolverDN: dense LAPACK Function Reference This section describes the API of cuSolverDN, which provides a subset of dense LAPACK functions. 2.4.1. cuSolverDN Helper Function Reference The cuSolverDN helper functions are described in this section. 2.4.1.1. cusolverDnCreate() cusolverStatus\_t cusolverDnCreate(cusolverDnHandle\_t \*handle); This function initializes the cuSolverDN library and creates a handle on the cuSolverDN context. It must be called before any other cuSolverDN API function is invoked. It allocates hardware resources necessary for accessing the GPU. This function allocates 4 MiB or 32 MiB of memory (for GPUs with Compute Capability of 9.0 and higher), which will be used as the cuBLAS workspace for the first user-defined stream on which cusolverDnSetStream() is called. For the default stream and in all the other cases, cuBLAS will manage its own workspace. Parameter Memory In/out Meaning handle host output The pointer to the handle to the cuSolverDN context. Status Returned CUSOLVER\_STATUS\_SUCCESS The initialization succeeded. CUSOLVER\_STATUS\_NOT\_INITIALIZED The CUDA Runtime initialization failed. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. 2.4.1.2. cusolverDnDestroy() cusolverStatus\_t cusolverDnDestroy(cusolverDnHandle\_t handle); This function releases CPU-side resources used by the cuSolverDN library. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. Status Returned CUSOLVER\_STATUS\_SUCCESS The shutdown succeeded. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.4.1.3. cusolverDnSetStream() cusolverStatus\_t cusolverDnSetStream(cusolverDnHandle\_t handle, cudaStream\_t streamId) This function sets the stream to be used by the cuSolverDN library to execute its routines. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. streamId host input The stream to be used by the library. Status Returned CUSOLVER\_STATUS\_SUCCESS The stream was set successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.4.1.4. cusolverDnGetStream() cusolverStatus\_t cusolverDnGetStream(cusolverDnHandle\_t handle, cudaStream\_t \*streamId) This function queries the stream to be used by the cuSolverDN library to execute its routines. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. streamId host output The stream which is used by handle. Status Returned CUSOLVER\_STATUS\_SUCCESS The stream was set successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.4.1.5. cusolverDnLoggerSetCallback() cusolverStatus\_t cusolverDnLoggerSetCallback(cusolverDnLoggerCallback\_t callback); This function sets the logging callback function. Parameters Parameter Memory In/out Meaning callback input Pointer to a callback function. See cusolverDnLoggerCallback\_t. Status Returned CUSOLVER\_STATUS\_SUCCESS If the callback function was successfully set. See cusolverStatus\_t for a complete list of valid return codes. 2.4.1.6. cusolverDnLoggerSetFile() cusolverStatus\_t cusolverDnLoggerSetFile(FILE\* file); This function sets the logging output file. Note: once registered using this function call, the provided file handle must not be closed unless the function is called again to switch to a different file handle. Parameters Parameter Memory In/out Meaning file input Pointer to an open file. File should have write permission. Status Returned CUSOLVER\_STATUS\_SUCCESS If logging file was successfully set. See cusolverStatus\_t for a complete list of valid return codes. 2.4.1.7. cusolverDnLoggerOpenFile() cusolverStatus\_t cusolverDnLoggerOpenFile(const char\* logFile); This function opens a logging output file in the given path. Parameters Parameter Memory In/out Meaning logFile input Path of the logging output file. Status Returned CUSOLVER\_STATUS\_SUCCESS If the logging file was successfully opened. See cusolverStatus\_t for a complete list of valid return codes. 2.4.1.8. cusolverDnLoggerSetLevel() cusolverStatus\_t cusolverDnLoggerSetLevel(int level); This function sets the value of the logging level. Parameters Parameter Memory In/out Meaning level input Value of the logging level. See cuSOLVERDn Logging. Status Returned CUSOLVER\_STATUS\_INVALID\_VALUE If the value was not a valid logging level. See cuSOLVERDn Logging. CUSOLVER\_STATUS\_SUCCESS If the logging level was successfully set. See cusolverStatus\_t for a complete list of valid return codes. 2.4.1.9. cusolverDnLoggerSetMask() cusolverStatus\_t cusolverDnLoggerSetMask(int mask); This function sets the value of the logging mask. Parameters Parameter Memory In/out Meaning mask input Value of the logging mask. See cuSOLVERDn Logging. Status Returned CUSOLVER\_STATUS\_SUCCESS If the logging mask was successfully set. See cusolverStatus\_t for a complete list of valid return codes. 2.4.1.10. cusolverDnLoggerForceDisable() cusolverStatus\_t cusolverDnLoggerForceDisable(); This function disables logging for the entire run. Status Returned CUSOLVER\_STATUS\_SUCCESS If logging was successfully disabled. See cusolverStatus\_t for a complete list of valid return codes. 2.4.1.11. cusolverDnSetDeterministicMode() cusolverStatus\_t cusolverDnSetDeterministicMode(cusolverDnHandle\_t handle, cusolverDeterministicMode\_t mode) This function sets the deterministic mode of all cuSolverDN functions for handle. For improved performance, non-deterministic results can be allowed. Affected functions are cusolverDn geqrf(), cusolverDn syevd(), cusolverDn syevdx(), cusolverDn gesvd() (if m > n), cusolverDn gesvdj(), cusolverDnXgeqrf(), cusolverDnXsyevd(), cusolverDnXsyevdx(), cusolverDnXgesvd() (if m > n), cusolverDnXgesvdr() and cusolverDnXgesvdp(). Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. mode host input The deterministic mode to be used with handle. Status Returned CUSOLVER\_STATUS\_SUCCESS The mode was set successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal error occurred. 2.4.1.12. cusolverDnGetDeterministicMode() cusolverStatus\_t cusolverDnGetDeterministicMode(cusolverDnHandle\_t handle, cusolverDeterministicMode\_t\* mode) This function queries the deterministic mode which is set for handle. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. mode host output The deterministic mode of handle. Status Returned CUSOLVER\_STATUS\_SUCCESS The mode was set successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE mode is a NULL pointer. 2.4.1.13. cusolverDnSetMathMode() cusolverStatus\_t cusolverDnSetMathMode(cusolverDnHandle\_t handle, cusolverMathMode\_t mode); This function sets the math mode of all cuSolverDN functions for handle. For more information about the effects of the corresponding math mode, please refer to cusolverMathMode\_t. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. mode host input The math mode to be used with handle. Status Returned CUSOLVER\_STATUS\_SUCCESS The mode was set successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE An invalid mode was given. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal error occurred. Note Please note that the workspace sizes returned by \*\_bufferSize APIs may depend on the math mode. 2.4.1.14. cusolverDnGetMathMode() cusolverStatus\_t cusolverDnGetMathMode(cusolverDnHandle\_t handle, cusolverMathMode\_t\* mode); This function queries the math mode which is set for handle. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. mode host output The math mode of handle. Status Returned CUSOLVER\_STATUS\_SUCCESS The mode was set successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE mode is a NULL pointer. 2.4.1.15. cusolverDnSetEmulationStrategy() cusolverStatus\_t cusolverDnSetEmulationStrategy( cusolverHandle\_t handle, cudaEmulationStrategy\_t strategy); This function sets the emulation strategy of all cuSolverDN functions for handle. For more information about the effects of the corresponding strategies, please refer to the analogous definition of cublasEmulationStrategy\_t. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. strategy host input The emulation strategy to be used with handle. The emulation strategy set by this API only has an effect, once the following math mode is enabled (see also cusolverMathMode\_t): CUSOLVER\_FP32\_EMULATED\_BF16X9\_MATH Status Returned CUSOLVER\_STATUS\_SUCCESS The strategy was set successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE strategy was not a supported emulation strategy CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal error occurred. Note Please note that the workspace sizes returned by \*\_bufferSize APIs may depend on the emulation strategy. 2.4.1.16. cusolverDnGetEmulationStrategy() cusolverStatus\_t cusolverDnGetEmulationStrategy(cusolverHandle\_t handle, cudaEmulationStrategy\_t\* emulationStrategy); This function queries the emulation strategy which is set for handle. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. strategy host output The emulation strategy of handle. The emulation strategy returned by this API only has an effect, once the following math mode is enabled (see also cusolverMathMode\_t): CUSOLVER\_FP32\_EMULATED\_BF16X9\_MATH Status Returned CUSOLVER\_STATUS\_SUCCESS The strategy was queried successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE emulationStrategy is a NULL pointer. 2.4.1.17. cusolverDnCreateSyevjInfo() cusolverStatus\_t cusolverDnCreateSyevjInfo( syevjInfo\_t \*info); This function creates and initializes the structure of syevj, syevjBatched and sygvj to default values. Parameter Memory In/out Meaning info host output The pointer to the structure of syevj. Status Returned CUSOLVER\_STATUS\_SUCCESS The structure was initialized successfully. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. 2.4.1.18. cusolverDnDestroySyevjInfo() cusolverStatus\_t cusolverDnDestroySyevjInfo( syevjInfo\_t info); This function destroys and releases any memory required by the structure. Parameter Memory In/out Meaning info host input The structure of syevj. Status Returned CUSOLVER\_STATUS\_SUCCESS The resources were released successfully. 2.4.1.19. cusolverDnXsyevjSetTolerance() cusolverStatus\_t cusolverDnXsyevjSetTolerance( syevjInfo\_t info, double tolerance) This function configures tolerance of syevj. Parameter Memory In/out Meaning info host in/out The pointer to the structure of syevj. tolerance host input Accuracy of numerical eigenvalues. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. 2.4.1.20. cusolverDnXsyevjSetMaxSweeps() cusolverStatus\_t cusolverDnXsyevjSetMaxSweeps( syevjInfo\_t info, int max\_sweeps) This function configures maximum number of sweeps in syevj. The default value is 100. Parameter Memory In/out Meaning info host in/out The pointer to the structure of syevj. max\_sweeps host input Maximum number of sweeps. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. 2.4.1.21. cusolverDnXsyevjSetSortEig() cusolverStatus\_t cusolverDnXsyevjSetSortEig( syevjInfo\_t info, int sort\_eig) If sort\_eig is zero, the eigenvalues are not sorted. This function only works for syevjBatched. syevj and sygvj always sort eigenvalues in ascending order. By default, eigenvalues are always sorted in ascending order. Parameter Memory In/out Meaning info host in/out The pointer to the structure of syevj. sort\_eig host input If sort\_eig is zero, the eigenvalues are not sorted. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. 2.4.1.22. cusolverDnXsyevjGetResidual() cusolverStatus\_t cusolverDnXsyevjGetResidual( cusolverDnHandle\_t handle, syevjInfo\_t info, double \*residual) This function reports residual of syevj or sygvj. It does not support syevjBatched. If the user calls this function after syevjBatched, the error CUSOLVER\_STATUS\_NOT\_SUPPORTED is returned. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. info host input The pointer to the structure of syevj. residual host output Residual of syevj. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_SUPPORTED Does not support batched version. 2.4.1.23. cusolverDnXsyevjGetSweeps() cusolverStatus\_t cusolverDnXsyevjGetSweeps( cusolverDnHandle\_t handle, syevjInfo\_t info, int \*executed\_sweeps) This function reports number of executed sweeps of syevj or sygvj. It does not support syevjBatched. If the user calls this function after syevjBatched, the error CUSOLVER\_STATUS\_NOT\_SUPPORTED is returned. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. info host input The pointer to the structure of syevj. executed\_sweeps host output Number of executed sweeps. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_SUPPORTED Does not support batched version. 2.4.1.24. cusolverDnCreateGesvdjInfo() cusolverStatus\_t cusolverDnCreateGesvdjInfo( gesvdjInfo\_t \*info); This function creates and initializes the structure of gesvdj and gesvdjBatched to default values. Parameter Memory In/out Meaning info host output The pointer to the structure of gesvdj. Status Returned CUSOLVER\_STATUS\_SUCCESS The structure was initialized successfully. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. 2.4.1.25. cusolverDnDestroyGesvdjInfo() cusolverStatus\_t cusolverDnDestroyGesvdjInfo( gesvdjInfo\_t info); This function destroys and releases any memory required by the structure. Parameter Memory In/out Meaning info host input The structure of gesvdj. Status Returned CUSOLVER\_STATUS\_SUCCESS The resources were released successfully. 2.4.1.26. cusolverDnXgesvdjSetTolerance() cusolverStatus\_t cusolverDnXgesvdjSetTolerance( gesvdjInfo\_t info, double tolerance) This function configures tolerance of gesvdj. Parameter Memory In/out Meaning info host in/out The pointer to the structure of gesvdj. tolerance host input Accuracy of numerical singular values. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. 2.4.1.27. cusolverDnXgesvdjSetMaxSweeps() cusolverStatus\_t cusolverDnXgesvdjSetMaxSweeps( gesvdjInfo\_t info, int max\_sweeps) This function configures the maximum number of sweeps in gesvdj. The default value is 100. Parameter Memory In/out Meaning info host in/out The pointer to the structure of gesvdj. max\_sweeps host input Maximum number of sweeps. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. 2.4.1.28. cusolverDnXgesvdjSetSortEig() cusolverStatus\_t cusolverDnXgesvdjSetSortEig( gesvdjInfo\_t info, int sort\_svd) If sort\_svd is zero, the singular values are not sorted. This function only works for gesvdjBatched. gesvdj always sorts singular values in descending order. By default, singular values are always sorted in descending order. Parameter Memory In/out Meaning info host in/out The pointer to the structure of gesvdj. sort\_svd host input If sort\_svd is zero, the singular values are not sorted. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. 2.4.1.29. cusolverDnXgesvdjGetResidual() cusolverStatus\_t cusolverDnXgesvdjGetResidual( cusolverDnHandle\_t handle, gesvdjInfo\_t info, double \*residual) This function reports the Frobenius norm of the internal residual returned by gesvdj. Note that this is not the Frobenious norm of the exact residual calculated as \\\[{\\|{S} - {U}^{H}\*{A}\*{V}\\|}\_{F}\\\] This function does not support gesvdjBatched. If the user calls this function after gesvdjBatched, the error CUSOLVER\_STATUS\_NOT\_SUPPORTED is returned. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. info host input The pointer to the structure of gesvdj. residual host output Residual of gesvdj. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_SUPPORTED Does not support batched version 2.4.1.30. cusolverDnXgesvdjGetSweeps() cusolverStatus\_t cusolverDnXgesvdjGetSweeps( cusolverDnHandle\_t handle, gesvdjInfo\_t info, int \*executed\_sweeps) This function reports number of executed sweeps of gesvdj. It does not support gesvdjBatched. If the user calls this function after gesvdjBatched, the error CUSOLVER\_STATUS\_NOT\_SUPPORTED is returned. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. info host input The pointer to the structure of gesvdj. executed\_sweeps host output Number of executed sweeps. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_SUPPORTED Does not support batched version 2.4.1.31. cusolverDnIRSParamsCreate() cusolverStatus\_t cusolverDnIRSParamsCreate(cusolverDnIRSParams\_t \*params); This function creates and initializes the structure of parameters for an IRS solver such as the cusolverDnIRSXgesv() or the cusolverDnIRSXgels() functions to default values. The params structure created by this function can be used by one or more call to the same or to a different IRS solver. Note that in CUDA 10.2, the behavior was different and a new params structure was needed to be created per each call to an IRS solver. Also note that the user can also change configurations of the params and then call a new IRS instance, but be careful that the previous call was done because any change to the configuration before the previous call was done could affect it. Parameter Memory In/out Meaning params host output Pointer to the cusolverDnIRSParams\_t Params structure Status Returned CUSOLVER\_STATUS\_SUCCESS The structure was created and initialized successfully. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. 2.4.1.32. cusolverDnIRSParamsDestroy() cusolverStatus\_t cusolverDnIRSParamsDestroy(cusolverDnIRSParams\_t params); This function destroys and releases any memory required by the Params structure. Parameter Memory In/out Meaning params host input The cusolverDnIRSParams\_t Params structure. Status Returned CUSOLVER\_STATUS\_SUCCESS The resources were released successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. CUSOLVER\_STATUS\_IRS\_INFOS\_NOT\_DESTROYED Not all the Infos structure associated with this Params structure have been destroyed yet. 2.4.1.33. cusolverDnIRSParamsSetSolverPrecisions() cusolverStatus\_t cusolverDnIRSParamsSetSolverPrecisions( cusolverDnIRSParams\_t params, cusolverPrecType\_t solver\_main\_precision, cusolverPrecType\_t solver\_lowest\_precision ); This function sets both the main and the lowest precision for the Iterative Refinement Solver (IRS). By main precision, we mean the precision of the Input and Output datatype. By lowest precision, we mean the solver is allowed to use as lowest computational precision during the LU factorization process. Note that the user has to set both the main and lowest precision before the first call to the IRS solver because they are NOT set by default with the params structure creation, as it depends on the Input Output data type and user request. It is a wrapper to both cusolverDnIRSParamsSetSolverMainPrecision() and cusolverDnIRSParamsSetSolverLowestPrecision(). All possible combinations of main/lowest precision are described in the table below. Usually the lowest precision defines the speedup that can be achieved. The ratio of the performance of the lowest precision over the main precision (e.g., Inputs/Outputs datatype) define the upper bound of the speedup that could be obtained. More precisely, it depends on many factors, but for large matrices sizes, it is the ratio of the matrix-matrix rank-k product (e.g., GEMM where K is 256 and M=N=size of the matrix) that define the possible speedup. For instance, if the inout precision is real double precision CUSOLVER\_R\_64F and the lowest precision is CUSOLVER\_R\_32F, then we can expect a speedup of at most 2X for large problem sizes. If the lowest precision was CUSOLVER\_R\_16F, then we can expect 3X-4X. A reasonable strategy should take the number of right-hand sides, the size of the matrix as well as the convergence rate into account. Parameter Memory In/out Meaning params host in/out The cusolverDnIRSParams\_t Params structure. solver\_main\_precision host input Allowed Inputs/Outputs datatype (for example CUSOLVER\_R\_FP64 for a real double precision data). See the table below for the supported precisions. solver\_lowest\_precision host input Allowed lowest compute type (for example CUSOLVER\_R\_16F for half precision computation). See the table below for the supported precisions. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. Supported Inputs/Outputs data type and lower precision for the IRS solver Inputs/Outputs Data Type (e.g., main precision) Supported values for the lowest precision CUSOLVER\_C\_64F CUSOLVER\_C\_64F, CUSOLVER\_C\_32F, CUSOLVER\_C\_16F, CUSOLVER\_C\_16BF, CUSOLVER\_C\_TF32 CUSOLVER\_C\_32F CUSOLVER\_C\_32F, CUSOLVER\_C\_16F, CUSOLVER\_C\_16BF, CUSOLVER\_C\_TF32 CUSOLVER\_R\_64F CUSOLVER\_R\_64F, CUSOLVER\_R\_32F, CUSOLVER\_R\_16F, CUSOLVER\_R\_16BF, CUSOLVER\_R\_TF32 CUSOLVER\_R\_32F CUSOLVER\_R\_32F, CUSOLVER\_R\_16F, CUSOLVER\_R\_16BF, CUSOLVER\_R\_TF32 2.4.1.34. cusolverDnIRSParamsSetSolverMainPrecision() cusolverStatus\_t cusolverDnIRSParamsSetSolverMainPrecision( cusolverDnIRSParams\_t params, cusolverPrecType\_t solver\_main\_precision); This function sets the main precision for the Iterative Refinement Solver (IRS). By main precision, we mean, the type of the Input and Output data. Note that the user has to set both the main and lowest precision before a first call to the IRS solver because they are NOT set by default with the params structure creation, as it depends on the Input Output data type and user request. user can set it by either calling this function or by calling cusolverDnIRSParamsSetSolverPrecisions() which set both the main and the lowest precision together. All possible combinations of main/lowest precision are described in the table in the cusolverDnIRSParamsSetSolverPrecisions() section above. Parameter Memory In/out Meaning params host in/out The cusolverDnIRSParams\_t Params structure. solver\_main\_precision host input Allowed Inputs/Outputs datatype (for example CUSOLVER\_R\_FP64 for a real double precision data). See the table in the cusolverDnIRSParamsSetSolverPrecisions() section above for the supported precisions. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. 2.4.1.35. cusolverDnIRSParamsSetSolverLowestPrecision() cusolverStatus\_t cusolverDnIRSParamsSetSolverLowestPrecision( cusolverDnIRSParams\_t params, cusolverPrecType\_t lowest\_precision\_type); This function sets the lowest precision that will be used by Iterative Refinement Solver. By lowest precision, we mean the solver is allowed to use as lowest computational precision during the LU factorization process. Note that the user has to set both the main and lowest precision before a first call to the IRS solver because they are NOT set by default with the params structure creation, as it depends on the Input Output data type and user request. Usually the lowest precision defines the speedup that can be achieved. The ratio of the performance of the lowest precision over the main precision (e.g., Inputs/Outputs datatype) define somehow the upper bound of the speedup that could be obtained. More precisely, it depends on many factors, but for large matrices sizes, it is the ratio of the matrix-matrix rank-k product (e.g., GEMM where K is 256 and M=N=size of the matrix) that define the possible speedup. For instance, if the inout precision is real double precision CUSOLVER\_R\_64F and the lowest precision is CUSOLVER\_R\_32F, then we can expect a speedup of at most 2X for large problem sizes. If the lowest precision was CUSOLVER\_R\_16F, then we can expect 3X-4X. A reasonable strategy should take the number of right-hand sides, the size of the matrix as well as the convergence rate into account. Parameter Memory In/out Meaning params host in/out The cusolverDnIRSParams\_t Params structure. lowest\_precision\_type host input Allowed lowest compute type (for example CUSOLVER\_R\_16F for half precision computation). See the table in the cusolverDnIRSParamsSetSolverPrecisions() section above for the supported precisions. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. 2.4.1.36. cusolverDnIRSParamsSetRefinementSolver() cusolverStatus\_t cusolverDnIRSParamsSetRefinementSolver( cusolverDnIRSParams\_t params, cusolverIRSRefinement\_t solver); This function sets the refinement solver to be used in the Iterative Refinement Solver functions such as the cusolverDnIRSXgesv() or the cusolverDnIRSXgels() functions. Note that the user has to set the refinement algorithm before a first call to the IRS solver because it is NOT set by default with the creating of params. Details about values that can be set to and theirs meaning are described in the table below. Parameter Memory In/out Meaning params host in/out The cusolverDnIRSParams\_tParams structure solver host input Type of the refinement solver to be used by the IRS solver such as cusolverDnIRSXgesv() or cusolverDnIRSXgels(). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. CUSOLVER\_IRS\_REFINE\_NOT\_SET Solver is not set, this value is what is set when creating the params structure. IRS solver will return an error. CUSOLVER\_IRS\_REFINE\_NONE No refinement solver; the IRS solver performs a factorization followed by a solve without any refinement. For example, if the IRS solver was cusolverDnIRSXgesv(), this is equivalent to a Xgesv routine without refinement and where the factorization is carried out in the lowest precision. If for example the main precision was CUSOLVER\_R\_64F and the lowest was CUSOLVER\_R\_64F as well, then this is equivalent to a call to cusolverDnDgesv(). CUSOLVER\_IRS\_REFINE\_CLASSICAL Classical iterative refinement solver. Similar to the one used in LAPACK routines. CUSOLVER\_IRS\_REFINE\_GMRES GMRES (Generalized Minimal Residual) based iterative refinement solver. In recent study, the GMRES method has drawn the scientific community attention for its ability to be used as refinement solver that outperforms the classical iterative refinement method. Based on our experimentation, we recommend this setting. CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES Classical iterative refinement solver that uses the GMRES (Generalized Minimal Residual) internally to solve the correction equation at each iteration. We call the classical refinement iteration the outer iteration while the GMRES is called inner iteration. Note that if the tolerance of the inner GMRES is set very low, let say to machine precision, then the outer classical refinement iteration will performs only one iteration and thus this option will behaves like CUSOLVER\_IRS\_REFINE\_GMRES. CUSOLVER\_IRS\_REFINE\_GMRES\_GMRES Similar to CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES which consists of classical refinement process that uses GMRES to solve the inner correction system, here it is a GMRES (Generalized Minimal Residual) based iterative refinement solver that uses another GMRES internally to solve the preconditioned system. 2.4.1.37. cusolverDnIRSParamsSetTol() cusolverStatus\_t cusolverDnIRSParamsSetTol( cusolverDnIRSParams\_t params, double val ); This function sets the tolerance for the refinement solver. By default it is such that all the RHS satisfy: RNRM < SQRT(N)\*XNRM\*ANRM\*EPS\*BWDMAX where RNRM is the infinity-norm of the residual XNRM is the infinity-norm of the solution ANRM is the infinity-operator-norm of the matrix A EPS is the machine epsilon for the Inputs/Outputs datatype that matches LAPACK LAMCH(‘Epsilon’) BWDMAX, the value BWDMAX is fixed to 1.0 The user can use this function to change the tolerance to a lower or higher value. Our goal is to give the user more control such a way he can investigate and control every detail of the IRS solver. Note that the tolerance value is always in real double precision whatever the Inputs/Outputs datatype is. Parameter Memory In/out Meaning params host in/out The cusolverDnIRSParams\_t Params structure. val host input Double precision real value to which the refinement tolerance will be set. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. 2.4.1.38. cusolverDnIRSParamsSetTolInner() cusolverStatus\_t cusolverDnIRSParamsSetTolInner( cusolverDnIRSParams\_t params, double val ); This function sets the tolerance for the inner refinement solver when the refinement solver consists of two-levels solver (for example, CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES or CUSOLVER\_IRS\_REFINE\_GMRES\_GMRES cases). It is not referenced in case of one level refinement solver such as CUSOLVER\_IRS\_REFINE\_CLASSICAL or CUSOLVER\_IRS\_REFINE\_GMRES. It is set to 1e-4 by default. This function set the tolerance for the inner solver (e.g. the inner GMRES). For example, if the Refinement Solver was set to CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES, setting this tolerance mean that the inner GMRES solver will converge to that tolerance at each outer iteration of the classical refinement solver. Our goal is to give the user more control such a way he can investigate and control every detail of the IRS solver. Note the, the tolerance value is always in real double precision whatever the Inputs/Outputs datatype is. Parameter Memory In/out Meaning params host in/out The cusolverDnIRSParams\_t Params structure. val host input Double precision real value to which the tolerance of the inner refinement solver will be set. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. 2.4.1.39. cusolverDnIRSParamsSetMaxIters() cusolverStatus\_t cusolverDnIRSParamsSetMaxIters( cusolverDnIRSParams\_t params, int max\_iters); This function sets the total number of allowed refinement iterations after which the solver will stop. Total means any iteration which means the sum of the outer and the inner iterations (inner is meaningful when two-levels refinement solver is set). Default value is set to 50. Our goal is to give the user more control such a way he can investigate and control every detail of the IRS solver. Parameter Memory In/out Meaning params host in/out The cusolverDnIRSParams\_t Params structure. max\_iters host input Maximum total number of iterations allowed for the refinement solver. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. 2.4.1.40. cusolverDnIRSParamsSetMaxItersInner() cusolverStatus\_t cusolverDnIRSParamsSetMaxItersInner( cusolverDnIRSParams\_t params, cusolver\_int\_t maxiters\_inner ); This function sets the maximal number of iterations allowed for the inner refinement solver. It is not referenced in case of one level refinement solver such as CUSOLVER\_IRS\_REFINE\_CLASSICAL or CUSOLVER\_IRS\_REFINE\_GMRES. The inner refinement solver will stop after reaching either the inner tolerance or the MaxItersInner value. By default, it is set to 50. Note that this value could not be larger than the MaxIters since MaxIters is the total number of allowed iterations. Note that if the user calls cusolverDnIRSParamsSetMaxIters after calling this function, SetMaxIters has priority and will overwrite MaxItersInner to the minimum value of (MaxIters, MaxItersInner). Parameter Memory In/out Meaning params host in/out The cusolverDnIRSParams\_t Params structure maxiters\_inner host input Maximum number of allowed inner iterations for the inner refinement solver. Meaningful when the refinement solver is a two-levels solver such as CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES or CUSOLVER\_IRS\_REFINE\_GMRES\_GMRES. Value should be less or equal to MaxIters. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. CUSOLVER\_STATUS\_IRS\_PARAMS\_INVALID If the value was larger than MaxIters. 2.4.1.41. cusolverDnIRSParamsEnableFallback() cusolverStatus\_t cusolverDnIRSParamsEnableFallback( cusolverDnIRSParams\_t params ); This function enable the fallback to the main precision in case the Iterative Refinement Solver (IRS) failed to converge. In other term, if the IRS solver failed to converge, the solver will return a no convergence code (e.g., niter < 0), but can either return the non-convergent solution as it is (e.g., disable fallback) or can fallback (e.g., enable fallback) to the main precision (which is the precision of the Inputs/Outputs data) and solve the problem from scratch returning the good solution. This is the behavior by default, and it will guarantee that the IRS solver always provide the good solution. This function is provided because we provided cusolverDnIRSParamsDisableFallback which allows the user to disable the fallback and thus this function allow the user to re-enable it. Parameter Memory In/out Meaning params host in/out The cusolverDnIRSParams\_t Params structure Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. 2.4.1.42. cusolverDnIRSParamsDisableFallback() cusolverStatus\_t cusolverDnIRSParamsDisableFallback( cusolverDnIRSParams\_t params ); This function disables the fallback to the main precision in case the Iterative Refinement Solver (IRS) failed to converge. In other term, if the IRS solver failed to converge, the solver will return a no convergence code (e.g., niter < 0), but can either return the non-convergent solution as it is (e.g., disable fallback) or can fallback (e.g., enable fallback) to the main precision (which is the precision of the Inputs/Outputs data) and solve the problem from scratch returning the good solution. This function disables the fallback and the returned solution is whatever the refinement solver was able to reach before it returns. Disabling fallback does not guarantee that the solution is the good one. However, if users want to keep getting the solution of the lower precision in case the IRS did not converge after certain number of iterations, they need to disable the fallback. The user can re-enable it by calling cusolverDnIRSParamsEnableFallback. Parameter Memory In/out Meaning params host in/out The cusolverDnIRSParams\_t Params structure Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. 2.4.1.43. cusolverDnIRSParamsGetMaxIters() cusolverStatus\_t cusolverDnIRSParamsGetMaxIters( cusolverDnIRSParams\_t params, cusolver\_int\_t \*maxiters ); This function returns the current setting in the params structure for the maximal allowed number of iterations (for example, either the default MaxIters, or the one set by the user in case he set it using cusolverDnIRSParamsSetMaxIters). Note that this function returns the current setting in the params configuration and not to be confused with the cusolverDnIRSInfosGetMaxIters which return the maximal allowed number of iterations for a particular call to an IRS solver. To be clearer, the params structure can be used for many calls to an IRS solver. A user can change the allowed MaxIters between calls while the Infos structure in cusolverDnIRSInfosGetMaxIters contains information about a particular call and cannot be reused for different calls, and thus, cusolverDnIRSInfosGetMaxIters returns the allowed MaxIters for that call. Parameter Memory In/out Meaning params host in The cusolverDnIRSParams\_t Params structure. maxiters host output The maximal number of iterations that is currently set. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_PARAMS\_NOT\_INITIALIZED The Params structure was not created. 2.4.1.44. cusolverDnIRSInfosCreate() cusolverStatus\_t cusolverDnIRSInfosCreate( cusolverDnIRSInfos\_t\* infos ) This function creates and initializes the Infos structure that will hold the refinement information of an Iterative Refinement Solver (IRS) call. Such information includes the total number of iterations that was needed to converge (Niters), the outer number of iterations (meaningful when two-levels preconditioner such as CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES is used ), the maximal number of iterations that was allowed for that call, and a pointer to the matrix of the convergence history residual norms. The Infos structure needs to be created before a call to an IRS solver. The Infos structure is valid for only one call to an IRS solver, since it holds info about that solve and thus each solve will requires its own Infos structure. Parameter Memory In/out Meaning info host output Pointer to the cusolverDnIRSInfos\_t Infos structure. Status Returned CUSOLVER\_STATUS\_SUCCESS The structure was initialized successfully. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. 2.4.1.45. cusolverDnIRSInfosDestroy() cusolverStatus\_t cusolverDnIRSInfosDestroy( cusolverDnIRSInfos\_t infos ); This function destroys and releases any memory required by the Infos structure. This function destroys all the information (for example, Niters performed, OuterNiters performed, residual history etc.) about a solver call; thus, this function should only be called after the user is finished with the information. Parameter Memory In/out Meaning info host in/out The cusolverDnIRSInfos\_t Infos structure. Status Returned CUSOLVER\_STATUS\_SUCCESS The resources were released successfully. CUSOLVER\_STATUS\_IRS\_INFOS\_NOT\_INITIALIZED The Infos structure was not created. 2.4.1.46. cusolverDnIRSInfosGetMaxIters() cusolverStatus\_t cusolverDnIRSInfosGetMaxIters( cusolverDnIRSInfos\_t infos, cusolver\_int\_t \*maxiters ); This function returns the maximal allowed number of iterations that was set for the corresponding call to the IRS solver. Note that this function returns the setting that was set when that call happened and is not to be confused with the cusolverDnIRSParamsGetMaxIters which returns the current setting in the params configuration structure. To be clearer, the params structure can be used for many calls to an IRS solver. A user can change the allowed MaxIters between calls while the Infos structure in cusolverDnIRSInfosGetMaxIters contains information about a particular call and cannot be reused for different calls, thus cusolverDnIRSInfosGetMaxIters returns the allowed MaxIters for that call. Parameter Memory In/out Meaning infos host in The cusolverDnIRSInfos\_t Infos structure. maxiters host output The maximal number of iterations that is currently set. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_INFOS\_NOT\_INITIALIZED The Infos structure was not created. 2.4.1.47. cusolverDnIRSInfosGetNiters() cusolverStatus\_t cusolverDnIRSInfosGetNiters( cusolverDnIRSInfos\_t infos, cusolver\_int\_t \*niters ); This function returns the total number of iterations performed by the IRS solver. If it was negative, it means that the IRS solver did not converge and if the user did not disable the fallback to full precision, then the fallback to a full precision solution happened and solution is good. Please refer to the description of negative niters values in the corresponding IRS linear solver functions such as cusolverDnXgesv() or cusolverDnXgels(). Parameter Memory In/out Meaning infos host in The cusolverDnIRSInfos\_t Infos structure. niters host output The total number of iterations performed by the IRS solver. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_INFOS\_NOT\_INITIALIZED The Infos structure was not created. 2.4.1.48. cusolverDnIRSInfosGetOuterNiters() cusolverStatus\_t cusolverDnIRSInfosGetOuterNiters( cusolverDnIRSInfos\_t infos, cusolver\_int\_t \*outer\_niters ); This function returns the number of iterations performed by the outer refinement loop of the IRS solver. When the refinement solver consists of a one-level solver such as CUSOLVER\_IRS\_REFINE\_CLASSICAL or CUSOLVER\_IRS\_REFINE\_GMRES, it is the same as Niters. When the refinement solver consists of a two-levels solver such as CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES or CUSOLVER\_IRS\_REFINE\_GMRES\_GMRES, it is the number of iterations of the outer loop. Refer to the description of the cusolverIRSRefinement\_t for more details. Parameter Memory In/out Meaning infos host in The cusolverDnIRSInfos\_t Infos structure. outer\_niters host output The number of iterations of the outer refinement loop of the IRS solver. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_INFOS\_NOT\_INITIALIZED The Infos structure was not created. 2.4.1.49. cusolverDnIRSInfosRequestResidual() cusolverStatus\_t cusolverDnIRSInfosRequestResidual( cusolverDnIRSInfos\_t infos ); This function tells the IRS solver to store the convergence history (residual norms) of the refinement phase in a matrix that can be accessed via a pointer returned by the cusolverDnIRSInfosGetResidualHistory() function. Parameter Memory In/out Meaning infos host in The cusolverDnIRSInfos\_t Infos structure Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_INFOS\_NOT\_INITIALIZED The Infos structure was not created. 2.4.1.50. cusolverDnIRSInfosGetResidualHistory() cusolverStatus\_t cusolverDnIRSInfosGetResidualHistory( cusolverDnIRSInfos\_t infos, void \*\*residual\_history ); If the user called cusolverDnIRSInfosRequestResidual() before the call to the IRS function, then the IRS solver will store the convergence history (residual norms) of the refinement phase in a matrix that can be accessed via a pointer returned by this function. The datatype of the residual norms depends on the input and output data type. If the Inputs/Outputs datatype is double precision real or complex (CUSOLVER\_R\_FP64 or CUSOLVER\_C\_FP64), this residual will be of type real double precision (FP64) double, otherwise if the Inputs/Outputs datatype is single precision real or complex (CUSOLVER\_R\_FP32 or CUSOLVER\_C\_FP32), this residual will be real single precision FP32 float. The residual history matrix consists of two columns (even for the multiple right-hand side case NRHS) of MaxIters+1 row, thus a matrix of size (MaxIters+1,2). Only the first OuterNiters+1 rows contains the residual norms the other (e.g., OuterNiters+2:Maxiters+1) are garbage. On the first column, each row “i” specify the total number of iterations happened till this outer iteration “i” and on the second columns the residual norm corresponding to this outer iteration “i”. Thus, the first row (e.g., outer iteration “0”) consists of the initial residual (e.g., the residual before the refinement loop start) then the consecutive rows are the residual obtained at each outer iteration of the refinement loop. Note, it only consists of the history of the outer loop. If the refinement solver was CUSOLVER\_IRS\_REFINE\_CLASSICAL or CUSOLVER\_IRS\_REFINE\_GMRES, then OuterNiters=Niters (Niters is the total number of iterations performed) and there is Niters+1 rows of norms that correspond to the Niters outer iterations. If the refinement solver was CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES or CUSOLVER\_IRS\_REFINE\_GMRES\_GMRES, then OuterNiters <= Niters corresponds to the outer iterations performed by the outer refinement loop. Thus, there is OuterNiters+1 residual norms where row “i” correspond to the outer iteration “i” and the first column specify the total number of iterations (outer and inner) that were performed till this step the second columns correspond to the residual norm at this step. For example, let’s say the user specifies CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES as a refinement solver and say it needed 3 outer iterations to converge and 4,3,3 inner iterations at each outer, respectively. This consists of 10 total iterations. Row 0 corresponds to the first residual before the refinement start, so it has 0 in its first column. On row 1 which corresponds to the outer iteration 1, it will be 4 (4 is the total number of iterations that were performed till now), on row 2 it will be 7, and on row 3 it will be 10. In summary, let’s define ldh=Maxiters+1, the leading dimension of the residual matrix. then residual\_history\[i\] shows the total number of iterations performed at the outer iteration “i” and residual\_history\[i+ldh\] corresponds to the norm of the residual at this outer iteration. Parameter Memory In/out Meaning infos host in The cusolverDnIRSInfos\_t Infos structure. residual\_history host output Returns a void pointer to the matrix of the convergence history residual norms. See the description above for the relation between the residual norm datatype and the inout datatype. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_IRS\_INFOS\_NOT\_INITIALIZED The Infos structure was not created CUSOLVER\_STATUS\_INVALID\_VALUE This function was called without calling cusolverDnIRSInfosRequestResidual() in advance. 2.4.1.51. cusolverDnCreateParams() cusolverStatus\_t cusolverDnCreateParams( cusolverDnParams\_t \*params); This function creates and initializes the structure of 64-bit API to default values. Parameter Memory In/out Meaning params host output The pointer to the structure of 64-bit API. Status Returned CUSOLVER\_STATUS\_SUCCESS The structure was initialized successfully. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. 2.4.1.52. cusolverDnDestroyParams() cusolverStatus\_t cusolverDnDestroyParams( cusolverDnParams\_t params); This function destroys and releases any memory required by the structure. Parameter Memory In/out Meaning params host input The structure of 64-bit API. Status Returned CUSOLVER\_STATUS\_SUCCESS The resources were released successfully. 2.4.1.53. cusolverDnSetAdvOptions() cusolverStatus\_t cusolverDnSetAdvOptions ( cusolverDnParams\_t params, cusolverDnFunction\_t function, cusolverAlgMode\_t algo ); This function configures algorithm algo of function, a 64-bit API routine. Parameter Memory In/out Meaning params host in/out The pointer to the structure of 64-bit API. function host input The routine to be configured. algo host input The algorithm to be configured. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_INVALID\_VALUE Wrong combination of function and algo. 2.4.2. Dense Linear Solver Reference (legacy) This section describes linear solver API of cuSolverDN, including Cholesky factorization, LU with partial pivoting, QR factorization and Bunch-Kaufman (LDLT) factorization. 2.4.2.1. cusolverDn potrf() These helper functions calculate the necessary size of work buffers. cusolverStatus\_t cusolverDnSpotrf\_bufferSize(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, float \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnDpotrf\_bufferSize(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, double \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnCpotrf\_bufferSize(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnZpotrf\_bufferSize(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, int \*Lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSpotrf(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, float \*A, int lda, float \*Workspace, int Lwork, int \*devInfo ); cusolverStatus\_t cusolverDnDpotrf(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, double \*A, int lda, double \*Workspace, int Lwork, int \*devInfo ); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCpotrf(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, cuComplex \*Workspace, int Lwork, int \*devInfo ); cusolverStatus\_t cusolverDnZpotrf(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, cuDoubleComplex \*Workspace, int Lwork, int \*devInfo ); This function computes the Cholesky factorization of a Hermitian positive-definite matrix. A is an \\(n \\times n\\) Hermitian matrix, only the lower or upper part is meaningful. The input parameter uplo indicates which part of the matrix is used. The function will leave the other part untouched. If input parameter uplo is CUBLAS\_FILL\_MODE\_LOWER, only the lower triangular part of A is processed, and replaced by the lower triangular Cholesky factor L. \\\[A = L\*L^{H}\\\] If input parameter uplo is CUBLAS\_FILL\_MODE\_UPPER, only upper triangular part of A is processed, and replaced by upper triangular Cholesky factor U. \\\[A = U^{H}\*U\\\] The user has to provide working space which is pointed by input parameter Workspace. The input parameter Lwork is size of the working space, and it is returned by potrf\_bufferSize(). If Cholesky factorization failed, i.e. some leading minor of A is not positive definite, or equivalently some diagonal elements of L or U is not a real number. The output parameter devInfo would indicate smallest leading minor of A which is not positive definite. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). API of potrf Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. uplo host input Indicates if matrix A lower or upper part is stored; the other part is not referenced. n host input Number of rows and columns of matrix A. A device in/out array of dimension lda \* n with lda is not less than max(1,n). lda host input Leading dimension of two-dimensional array used to store matrix A. Workspace device in/out Working space, array of size Lwork. Lwork host input Size of Workspace, returned by potrf\_bufferSize. devInfo device output If devInfo = 0, the Cholesky factorization is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). if devInfo = i, the leading minor of order i is not positive definite. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0 or lda potrs() cusolverStatus\_t cusolverDnSpotrs(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, int nrhs, const float \*A, int lda, float \*B, int ldb, int \*devInfo); cusolverStatus\_t cusolverDnDpotrs(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, int nrhs, const double \*A, int lda, double \*B, int ldb, int \*devInfo); cusolverStatus\_t cusolverDnCpotrs(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, int nrhs, const cuComplex \*A, int lda, cuComplex \*B, int ldb, int \*devInfo); cusolverStatus\_t cusolverDnZpotrs(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, int nrhs, const cuDoubleComplex \*A, int lda, cuDoubleComplex \*B, int ldb, int \*devInfo); This function solves a system of linear equations \\\[A\*X = B\\\] where A is an \\(n \\times n\\) Hermitian matrix, only lower or upper part is meaningful. The input parameter uplo indicates which part of the matrix is used. The function will leave the other part untouched. The user has to call potrf first to factorize matrix A. If input parameter uplo is CUBLAS\_FILL\_MODE\_LOWER, A is lower triangular Cholesky factor L corresponding to \\(A = L\*L^H\\). If input parameter uplo is CUBLAS\_FILL\_MODE\_UPPER, A is upper triangular Cholesky factor U corresponding to \\(A = U^{H}\*U\\). The operation is in-place, i.e. matrix X overwrites matrix B with the same leading dimension ldb. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). API of potrs Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. uplo host input Indicates if matrix A lower or upper part is stored, the other part is not referenced. n host input Number of rows and columns of matrix A. nrhs host input Number of columns of matrix X and B. A device input array of dimension lda \* n with lda is not less than max(1,n). A is either lower Cholesky factor L or upper Cholesky factor U. lda host input Leading dimension of two-dimensional array used to store matrix A. B device in/out array of dimension ldb \* nrhs. ldb is not less than max(1,n). As an input, B is right hand side matrix. As an output, B is the solution matrix. devInfo device output If devInfo = 0, the Cholesky factorization is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, nrhs<0, lda potri() These helper functions calculate the necessary size of work buffers. cusolverStatus\_t cusolverDnSpotri\_bufferSize(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, float \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnDpotri\_bufferSize(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, double \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnCpotri\_bufferSize(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnZpotri\_bufferSize(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, int \*Lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSpotri(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, float \*A, int lda, float \*Workspace, int Lwork, int \*devInfo ); cusolverStatus\_t cusolverDnDpotri(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, double \*A, int lda, double \*Workspace, int Lwork, int \*devInfo ); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCpotri(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, cuComplex \*Workspace, int Lwork, int \*devInfo ); cusolverStatus\_t cusolverDnZpotri(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, cuDoubleComplex \*Workspace, int Lwork, int \*devInfo ); This function computes the inverse of a positive-definite matrix A using the Cholesky factorization \\\[A = L\*L^H = U^{H}\*U\\\] computed by potrf(). A is an \\(n \\times n\\) matrix containing the triangular factor L or U computed by the Cholesky factorization. Only lower or upper part is meaningful and the input parameter uplo indicates which part of the matrix is used. The function would leave the other part untouched. If the input parameter uplo is CUBLAS\_FILL\_MODE\_LOWER, only lower triangular part of A is processed, and replaced the by lower triangular part of the inverse of A. If the input parameter uplo is CUBLAS\_FILL\_MODE\_UPPER, only upper triangular part of A is processed, and replaced by the upper triangular part of the inverse of A. The user has to provide the working space which is pointed to by input parameter Workspace. The input parameter Lwork is the size of the working space, returned by potri\_bufferSize(). If the computation of the inverse fails, i.e. some leading minor of L or U, is null, the output parameter devInfo would indicate the smallest leading minor of L or U which is not positive definite. If the output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting the handle). API of potri Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. uplo host input Indicates if matrix A lower or upper part is stored, the other part is not referenced. n host input Number of rows and columns of matrix A. A device in/out array of dimension lda \* n where lda is not less than max(1,n). lda host input Leading dimension of two-dimensional array used to store matrix A. Workspace device in/out Working space, array of size Lwork. Lwork host input Size of Workspace, returned by potri\_bufferSize. devInfo device output If devInfo = 0, the computation of the inverse is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). if devInfo = i, the leading minor of order i is zero. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0 or lda getrf() These helper functions calculate the size of work buffers needed. Please visit cuSOLVER Library Samples - getrf for a code example. cusolverStatus\_t cusolverDnSgetrf\_bufferSize(cusolverDnHandle\_t handle, int m, int n, float \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnDgetrf\_bufferSize(cusolverDnHandle\_t handle, int m, int n, double \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnCgetrf\_bufferSize(cusolverDnHandle\_t handle, int m, int n, cuComplex \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnZgetrf\_bufferSize(cusolverDnHandle\_t handle, int m, int n, cuDoubleComplex \*A, int lda, int \*Lwork ); The S and D data types are real single and double precision, respectively. cusolverStatus\_t cusolverDnSgetrf(cusolverDnHandle\_t handle, int m, int n, float \*A, int lda, float \*Workspace, int \*devIpiv, int \*devInfo ); cusolverStatus\_t cusolverDnDgetrf(cusolverDnHandle\_t handle, int m, int n, double \*A, int lda, double \*Workspace, int \*devIpiv, int \*devInfo ); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCgetrf(cusolverDnHandle\_t handle, int m, int n, cuComplex \*A, int lda, cuComplex \*Workspace, int \*devIpiv, int \*devInfo ); cusolverStatus\_t cusolverDnZgetrf(cusolverDnHandle\_t handle, int m, int n, cuDoubleComplex \*A, int lda, cuDoubleComplex \*Workspace, int \*devIpiv, int \*devInfo ); This function computes the LU factorization of an \\(m \\times n\\) matrix \\\[P\*A = L\*U\\\] where A is an \\(m \\times n\\) matrix, P is a permutation matrix, L is a lower triangular matrix with unit diagonal, and U is an upper triangular matrix. The user has to provide working space which is pointed by input parameter Workspace. The input parameter Lwork is size of the working space, and it is returned by getrf\_bufferSize(). If LU factorization failed, i.e. matrix A (U) is singular, The output parameter devInfo=i indicates U(i,i) = 0. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). If devIpiv is null, no pivoting is performed. The factorization is A=L\*U, which is not numerically stable. No matter LU factorization failed or not, the output parameter devIpiv contains pivoting sequence, row i is interchanged with row devIpiv(i). The user can combine getrf and getrs to complete a linear solver. Remark: getrf uses fastest implementation with large workspace of size m\*n. The user can choose the legacy implementation with minimal workspace by Getrf and cusolverDnSetAdvOptions(params, CUSOLVERDN\_GETRF, CUSOLVER\_ALG\_1). API of getrf Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. m host input Number of rows of matrix A. n host input Number of columns of matrix A. A device in/out array of dimension lda \* n with lda is not less than max(1,m). lda host input Leading dimension of two-dimensional array used to store matrix A. Workspace device in/out Working space, array of size Lwork. devIpiv device output Array of size at least min(m,n), containing pivot indices. devInfo device output If devInfo = 0, the LU factorization is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). if devInfo = i, the U(i,i) = 0. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or lda getrs() Please visit cuSOLVER Library Samples - getrf for a code example. cusolverStatus\_t cusolverDnSgetrs(cusolverDnHandle\_t handle, cublasOperation\_t trans, int n, int nrhs, const float \*A, int lda, const int \*devIpiv, float \*B, int ldb, int \*devInfo ); cusolverStatus\_t cusolverDnDgetrs(cusolverDnHandle\_t handle, cublasOperation\_t trans, int n, int nrhs, const double \*A, int lda, const int \*devIpiv, double \*B, int ldb, int \*devInfo ); cusolverStatus\_t cusolverDnCgetrs(cusolverDnHandle\_t handle, cublasOperation\_t trans, int n, int nrhs, const cuComplex \*A, int lda, const int \*devIpiv, cuComplex \*B, int ldb, int \*devInfo ); cusolverStatus\_t cusolverDnZgetrs(cusolverDnHandle\_t handle, cublasOperation\_t trans, int n, int nrhs, const cuDoubleComplex \*A, int lda, const int \*devIpiv, cuDoubleComplex \*B, int ldb, int \*devInfo ); This function solves a linear system of multiple right-hand sides \\\[op(A)\*X = B\\\] where A is an \\(n \\times n\\) matrix, and was LU-factored by getrf, that is, lower triangular part of A is L, and upper triangular part (including diagonal elements) of A is U. B is an \\(n\\times {nrhs}\\) right-hand side matrix. The input parameter trans is defined by The input parameter devIpiv is an output of getrf. It contains pivot indices, which are used to permutate right-hand sides. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). The user can combine getrf and getrs to complete a linear solver. Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. trans host input Operation op(A) that is non- or (conj.) transpose. n host input Number of rows and columns of matrix A. nrhs host input Number of right-hand sides. A device input array of dimension lda \* n with lda is not less than max(1,n). lda host input Leading dimension of two-dimensional array used to store matrix A. devIpiv device input Array of size at least n, containing pivot indices. B device output array of dimension ldb \* nrhs with ldb is not less than max(1,n). ldb host input Leading dimension of two-dimensional array used to store matrix B. devInfo device output If devInfo = 0, the operation is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0 or lda gesv() These functions are modelled after functions DSGESV and ZCGESV from LAPACK. They compute the solution of a system of linear equations with one or multiple right hand sides using mixed precision iterative refinement techniques based on the LU factorization Xgesv. These functions are similar in term of functionalities to the full precision LU solver (Xgesv, where X denotes Z,C,D,S) but it uses lower precision internally in order to provide faster time to solution, from here comes the name mixed precision. Mixed precision iterative refinement techniques means that the solver compute an LU factorization in lower precision and then iteratively refine the solution to achieve the accuracy of the Inputs/Outputs datatype precision. The corresponds to the Inputs/Outputs datatype precision while represent the internal lower precision at which the factorization will be carried on. \\\[A \\times X = B\\\] Where A is n-by-n matrix and X and B are n-by-nrhs matrices. Functions API are designed to be as close as possible to LAPACK API to be considered as a quick and easy drop-in replacement. Parameters and behavior are mostly the same as LAPACK counterparts. Description of these functions and differences from LAPACK is given below. gesv() functions are designated by two floating point precisions The corresponds to the main precision (e.g., Inputs/Outputs datatype precision) and the represent the internal lower precision at which the factorization will be carried on. cusolver gesv() first attempts to factorize the matrix in lower precision and use this factorization within an iterative refinement procedure to obtain a solution with same normwise backward error as the main precision . If the approach fails to converge, then the method fallback to the main precision factorization and solve (Xgesv) such a way that there is always a good solution at the output of these functions. If is equal to , then it is not a mixed precision process but rather a full one precision factorization, solve and refinement within the same main precision. The iterative refinement process is stopped if ITER > ITERMAX or for all the RHS we have: RNRM < SQRT(N)\*XNRM\*ANRM\*EPS\*BWDMAX where ITER is the number of the current iteration in the iterative refinement process RNRM is the infinity-norm of the residual XNRM is the infinity-norm of the solution ANRM is the infinity-operator-norm of the matrix A EPS is the machine epsilon that matches LAPACK LAMCH(‘Epsilon’) The value ITERMAX and BWDMAX are fixed to 50 and 1.0 respectively. The function returns value describes the results of the solving process. A CUSOLVER\_STATUS\_SUCCESS indicates that the function finished with success otherwise, it indicates if one of the API arguments is incorrect, or if the function did not finish with success. More details about the error will be in the niters and the dinfo API parameters. See their description below for more details. User should provide the required workspace allocated on device memory. The amount of bytes required can be queried by calling the respective function gesv\_bufferSize(). Note that in addition to the two mixed precision functions available in LAPACK (for example, dsgesv and zcgesv), we provide a large set of mixed precision functions that include half, bfloat and tensorfloat as a lower precision as well as same precision functions (, main and lowest precision are equal is equal to ). The following table specifies which precisions will be used for which interface function. Tensor Float (TF32), introduced with NVIDIA Ampere Architecture GPUs, is the most robust tensor core accelerated compute mode for the iterative refinement solver. It is able to solve the widest range of problems in HPC arising from different applications and provides up to 4X and 5X speedup for real and complex systems, respectively. On Volta and Turing architecture GPUs, half precision tensor core acceleration is recommended. In cases where the iterative refinement solver fails to converge to the desired accuracy (main precision, INOUT data precision), it is recommended to use main precision as internal lowest precision (i.e., cusolverDn\[DD,ZZ\]gesv for the FP64 case). Supported combinations of floating point precisions for cusolver gesv() functions Interface function Main precision (matrix, rhs and solution datatype) Lowest precision allowed to be used internally cusolverDnZZgesv cuDoubleComplex double complex cusolverDnZCgesv\* cuDoubleComplex single complex cusolverDnZKgesv cuDoubleComplex half complex cusolverDnZEgesv cuDoubleComplex bfloat complex cusolverDnZYgesv cuDoubleComplex tensorfloat complex cusolverDnCCgesv cuComplex single complex cusolverDnCKgesv cuComplex half complex cusolverDnCEgesv cuComplex bfloat complex cusolverDnCYgesv cuComplex tensorfloat complex cusolverDnDDgesv double double cusolverDnDSgesv\* double single cusolverDnDHgesv double half cusolverDnDBgesv double bfloat cusolverDnDXgesv double tensorfloat cusolverDnSSgesv float single cusolverDnSHgesv float half cusolverDnSBgesv float bfloat cusolverDnSXgesv float tensorfloat \* Has LAPACK counterparts cusolverDn gesv\_bufferSize() functions will return workspace buffer size in bytes required for the corresponding cusolverDn gesv() function. cusolverStatus\_t cusolverDnZZgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, cuDoubleComplex \* dA, int ldda, int \* dipiv, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnZCgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, cuDoubleComplex \* dA, int ldda, int \* dipiv, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnZKgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, cuDoubleComplex \* dA, int ldda, int \* dipiv, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnZEgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, cuDoubleComplex \* dA, int ldda, int \* dipiv, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnZYgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, cuDoubleComplex \* dA, int ldda, int \* dipiv, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnCCgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, cuComplex \* dA, int ldda, int \* dipiv, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnCKgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, cuComplex \* dA, int ldda, int \* dipiv, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnCEgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, cuComplex \* dA, int ldda, int \* dipiv, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnCYgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, cuComplex \* dA, int ldda, int \* dipiv, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnDDgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, double \* dA, int ldda, int \* dipiv, double \* dB, int lddb, double \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnDSgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, double \* dA, int ldda, int \* dipiv, double \* dB, int lddb, double \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnDHgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, double \* dA, int ldda, int \* dipiv, double \* dB, int lddb, double \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnDBgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, double \* dA, int ldda, int \* dipiv, double \* dB, int lddb, double \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnDXgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, double \* dA, int ldda, int \* dipiv, double \* dB, int lddb, double \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnSSgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, float \* dA, int ldda, int \* dipiv, float \* dB, int lddb, float \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnSHgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, float \* dA, int ldda, int \* dipiv, float \* dB, int lddb, float \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnSBgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, float \* dA, int ldda, int \* dipiv, float \* dB, int lddb, float \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnSXgesv\_bufferSize( cusolverHandle\_t handle, int n, int nrhs, float \* dA, int ldda, int \* dipiv, float \* dB, int lddb, float \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); Parameters of cusolverDn gesv\_bufferSize() functions Parameter Memory In/out Meaning handle host input Handle to the cusolverDN library context. n host input Number of rows and columns of square matrix A. Should be non-negative. nrhs host input Number of right hand sides to solve. Should be non-negative. dA device None Matrix A with size n-by-n. Can be NULL. ldda host input Leading dimension of two-dimensional array used to store matrix A. lda >= n. dipiv device None Pivoting sequence. Not used and can be NULL. dB device None Set of right hand sides B of size n-by-nrhs. Can be NULL. lddb host input Leading dimension of two-dimensional array used to store matrix of right hand sides B. ldb >= n. dX device None Set of solution vectors X of size n-by-nrhs. Can be NULL. lddx host input Leading dimension of two-dimensional array used to store matrix of solution vectors X. ldx >= n. dwork device none Pointer to device workspace. Not used and can be NULL. lwork\_bytes host output Pointer to a variable where required size of temporary workspace in bytes will be stored. Can’t be NULL. cusolverStatus\_t cusolverDnZZgesv( cusolverDnHandle\_t handle, int n, int nrhs, cuDoubleComplex \* dA, int ldda, int \* dipiv, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnZCgesv( cusolverDnHandle\_t handle, int n, int nrhs, cuDoubleComplex \* dA, int ldda, int \* dipiv, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnZKgesv( cusolverDnHandle\_t handle, int n, int nrhs, cuDoubleComplex \* dA, int ldda, int \* dipiv, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnZEgesv( cusolverDnHandle\_t handle, int n, int nrhs, cuDoubleComplex \* dA, int ldda, int \* dipiv, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnZYgesv( cusolverDnHandle\_t handle, int n, int nrhs, cuDoubleComplex \* dA, int ldda, int \* dipiv, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnCCgesv( cusolverDnHandle\_t handle, int n, int nrhs, cuComplex \* dA, int ldda, int \* dipiv, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnCKgesv( cusolverDnHandle\_t handle, int n, int nrhs, cuComplex \* dA, int ldda, int \* dipiv, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnCEgesv( cusolverDnHandle\_t handle, int n, int nrhs, cuComplex \* dA, int ldda, int \* dipiv, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnCYgesv( cusolverDnHandle\_t handle, int n, int nrhs, cuComplex \* dA, int ldda, int \* dipiv, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnDDgesv( cusolverDnHandle\_t handle, int n, int nrhs, double \* dA, int ldda, int \* dipiv, double \* dB, int lddb, double \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnDSgesv( cusolverDnHandle\_t handle, int n, int nrhs, double \* dA, int ldda, int \* dipiv, double \* dB, int lddb, double \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnDHgesv( cusolverDnHandle\_t handle, int n, int nrhs, double \* dA, int ldda, int \* dipiv, double \* dB, int lddb, double \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnDBgesv( cusolverDnHandle\_t handle, int n, int nrhs, double \* dA, int ldda, int \* dipiv, double \* dB, int lddb, double \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnDXgesv( cusolverDnHandle\_t handle, int n, int nrhs, double \* dA, int ldda, int \* dipiv, double \* dB, int lddb, double \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnSSgesv( cusolverDnHandle\_t handle, int n, int nrhs, float \* dA, int ldda, int \* dipiv, float \* dB, int lddb, float \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnSHgesv( cusolverDnHandle\_t handle, int n, int nrhs, float \* dA, int ldda, int \* dipiv, float \* dB, int lddb, float \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnSBgesv( cusolverDnHandle\_t handle, int n, int nrhs, float \* dA, int ldda, int \* dipiv, float \* dB, int lddb, float \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnSXgesv( cusolverDnHandle\_t handle, int n, int nrhs, float \* dA, int ldda, int \* dipiv, float \* dB, int lddb, float \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); Parameters of cusolverDn gesv() functions Parameter Memory In/out Meaning handle host input Handle to the cusolverDN library context. n host input Number of rows and columns of square matrix A. Should be non-negative. nrhs host input Number of right hand sides to solve. Should be non-negative. dA device in/out Matrix A with size n-by-n. Can’t be NULL. On return - unchanged if the iterative refinement process converged. If not - will contains the factorization of the matrix A in the main precision (A = P \* L \* U, where P - permutation matrix defined by vector ipiv, L and U - lower and upper triangular matrices). ldda host input Leading dimension of two-dimensional array used to store matrix A. lda >= n. dipiv device output Vector that defines permutation for the factorization - row i was interchanged with row ipiv\[i\] dB device input Set of right hand sides B of size n-by-nrhs. Can’t be NULL. lddb host input Leading dimension of two-dimensional array used to store matrix of right hand sides B. ldb >= n. dX device output Set of solution vectors X of size n-by-nrhs. Can’t be NULL. lddx host input Leading dimension of two-dimensional array used to store matrix of solution vectors X. ldx >= n. dWorkspace device input Pointer to an allocated workspace in device memory of size lwork\_bytes. lwork\_bytes host input Size of the allocated device workspace. Should be at least what was returned by cusolverDn gesv\_bufferSize() function. niters host output If iter is <0: iterative refinement has failed, main precision (Inputs/Outputs precision) factorization has been performed -1: taking into account machine parameters, n, nrhs, it is a priori not worth working in lower precision -2: overflow of an entry when moving from main to lower precision -3: failure during the factorization -5: overflow occurred during computation -50: solver stopped the iterative refinement after reaching maximum allowed iterations >0: iter is a number of iterations solver performed to reach convergence criteria dinfo device output Status of the IRS solver on the return. If 0 - solve was successful. If dinfo = -i then i-th argument is not valid. If dinfo = i, then U(i,i) computed in main precision is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution could not be computed. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed, for example: n<0 lda gesv() functions, but wrapped in a more generic and expert interface that gives user more control to parametrize the function as well as it provides more information on output. cusolverDnIRSXgesv() allows additional control of the solver parameters such as setting: the main precision (Inputs/Outputs precision) of the solver the lowest precision to be used internally by the solver the refinement solver type the maximum allowed number of iterations in the refinement phase the tolerance of the refinement solver the fallback to main precision and more through the configuration parameters structure gesv\_irs\_params and its helper functions. For more details about what configuration can be set and its meaning please refer to all the functions in the cuSolverDN Helper Function Section that start with cusolverDnIRSParamsxxxx(). Moreover, cusolverDnIRSXgesv() provides additional information on the output such as the convergence history (e.g., the residual norms) at each iteration and the number of iterations needed to converge. For more details about what information can be retrieved and its meaning please refer to all the functions in the cuSolverDN Helper Function Section that start with cusolverDnIRSInfosxxxx() The function returns value describes the results of the solving process. A CUSOLVER\_STATUS\_SUCCESS indicates that the function finished with success otherwise, it indicates if one of the API arguments is incorrect, or if the configurations of params/infos structure is incorrect or if the function did not finish with success. More details about the error can be found by checking the niters and the dinfo API parameters. See their description below for further details. User should provide the required workspace allocated on device for the cusolverDnIRSXgesv() function. The amount of bytes required for the function can be queried by calling the respective function cusolverDnIRSXgesv\_bufferSize(). Note that, if the user would like a particular configuration to be set via the params structure, it should be set before the call to cusolverDnIRSXgesv\_bufferSize() to get the size of the required workspace. Tensor Float (TF32), introduced with NVIDIA Ampere architecture GPUs, is the most robust tensor core accelerated compute mode for the iterative refinement solver. It is able to solve the widest range of problems in HPC arising from different applications and provides up to 4X and 5X speedup for real and complex systems, respectively. On Volta and Turing architecture GPUs, half precision tensor core acceleration is recommended. In cases where the iterative refinement solver fails to converge to the desired accuracy (main precision, INOUT data precision), it is recommended to use main precision as internal lowest precision. The following table provides all possible combinations values for the lowest precision corresponding to the Inputs/Outputs data type. Note that if the lowest precision matches the Inputs/Outputs datatype, then the main precision factorization will be used. Supported Inputs/Outputs data type and lower precision for the IRS solver Inputs/Outputs Data Type (e.g., main precision) Supported values for the lowest precision CUSOLVER\_C\_64F CUSOLVER\_C\_64F, CUSOLVER\_C\_32F, CUSOLVER\_C\_16F, CUSOLVER\_C\_16BF, CUSOLVER\_C\_TF32 CUSOLVER\_C\_32F CUSOLVER\_C\_32F, CUSOLVER\_C\_16F, CUSOLVER\_C\_16BF, CUSOLVER\_C\_TF32 CUSOLVER\_R\_64F CUSOLVER\_R\_64F, CUSOLVER\_R\_32F, CUSOLVER\_R\_16F, CUSOLVER\_R\_16BF, CUSOLVER\_R\_TF32 CUSOLVER\_R\_32F CUSOLVER\_R\_32F, CUSOLVER\_R\_16F, CUSOLVER\_R\_16BF, CUSOLVER\_R\_TF32 The cusolverDnIRSXgesv\_bufferSize() function returns the required workspace buffer size in bytes for the corresponding cusolverDnXgesv() call with the given gesv\_irs\_params configuration. cusolverStatus\_t cusolverDnIRSXgesv\_bufferSize( cusolverDnHandle\_t handle, cusolverDnIRSParams\_t gesv\_irs\_params, cusolver\_int\_t n, cusolver\_int\_t nrhs, size\_t \* lwork\_bytes); Parameters of cusolverDnIRSXgesv\_bufferSize() functions Parameter Memory In/out Meaning handle host input Handle to the cusolverDn library context. params host input Xgesv configuration parameters n host input Number of rows and columns of the square matrix A. Should be non-negative. nrhs host input Number of right hand sides to solve. Should be non-negative. Note that nrhs is limited to 1 if the selected IRS refinement solver is CUSOLVER\_IRS\_REFINE\_GMRES, CUSOLVER\_IRS\_REFINE\_GMRES\_GMRES, CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES. lwork\_bytes host out Pointer to a variable, where the required size in bytes, of the workspace will be stored after a call to cusolverDnIRSXgesv\_bufferSize. Can’t be NULL. cusolverStatus\_t cusolverDnIRSXgesv( cusolverDnHandle\_t handle, cusolverDnIRSParams\_t gesv\_irs\_params, cusolverDnIRSInfos\_t gesv\_irs\_infos, int n, int nrhs, void \* dA, int ldda, void \* dB, int lddb, void \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* dinfo); Parameters of cusolverDnIRSXgesv() functions Parameter Memory In/out Meaning handle host input Handle to the cusolverDn library context. gesv\_irs\_params host input Configuration parameters structure, can serve one or more calls to any IRS solver gesv\_irs\_infos host in/out Info structure, where information about a particular solve will be stored. The gesv\_irs\_infos structure correspond to a particular call. Thus different calls requires different gesv\_irs\_infos structure otherwise, it will be overwritten. n host input Number of rows and columns of square matrix A. Should be non-negative. nrhs host input Number of right hand sides to solve. Should be non-negative. Note that, nrhs is limited to 1 if the selected IRS refinement solver is CUSOLVER\_IRS\_REFINE\_GMRES, CUSOLVER\_IRS\_REFINE\_GMRES\_GMRES, CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES. dA device in/out Matrix A with size n-by-n. Can’t be NULL. On return - will contain the factorization of the matrix A in the main precision (A = P \* L \* U, where P - permutation matrix defined by vector ipiv, L and U - lower and upper triangular matrices) if the iterative refinement solver was set to CUSOLVER\_IRS\_REFINE\_NONE and the lowest precision is equal to the main precision (Inputs/Outputs datatype), or if the iterative refinement solver did not converge and the fallback to main precision was enabled (fallback enabled is the default setting); unchanged otherwise. ldda host input Leading dimension of two-dimensional array used to store matrix A. lda >= n. dB device input Set of right hand sides B of size n-by-nrhs. Can’t be NULL. lddb host input Leading dimension of two-dimensional array used to store matrix of right hand sides B. ldb >= n. dX device output Set of solution vectors X of size n-by-nrhs. Can’t be NULL. lddx host input Leading dimension of two-dimensional array used to store matrix of solution vectors X. ldx >= n. dWorkspace device input Pointer to an allocated workspace in device memory of size lwork\_bytes. lwork\_bytes host input Size of the allocated device workspace. Should be at least what was returned by cusolverDnIRSXgesv\_bufferSize() function niters host output If iter is <0: iterative refinement has failed, main precision (Inputs/Outputs precision) factorization has been performed if fallback is enabled. -1: taking into account machine parameters, n, nrhs, it is a priori not worth working in lower precision -2: overflow of an entry when moving from main to lower precision -3: failure during the factorization -5: overflow occurred during computation -maxiter: solver stopped the iterative refinement after reaching maximum allowed iterations. >0: iter is a number of iterations solver performed to reach convergence criteria dinfo device output Status of the IRS solver on the return. If 0 - solve was successful. If dinfo = -i then i-th argument is not valid. If dinfo = i, then U(i,i) computed in main precision is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution could not be computed. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed, for example: n<0 lda 1, and refinement solver was set to CUSOLVER\_IRS\_REFINE\_GMRES. CUSOLVER\_STATUS\_IRS\_INFOS\_NOT\_INITIALIZED The information structure gesv\_irs\_infos was not created. CUSOLVER\_STATUS\_ALLOC\_FAILED CPU memory allocation failed, most likely during the allocation of the residual array that store the residual norms. 2.4.2.8. cusolverDn geqrf() These helper functions calculate the size of work buffers needed. cusolverStatus\_t cusolverDnSgeqrf\_bufferSize(cusolverDnHandle\_t handle, int m, int n, float \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnDgeqrf\_bufferSize(cusolverDnHandle\_t handle, int m, int n, double \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnCgeqrf\_bufferSize(cusolverDnHandle\_t handle, int m, int n, cuComplex \*A, int lda, int \*Lwork ); cusolverStatus\_t cusolverDnZgeqrf\_bufferSize(cusolverDnHandle\_t handle, int m, int n, cuDoubleComplex \*A, int lda, int \*Lwork ); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSgeqrf(cusolverDnHandle\_t handle, int m, int n, float \*A, int lda, float \*TAU, float \*Workspace, int Lwork, int \*devInfo ); cusolverStatus\_t cusolverDnDgeqrf(cusolverDnHandle\_t handle, int m, int n, double \*A, int lda, double \*TAU, double \*Workspace, int Lwork, int \*devInfo ); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCgeqrf(cusolverDnHandle\_t handle, int m, int n, cuComplex \*A, int lda, cuComplex \*TAU, cuComplex \*Workspace, int Lwork, int \*devInfo ); cusolverStatus\_t cusolverDnZgeqrf(cusolverDnHandle\_t handle, int m, int n, cuDoubleComplex \*A, int lda, cuDoubleComplex \*TAU, cuDoubleComplex \*Workspace, int Lwork, int \*devInfo ); This function computes the QR factorization of an \\(m \\times n\\) matrix \\\[A = Q\*R\\\] where A is an \\(m \\times n\\) matrix, Q is an \\(m \\times n\\) matrix, and R is a \\(n \\times n\\) upper triangular matrix. The user has to provide working space which is pointed by input parameter Workspace. The input parameter Lwork is size of the working space, and it is returned by geqrf\_bufferSize(). The matrix R is overwritten in upper triangular part of A, including diagonal elements. The matrix Q is not formed explicitly, instead, a sequence of householder vectors are stored in lower triangular part of A. The leading nonzero element of householder vector is assumed to be 1 such that output parameter TAU contains the scaling factor τ. If v is original householder vector, q is the new householder vector corresponding to τ, satisfying the following relation \\\[I - 2\*v\*v^{H} = I - \\tau\*q\*q^{H}\\\] If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). API of geqrf Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. m host input Number of rows of matrix A. n host input Number of columns of matrix A. A device in/out array of dimension lda \* n with lda is not less than max(1,m). lda host input Leading dimension of two-dimensional array used to store matrix A. TAU device output array of dimension at least min(m,n). Workspace device in/out Working space, array of size Lwork. Lwork host input Size of working array Workspace. devInfo device output If devInfo = 0, the LU factorization is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or lda gels() These functions compute the solution of a system of linear equations with one or multiple right hand sides using mixed precision iterative refinement techniques based on the QR factorization Xgels. These functions are similar in term of functionalities to the full precision LAPACK QR (least squares) solver (Xgels, where X denotes Z,C,D,S) but it uses lower precision internally in order to provide faster time to solution, from here comes the name mixed precision. Mixed precision iterative refinement techniques means that the solver compute an QR factorization in lower precision and then iteratively refine the solution to achieve the accuracy of the Inputs/Outputs datatype precision. The corresponds to the Inputs/Outputs datatype precision while represent the internal lower precision at which the factorization will be carried on. \\\[A \\times X = B\\\] Where A is m-by-n matrix and X is n-by-nrhs and B is m-by-nrhs matrices. Functions API are designed to be as close as possible to LAPACK API to be considered as a quick and easy drop-in replacement. Description of these functions is given below. gels() functions are designated by two floating point precisions The corresponds to the main precision (e.g., Inputs/Outputs datatype precision) and the represent the internal lower precision at which the factorization will be carried on. cusolver gels() first attempts to factorize the matrix in lower precision and use this factorization within an iterative refinement procedure to obtain a solution with same normwise backward error as the main precision . If the approach fails to converge, then the method fallback to the main precision factorization and solve (Xgels) such a way that there is always a good solution at the output of these functions. If is equal to , then it is not a mixed precision process but rather a full one precision factorization, solve and refinement within the same main precision. The iterative refinement process is stopped if: ITER > ITERMAX or for all the RHS we have: RNRM < SQRT(N)\*XNRM\*ANRM\*EPS\*BWDMAX where ITER is the number of the current iteration in the iterative refinement process RNRM is the infinity-norm of the residual XNRM is the infinity-norm of the solution ANRM is the infinity-operator-norm of the matrix A EPS is the machine epsilon that matches LAPACK LAMCH('Epsilon') The values ITERMAX and BWDMAX are fixed to 50 and 1.0 respectively. The function returns value describes the results of the solving process. A CUSOLVER\_STATUS\_SUCCESS indicates that the function finished with success otherwise, it indicates if one of the API arguments is incorrect, or if the function did not finish with success. More details about the error will be in the niters and the dinfo API parameters. See their description below for more details. User should provide the required workspace allocated on device memory. The amount of bytes required can be queried by calling the respective function gels\_bufferSize(). We provide a large set of mixed precision functions that include half, bfloat and tensorfloat as a lower precision as well as same precision functions (e.g., main and lowest precision are equal is equal to ). The following table specifies which precisions will be used for which interface function: Tensor Float (TF32), introduced with NVIDIA Ampere Architecture GPUs, is the most robust tensor core accelerated compute mode for the iterative refinement solver. It is able to solve the widest range of problems in HPC arising from different applications and provides up to 4X and 5X speedup for real and complex systems, respectively. On Volta and Turing architecture GPUs, half precision tensor core acceleration is recommended. In cases where the iterative refinement solver fails to converge to the desired accuracy (main precision, INOUT data precision), it is recommended to use main precision as internal lowest precision (i.e., cusolverDn\[DD,ZZ\]gels for the FP64 case). Supported combinations of floating point precisions for cusolver gels() functions Interface function Main precision (matrix, rhs and solution datatype) Lowest precision allowed to be used internally cusolverDnZZgels cuDoubleComplex double complex cusolverDnZCgels cuDoubleComplex single complex cusolverDnZKgels cuDoubleComplex half complex cusolverDnZEgels cuDoubleComplex bfloat complex cusolverDnZYgels cuDoubleComplex tensorfloat complex cusolverDnCCgels cuComplex single complex cusolverDnCKgels cuComplex half complex cusolverDnCEgels cuComplex bfloat complex cusolverDnCYgels cuComplex tensorfloat complex cusolverDnDDgels double double cusolverDnDSgels double single cusolverDnDHgels double half cusolverDnDBgels double bfloat cusolverDnDXgels double tensorfloat cusolverDnSSgels float single cusolverDnSHgels float half cusolverDnSBgels float bfloat cusolverDnSXgels float tensorfloat cusolverDn gels\_bufferSize() functions will return workspace buffer size in bytes required for the corresponding cusolverDn gels() function. cusolverStatus\_t cusolverDnZZgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, cuDoubleComplex \* dA, int ldda, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnZCgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, cuDoubleComplex \* dA, int ldda, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnZKgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, cuDoubleComplex \* dA, int ldda, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnZEgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, cuDoubleComplex \* dA, int ldda, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnZYgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, cuDoubleComplex \* dA, int ldda, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnCCgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, cuComplex \* dA, int ldda, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnCKgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, cuComplex \* dA, int ldda, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnCEgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, cuComplex \* dA, int ldda, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnCYgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, cuComplex \* dA, int ldda, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnDDgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, double \* dA, int ldda, double \* dB, int lddb, double \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnDSgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, double \* dA, int ldda, double \* dB, int lddb, double \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnDHgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, double \* dA, int ldda, double \* dB, int lddb, double \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnDBgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, double \* dA, int ldda, double \* dB, int lddb, double \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnDXgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, double \* dA, int ldda, double \* dB, int lddb, double \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnSSgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, float \* dA, int ldda, float \* dB, int lddb, float \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnSHgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, float \* dA, int ldda, float \* dB, int lddb, float \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnSBgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, float \* dA, int ldda, float \* dB, int lddb, float \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); cusolverStatus\_t cusolverDnSXgels\_bufferSize( cusolverHandle\_t handle, int m, int n, int nrhs, float \* dA, int ldda, float \* dB, int lddb, float \* dX, int lddx, void \* dwork, size\_t \* lwork\_bytes); Parameters of cusolverDn gels\_bufferSize() functions Parameter Memory In/out Meaning handle host input Handle to the cusolverDN library context. m host input Number of rows of the matrix A. Should be non-negative and n<=m n host input Number of columns of the matrix A. Should be non-negative and n<=m. nrhs host input Number of right hand sides to solve. Should be non-negative. dA device None Matrix A with size m-by-n. Can be NULL. ldda host input Leading dimension of two-dimensional array used to store matrix A. ldda >= m. dB device None Set of right hand sides B of size m-by-nrhs. Can be NULL. lddb host input Leading dimension of two-dimensional array used to store matrix of right hand sides B. lddb >= max(1,m). dX device None Set of solution vectors X of size n-by-nrhs. Can be NULL. lddx host input Leading dimension of two-dimensional array used to store matrix of solution vectors X. lddx >= max(1,n). dwork device none Pointer to device workspace. Not used and can be NULL. lwork\_bytes host output Pointer to a variable where required size of temporary workspace in bytes will be stored. Can’t be NULL. cusolverStatus\_t cusolverDnZZgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, cuDoubleComplex \* dA, int ldda, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnZCgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, cuDoubleComplex \* dA, int ldda, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnZKgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, cuDoubleComplex \* dA, int ldda, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnZEgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, cuDoubleComplex \* dA, int ldda, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnZYgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, cuDoubleComplex \* dA, int ldda, cuDoubleComplex \* dB, int lddb, cuDoubleComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnCCgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, cuComplex \* dA, int ldda, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnCKgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, cuComplex \* dA, int ldda, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnCEgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, cuComplex \* dA, int ldda, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnCYgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, cuComplex \* dA, int ldda, cuComplex \* dB, int lddb, cuComplex \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnDDgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, double \* dA, int ldda, double \* dB, int lddb, double \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnDSgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, double \* dA, int ldda, double \* dB, int lddb, double \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnDHgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, double \* dA, int ldda, double \* dB, int lddb, double \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnDBgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, double \* dA, int ldda, double \* dB, int lddb, double \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnDXgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, double \* dA, int ldda, double \* dB, int lddb, double \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnSSgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, float \* dA, int ldda, float \* dB, int lddb, float \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnSHgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, float \* dA, int ldda, float \* dB, int lddb, float \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnSBgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, float \* dA, int ldda, float \* dB, int lddb, float \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); cusolverStatus\_t cusolverDnSXgels( cusolverDnHandle\_t handle, int m, int n, int nrhs, float \* dA, int ldda, float \* dB, int lddb, float \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* niter, int \* dinfo); Parameters of cusolverDn gels() functions Parameter Memory In/out Meaning handle host input Handle to the cusolverDN library context. m host input Number of rows of the matrix A. Should be non-negative and n<=m n host input Number of columns of the matrix A. Should be non-negative and n<=m. nrhs host input Number of right hand sides to solve. Should be non-negative. dA device in/out Matrix A with size m-by-n. Can’t be NULL. On return - unchanged if the lowest precision is not equal to the main precision and the iterative refinement solver converged, - garbage otherwise. ldda host input Leading dimension of two-dimensional array used to store matrix A. ldda >= m. dB device input Set of right hand sides B of size m-by-nrhs. Can’t be NULL. lddb host input Leading dimension of two-dimensional array used to store matrix of right hand sides B. lddb >= max(1,m). dX device output Set of solution vectors X of size n-by-nrhs. Can’t be NULL. lddx host input Leading dimension of two-dimensional array used to store matrix of solution vectors X. lddx >= max(1,n). dWorkspace device input Pointer to an allocated workspace in device memory of size lwork\_bytes. lwork\_bytes host input Size of the allocated device workspace. Should be at least what was returned by cusolverDn gels\_bufferSize() function niters host output If iter is <0: iterative refinement has failed, main precision (Inputs/Outputs precision) factorization has been performed. -1: taking into account machine parameters, n, nrhs, it is a priori not worth working in lower precision -2: overflow of an entry when moving from main to lower precision -3: failure during the factorization -5: overflow occurred during computation -50: solver stopped the iterative refinement after reaching maximum allowed iterations. >0: iter is a number of iterations solver performed to reach convergence criteria dinfo device output Status of the IRS solver on the return. If 0 - solve was successful. If dinfo = -i then i-th argument is not valid. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed, for example: n<0 ldda gels() functions, but wrapped in a more generic and expert interface that gives user more control to parametrize the function as well as it provides more information on output. cusolverDnIRSXgels() allows additional control of the solver parameters such as setting: the main precision (Inputs/Outputs precision) of the solver, the lowest precision to be used internally by the solver, the refinement solver type the maximum allowed number of iterations in the refinement phase the tolerance of the refinement solver the fallback to main precision and others through the configuration parameters structure gels\_irs\_params and its helper functions. For more details about what configuration can be set and its meaning please refer to all the functions in the cuSolverDN Helper Function Section that start with cusolverDnIRSParamsxxxx(). Moreover, cusolverDnIRSXgels() provides additional information on the output such as the convergence history (e.g., the residual norms) at each iteration and the number of iterations needed to converge. For more details about what information can be retrieved and its meaning please refer to all the functions in the cuSolverDN Helper Function Section that start with cusolverDnIRSInfosxxxx(). The function returns value describes the results of the solving process. A CUSOLVER\_STATUS\_SUCCESS indicates that the function finished with success otherwise, it indicates if one of the API arguments is incorrect, or if the configurations of params/infos structure is incorrect or if the function did not finish with success. More details about the error can be found by checking the niters and the dinfo API parameters. See their description below for further details. Users should provide the required workspace allocated on device for the cusolverDnIRSXgels() function. The amount of bytes required for the function can be queried by calling the respective function cusolverDnIRSXgels\_bufferSize(). Note that, if the user would like a particular configuration to be set via the params structure, it should be set before the call to cusolverDnIRSXgels\_bufferSize() to get the size of the required workspace. The following table provides all possible combinations values for the lowest precision corresponding to the Inputs/Outputs data type. Note that if the lowest precision matches the Inputs/Outputs datatype, then main precision factorization will be used Tensor Float (TF32), introduced with NVIDIA Ampere Architecture GPUs, is the most robust tensor core accelerated compute mode for the iterative refinement solver. It is able to solve the widest range of problems in HPC arising from different applications and provides up to 4X and 5X speedup for real and complex systems, respectively. On Volta and Turing architecture GPUs, half precision tensor core acceleration is recommended. In cases where the iterative refinement solver fails to converge to the desired accuracy (main precision, INOUT data precision), it is recommended to use main precision as internal lowest precision. Supported Inputs/Outputs data type and lower precision for the IRS solver Inputs/Outputs Data Type (e.g., main precision) Supported values for the lowest precision CUSOLVER\_C\_64F CUSOLVER\_C\_64F, CUSOLVER\_C\_32F, CUSOLVER\_C\_16F, CUSOLVER\_C\_16BF, CUSOLVER\_C\_TF32 CUSOLVER\_C\_32F CUSOLVER\_C\_32F, CUSOLVER\_C\_16F, CUSOLVER\_C\_16BF, CUSOLVER\_C\_TF32 CUSOLVER\_R\_64F CUSOLVER\_R\_64F, CUSOLVER\_R\_32F, CUSOLVER\_R\_16F, CUSOLVER\_R\_16BF, CUSOLVER\_R\_TF32 CUSOLVER\_R\_32F CUSOLVER\_R\_32F, CUSOLVER\_R\_16F, CUSOLVER\_R\_16BF, CUSOLVER\_R\_TF32 The cusolverDnIRSXgels\_bufferSize() function return the required workspace buffer size in bytes for the corresponding cusolverDnXgels() call with given gels\_irs\_params configuration. cusolverStatus\_t cusolverDnIRSXgels\_bufferSize( cusolverDnHandle\_t handle, cusolverDnIRSParams\_t gels\_irs\_params, cusolver\_int\_t m, cusolver\_int\_t n, cusolver\_int\_t nrhs, size\_t \* lwork\_bytes); Parameters of cusolverDnIRSXgels\_bufferSize() functions Parameter Memory In/out Meaning handle host input Handle to the cusolverDn library context. params host input Xgels configuration parameters m host input Number of rows of the matrix A. Should be non-negative and n<=m n host input Number of columns of the matrix A. Should be non-negative and n<=m. nrhs host input Number of right hand sides to solve. Should be non-negative. Note that, nrhs is limited to 1 if the selected IRS refinement solver is CUSOLVER\_IRS\_REFINE\_GMRES, CUSOLVER\_IRS\_REFINE\_GMRES\_GMRES, CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES. lwork\_bytes host out Pointer to a variable, where the required size in bytes, of the workspace will be stored after a call to cusolverDnIRSXgels\_bufferSize. Can’t be NULL. cusolverStatus\_t cusolverDnIRSXgels( cusolverDnHandle\_t handle, cusolverDnIRSParams\_t gels\_irs\_params, cusolverDnIRSInfos\_t gels\_irs\_infos, int m, int n, int nrhs, void \* dA, int ldda, void \* dB, int lddb, void \* dX, int lddx, void \* dWorkspace, size\_t lwork\_bytes, int \* dinfo); Parameters of cusolverDnIRSXgels() functions Parameter Memory In/out Meaning handle host input Handle to the cusolverDn library context. gels\_irs\_params host input Configuration parameters structure, can serve one or more calls to any IRS solver gels\_irs\_infos host in/out Info structure, where information about a particular solve will be stored. The gels\_irs\_infos structure correspond to a particular call. Thus different calls requires different gels\_irs\_infos structure otherwise, it will be overwritten. m host input Number of rows of the matrix A. Should be non-negative and n<=m n host input Number of columns of the matrix A. Should be non-negative and n<=m. nrhs host input Number of right hand sides to solve. Should be non-negative. Note that, nrhs is limited to 1 if the selected IRS refinement solver is CUSOLVER\_IRS\_REFINE\_GMRES, CUSOLVER\_IRS\_REFINE\_GMRES\_GMRES, CUSOLVER\_IRS\_REFINE\_CLASSICAL\_GMRES. dA device in/out Matrix A with size m-by-n. Can’t be NULL. On return - unchanged if the lowest precision is not equal to the main precision and the iterative refinement solver converged, - garbage otherwise. ldda host input Leading dimension of two-dimensional array used to store matrix A. ldda >= m. dB device input Set of right hand sides B of size m-by-nrhs. Can’t be NULL. lddb host input Leading dimension of two-dimensional array used to store matrix of right hand sides B. lddb >= max(1,m). dX device output Set of solution vectors X of size n-by-nrhs. Can’t be NULL. lddx host input Leading dimension of two-dimensional array used to store matrix of solution vectors X. lddx >= max(1,n). dWorkspace device input Pointer to an allocated workspace in device memory of size lwork\_bytes. lwork\_bytes host input Size of the allocated device workspace. Should be at least what was returned by cusolverDnIRSXgels\_bufferSize() function. niters host output If iter is <0: iterative refinement has failed, main precision (Inputs/Outputs precision) factorization has been performed if fallback is enabled -1: taking into account machine parameters, n, nrhs, it is a priori not worth working in lower precision -2: overflow of an entry when moving from main to lower precision -3: failure during the factorization -5: overflow occurred during computation -maxiter: solver stopped the iterative refinement after reaching maximum allowed iterations >0: iter is a number of iterations solver performed to reach convergence criteria dinfo device output Status of the IRS solver on the return. If 0 - solve was successful. If dinfo = -i then i-th argument is not valid. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed, for example: n<0 ldda 1, and refinement solver was set to CUSOLVER\_IRS\_REFINE\_GMRES. CUSOLVER\_STATUS\_IRS\_INFOS\_NOT\_INITIALIZED The information structure gels\_irs\_infos was not created. CUSOLVER\_STATUS\_ALLOC\_FAILED CPU memory allocation failed, most likely during the allocation of the residual array that store the residual norms. 2.4.2.11. cusolverDn ormqr() These helper functions calculate the size of work buffers needed. Please visit cuSOLVER Library Samples - ormqr for a code example. cusolverStatus\_t cusolverDnSormqr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasOperation\_t trans, int m, int n, int k, const float \*A, int lda, const float \*tau, const float \*C, int ldc, int \*lwork); cusolverStatus\_t cusolverDnDormqr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasOperation\_t trans, int m, int n, int k, const double \*A, int lda, const double \*tau, const double \*C, int ldc, int \*lwork); cusolverStatus\_t cusolverDnCunmqr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasOperation\_t trans, int m, int n, int k, const cuComplex \*A, int lda, const cuComplex \*tau, const cuComplex \*C, int ldc, int \*lwork); cusolverStatus\_t cusolverDnZunmqr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasOperation\_t trans, int m, int n, int k, const cuDoubleComplex \*A, int lda, const cuDoubleComplex \*tau, const cuDoubleComplex \*C, int ldc, int \*lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSormqr( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasOperation\_t trans, int m, int n, int k, const float \*A, int lda, const float \*tau, float \*C, int ldc, float \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnDormqr( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasOperation\_t trans, int m, int n, int k, const double \*A, int lda, const double \*tau, double \*C, int ldc, double \*work, int lwork, int \*devInfo); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCunmqr( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasOperation\_t trans, int m, int n, int k, const cuComplex \*A, int lda, const cuComplex \*tau, cuComplex \*C, int ldc, cuComplex \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnZunmqr( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasOperation\_t trans, int m, int n, int k, const cuDoubleComplex \*A, int lda, const cuDoubleComplex \*tau, cuDoubleComplex \*C, int ldc, cuDoubleComplex \*work, int lwork, int \*devInfo); This function overwrites \\(m \\times n\\) matrix C by The operation of Q is defined by Q is a unitary matrix formed by a sequence of elementary reflection vectors from QR factorization (geqrf) of A. Q=H(1)H(2) … H(k) Q is of order m if side = CUBLAS\_SIDE\_LEFT and of order n if side = CUBLAS\_SIDE\_RIGHT. The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by geqrf\_bufferSize() or ormqr\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). The user can combine geqrf, ormqr and trsm to complete a linear solver or a least-square solver. API of ormqr Parameter Memory In/out Meaning handle host input Handle to the cuSolverDn library context. side host input Indicates if matrix Q is on the left or right of C. trans host input Operation op(Q) that is non- or (conj.) transpose. m host input Number of rows of matrix C. n host input Number of columns of matrix C. k host input Number of elementary reflections whose product defines the matrix Q. If side is CUBLAS\_SIDE\_LEFT, m >= k >= 0; if side is CUBLAS\_SIDE\_RIGHT, n >= k >= 0. A device in array of dimension lda \* k with lda is not less than max(1,m). The matrix A is from geqrf, so i-th column contains elementary reflection vector. lda host input Leading dimension of two-dimensional array used to store matrix A. If side is CUBLAS\_SIDE\_LEFT, lda >= max(1,m); if side is CUBLAS\_SIDE\_RIGHT, lda >= max(1,n). tau device input array of dimension k. The vector tau is from geqrf, so tau(i) is the scalar of the i-th elementary reflection vector. C device in/out array of size ldc \* n. On exit, C is overwritten by op(Q)\*C or C\*op(Q). ldc host input Leading dimension of two-dimensional array of matrix C. ldc >= max(1,m). work device in/out Working space, array of size lwork. lwork host input Size of working array work. devInfo device output If devInfo = 0, the ormqr is successful. If devInfo = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n,k<0, k > m if CUBLAS\_SIDE\_LEFT, k > n if CUBLAS\_SIDE\_RIGHT, wrong lda or ldc or invalid trans). CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.4.2.12. cusolverDn orgqr() These helper functions calculate the size of work buffers needed. Please visit cuSOLVER Library Samples - orgqr for a code example. cusolverStatus\_t cusolverDnSorgqr\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int k, const float \*A, int lda, const float \*tau, int \*lwork); cusolverStatus\_t cusolverDnDorgqr\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int k, const double \*A, int lda, const double \*tau, int \*lwork); cusolverStatus\_t cusolverDnCungqr\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int k, const cuComplex \*A, int lda, const cuComplex \*tau, int \*lwork); cusolverStatus\_t cusolverDnZungqr\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int k, const cuDoubleComplex \*A, int lda, const cuDoubleComplex \*tau, int \*lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSorgqr( cusolverDnHandle\_t handle, int m, int n, int k, float \*A, int lda, const float \*tau, float \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnDorgqr( cusolverDnHandle\_t handle, int m, int n, int k, double \*A, int lda, const double \*tau, double \*work, int lwork, int \*devInfo); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCungqr( cusolverDnHandle\_t handle, int m, int n, int k, cuComplex \*A, int lda, const cuComplex \*tau, cuComplex \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnZungqr( cusolverDnHandle\_t handle, int m, int n, int k, cuDoubleComplex \*A, int lda, const cuDoubleComplex \*tau, cuDoubleComplex \*work, int lwork, int \*devInfo); This function overwrites \\(m \\times n\\) matrix A by \\\[Q = {H(1)}\*{H(2)}\*{...}\*{H(k)}\\\] where Q is a unitary matrix formed by a sequence of elementary reflection vectors stored in A. The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by orgqr\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). The user can combine geqrf, orgqr to complete orthogonalization. API of orgqr Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. m host input Number of rows of matrix Q. m >= 0; n host input Number of columns of matrix Q. m >= n >= 0; k host input Number of elementary reflections whose product defines the matrix Q. n >= k >= 0; A device in/out array of dimension lda \* n with lda is not less than max(1,m). i-th column of A contains elementary reflection vector. lda host input Leading dimension of two-dimensional array used to store matrix A. lda >= max(1,m). tau device input array of dimension k. tau(i) is the scalar of i-th elementary reflection vector. work device in/out Working space, array of size lwork. lwork host input Size of working array work. devInfo device output If info = 0, the orgqr is successful. if info = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n,k<0, n>m, k>n or lda sytrf() These helper functions calculate the size of the needed buffers. cusolverStatus\_t cusolverDnSsytrf\_bufferSize(cusolverDnHandle\_t handle, int n, float \*A, int lda, int \*lwork ); cusolverStatus\_t cusolverDnDsytrf\_bufferSize(cusolverDnHandle\_t handle, int n, double \*A, int lda, int \*lwork ); cusolverStatus\_t cusolverDnCsytrf\_bufferSize(cusolverDnHandle\_t handle, int n, cuComplex \*A, int lda, int \*lwork ); cusolverStatus\_t cusolverDnZsytrf\_bufferSize(cusolverDnHandle\_t handle, int n, cuDoubleComplex \*A, int lda, int \*lwork ); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSsytrf(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, float \*A, int lda, int \*devIpiv, float \*work, int lwork, int \*devInfo ); cusolverStatus\_t cusolverDnDsytrf(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, double \*A, int lda, int \*devIpiv, double \*work, int lwork, int \*devInfo ); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCsytrf(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, int \*devIpiv, cuComplex \*work, int lwork, int \*devInfo ); cusolverStatus\_t cusolverDnZsytrf(cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, int \*devIpiv, cuDoubleComplex \*work, int lwork, int \*devInfo ); This function computes the factorization of a symmetric indefinite matrix using the Bunch-Kaufman diagonal pivoting. A is a \\(n \\times n\\) symmetric matrix, only lower or upper part is meaningful. The input parameter uplo indicates which part of the matrix is used. If devIpiv is null, no pivoting is performed, which is not numerically stable. If input parameter uplo is CUBLAS\_FILL\_MODE\_LOWER, only lower triangular part of A is processed, and replaced by lower triangular factor L and block diagonal matrix D. Each block of D is either 1x1 or 2x2 block, depending on pivoting. \\\[P\*A\*P^{T} = L\*D\*L^{T}\\\] If input parameter uplo is CUBLAS\_FILL\_MODE\_UPPER, only upper triangular part of A is processed, and replaced by upper triangular factor U and block diagonal matrix D. \\\[P\*A\*P^{T} = U\*D\*U^{T}\\\] The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by sytrf\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. When no pivoting is performed, the other triangular part of the input matrix A is used as workspace. If Bunch-Kaufman factorization failed, i.e. A is singular. The output parameter devInfo = i would indicate D(i,i)=0. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). The output parameter devIpiv contains pivoting sequence. If devIpiv(i) = k > 0, D(i,i) is 1x1 block, and i-th row/column of A is interchanged with k-th row/column of A. If uplo is CUBLAS\_FILL\_MODE\_UPPER and devIpiv(i-1) = devIpiv(i) = -m < 0, D(i-1:i,i-1:i) is a 2x2 block, and (i-1)-th row/column is interchanged with m-th row/column. If uplo is CUBLAS\_FILL\_MODE\_LOWER and devIpiv(i+1) = devIpiv(i) = -m < 0, D(i:i+1,i:i+1) is a 2x2 block, and (i+1)-th row/column is interchanged with m-th row/column. API of sytrf Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. uplo host input Indicates if matrix A lower or upper part is stored, the other part is not referenced. n host input Number of rows and columns of matrix A. A device in/out array of dimension lda \* n with lda is not less than max(1,n). lda host input Leading dimension of two-dimensional array used to store matrix A. devIpiv device output Array of size at least n, containing pivot indices. To perform no pivoting, set the argument NULL. work device in/out Working space, array of size lwork. lwork host input Size of working space work. devInfo device output If devInfo = 0, the LU factorization is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). if devInfo = i, the D(i,i) = 0. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0 or lda potrfBatched() The S and D data types are real valued single and double precision, respectively. Please visit cuSOLVER Library Samples - potrfBatched for a code example. cusolverStatus\_t cusolverDnSpotrfBatched( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, float \*Aarray\[\], int lda, int \*infoArray, int batchSize); cusolverStatus\_t cusolverDnDpotrfBatched( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, double \*Aarray\[\], int lda, int \*infoArray, int batchSize); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCpotrfBatched( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuComplex \*Aarray\[\], int lda, int \*infoArray, int batchSize); cusolverStatus\_t cusolverDnZpotrfBatched( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuDoubleComplex \*Aarray\[\], int lda, int \*infoArray, int batchSize); This function computes the Cholesky factorization of a sequence of Hermitian positive-definite matrices. Each Aarray\[i\] for i=0,1,..., batchSize-1 is a \\(n \\times n\\) Hermitian matrix, only lower or upper part is meaningful. The input parameter uplo indicates which part of the matrix is used. If input parameter uplo is CUBLAS\_FILL\_MODE\_LOWER, only lower triangular part of A is processed, and replaced by lower triangular Cholesky factor L. \\\[A = L\*L^{H}\\\] If input parameter uplo is CUBLAS\_FILL\_MODE\_UPPER, only upper triangular part of A is processed, and replaced by upper triangular Cholesky factor U. \\\[A = U^{H}\*U\\\] If Cholesky factorization failed, i.e. some leading minor of A is not positive definite, or equivalently some diagonal elements of L or U is not a real number. The output parameter infoArray would indicate smallest leading minor of A which is not positive definite. infoArray is an integer array of size batchsize. If potrfBatched returns CUSOLVER\_STATUS\_INVALID\_VALUE, infoArray\[0\] = -i (less than zero), meaning that the i-th parameter is wrong (not counting handle). If potrfBatched returns CUSOLVER\_STATUS\_SUCCESS but infoArray\[i\] = k is positive, then i-th matrix is not positive definite and the Cholesky factorization failed at row k. Remark: the other part of A is used as a workspace. For example, if uplo is CUBLAS\_FILL\_MODE\_UPPER, upper triangle of A contains Cholesky factor U and lower triangle of A is destroyed after potrfBatched. API of potrfBatched Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. uplo host input Indicates if lower or upper part is stored; the other part is used as a workspace. n host input Number of rows and columns of matrix A. Aarray device in/out Array of pointers to array of dimension lda \* n with lda is not less than max(1,n). lda host input Leading dimension of two-dimensional array used to store each matrix Aarray\[i\]. infoArray device output Array of size batchSize. infoArray\[i\] contains information of factorization of Aarray\[i\]. if potrfBatched returns CUSOLVER\_STATUS\_INVALID\_VALUE, infoArray\[0\] = -i (less than zero) means the i-th parameter is wrong (not counting handle). if potrfBatched returns CUSOLVER\_STATUS\_SUCCESS, infoArray\[i\] = 0 means the Cholesky factorization of i-th matrix is successful, and infoArray\[i\] = k means the leading submatrix of order k of i-th matrix is not positive definite. batchSize host input Number of pointers in Aarray. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0 or lda potrsBatched() cusolverStatus\_t cusolverDnSpotrsBatched( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, int nrhs, float \*Aarray\[\], int lda, float \*Barray\[\], int ldb, int \*info, int batchSize); cusolverStatus\_t cusolverDnDpotrsBatched( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, int nrhs, double \*Aarray\[\], int lda, double \*Barray\[\], int ldb, int \*info, int batchSize); cusolverStatus\_t cusolverDnCpotrsBatched( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, int nrhs, cuComplex \*Aarray\[\], int lda, cuComplex \*Barray\[\], int ldb, int \*info, int batchSize); cusolverStatus\_t cusolverDnZpotrsBatched( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, int nrhs, cuDoubleComplex \*Aarray\[\], int lda, cuDoubleComplex \*Barray\[\], int ldb, int \*info, int batchSize); This function solves a sequence of linear systems \\\[{A\\lbrack i\\rbrack}\*{X\\lbrack i\\rbrack} = {B\\lbrack i\\rbrack}\\\] where each Aarray\[i\] for i=0,1,..., batchSize-1 is a \\(n \\times n\\) Hermitian matrix, only lower or upper part is meaningful. The input parameter uplo indicates which part of the matrix is used. The user has to call potrfBatched first to factorize matrix Aarray\[i\]. If input parameter uplo is CUBLAS\_FILL\_MODE\_LOWER, A is lower triangular Cholesky factor L corresponding to \\(A = L\*L^{H}\\). If input parameter uplo is CUBLAS\_FILL\_MODE\_UPPER, A is upper triangular Cholesky factor U corresponding to \\(A = U^{H}\*U\\). The operation is in-place, i.e. matrix X overwrites matrix B with the same leading dimension ldb. The output parameter info is a scalar. If info = -i (less than zero), the i-th parameter is wrong (not counting handle). Remark 1: only nrhs=1 is supported. Remark 2: infoArray from potrfBatched indicates if the matrix is positive definite. info from potrsBatched only shows which input parameter is wrong (not counting handle). Remark 3: the other part of A is used as a workspace. For example, if uplo is CUBLAS\_FILL\_MODE\_UPPER, upper triangle of A contains Cholesky factor U and lower triangle of A is destroyed after potrsBatched. Please visit cuSOLVER Library Samples - potrfBatched for a code example. API of potrsBatched Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. uplo host input Indicates if matrix A lower or upper part is stored. n host input Number of rows and columns of matrix A. nrhs host input Number of columns of matrix X and B. Aarray device in/out Array of pointers to array of dimension lda \* n with lda is not less than max(1,n). Aarray\[i\] is either lower Cholesky factor L or upper Cholesky factor U. lda host input Leading dimension of two-dimensional array used to store each matrix Aarray\[i\]. Barray device in/out Array of pointers to array of dimension ldb \* nrhs. ldb is not less than max(1,n). As an input, Barray\[i\] is right hand side matrix. As an output, Barray\[i\] is the solution matrix. ldb host input Leading dimension of two-dimensional array used to store each matrix Barray\[i\]. info device output If info = 0, all parameters are correct. if info = -i, the i-th parameter is wrong (not counting handle). batchSize host input Number of pointers in Aarray. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, nrhs<0, lda gebrd() These helper functions calculate the size of work buffers needed. cusolverStatus\_t cusolverDnSgebrd\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int \*Lwork ); cusolverStatus\_t cusolverDnDgebrd\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int \*Lwork ); cusolverStatus\_t cusolverDnCgebrd\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int \*Lwork ); cusolverStatus\_t cusolverDnZgebrd\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int \*Lwork ); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSgebrd(cusolverDnHandle\_t handle, int m, int n, float \*A, int lda, float \*D, float \*E, float \*TAUQ, float \*TAUP, float \*Work, int Lwork, int \*devInfo ); cusolverStatus\_t cusolverDnDgebrd(cusolverDnHandle\_t handle, int m, int n, double \*A, int lda, double \*D, double \*E, double \*TAUQ, double \*TAUP, double \*Work, int Lwork, int \*devInfo ); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCgebrd(cusolverDnHandle\_t handle, int m, int n, cuComplex \*A, int lda, float \*D, float \*E, cuComplex \*TAUQ, cuComplex \*TAUP, cuComplex \*Work, int Lwork, int \*devInfo ); cusolverStatus\_t cusolverDnZgebrd(cusolverDnHandle\_t handle, int m, int n, cuDoubleComplex \*A, int lda, double \*D, double \*E, cuDoubleComplex \*TAUQ, cuDoubleComplex \*TAUP, cuDoubleComplex \*Work, int Lwork, int \*devInfo ); This function reduces a general \\(m \\times n\\) matrix A to a real upper or lower bidiagonal form B by an orthogonal transformation: \\(Q^{H}\*A\*P = B\\) If m>=n, B is upper bidiagonal; if m \=n, the diagonal and the first superdiagonal are overwritten with the upper bidiagonal matrix B; the elements below the diagonal, with the array TAUQ, represent the orthogonal matrix Q as a product of elementary reflectors, and the elements above the first superdiagonal, with the array TAUP, represent the orthogonal matrix P as a product of elementary reflectors. if m \=n. API of gebrd Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. m host input Number of rows of matrix A. n host input Number of columns of matrix A. A device in/out array of dimension lda \* n with lda is not less than max(1,n). lda host input Leading dimension of two-dimensional array used to store matrix A. D device output Real array of dimension min(m,n). The diagonal elements of the bidiagonal matrix B: D(i) = A(i,i). E device output Real array of dimension min(m,n). The off-diagonal elements of the bidiagonal matrix B: if m>=n, E(i) = A(i,i+1) for i = 1,2,...,n-1; if m array of dimension min(m,n). The scalar factors of the elementary reflectors which represent the orthogonal matrix Q. TAUP device output array of dimension min(m,n). The scalar factors of the elementary reflectors which represent the orthogonal matrix P. Work device in/out Working space, array of size Lwork. Lwork host input Size of Work, returned by gebrd\_bufferSize. devInfo device output If devInfo = 0, the operation is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0, or lda orgbr() These helper functions calculate the size of work buffers needed. cusolverStatus\_t cusolverDnSorgbr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, int m, int n, int k, const float \*A, int lda, const float \*tau, int \*lwork); cusolverStatus\_t cusolverDnDorgbr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, int m, int n, int k, const double \*A, int lda, const double \*tau, int \*lwork); cusolverStatus\_t cusolverDnCungbr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, int m, int n, int k, const cuComplex \*A, int lda, const cuComplex \*tau, int \*lwork); cusolverStatus\_t cusolverDnZungbr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, int m, int n, int k, const cuDoubleComplex \*A, int lda, const cuDoubleComplex \*tau, int \*lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSorgbr( cusolverDnHandle\_t handle, cublasSideMode\_t side, int m, int n, int k, float \*A, int lda, const float \*tau, float \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnDorgbr( cusolverDnHandle\_t handle, cublasSideMode\_t side, int m, int n, int k, double \*A, int lda, const double \*tau, double \*work, int lwork, int \*devInfo); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCungbr( cusolverDnHandle\_t handle, cublasSideMode\_t side, int m, int n, int k, cuComplex \*A, int lda, const cuComplex \*tau, cuComplex \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnZungbr( cusolverDnHandle\_t handle, cublasSideMode\_t side, int m, int n, int k, cuDoubleComplex \*A, int lda, const cuDoubleComplex \*tau, cuDoubleComplex \*work, int lwork, int \*devInfo); This function generates one of the unitary matrices Q or P\*\*H determined by gebrd when reducing a matrix A to bidiagonal form: \\(Q^{H}\*A\*P = B\\) Q and P\*\*H are defined as products of elementary reflectors H(i) or G(i) respectively. The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by orgbr\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). API of orgbr Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. side host input If side = CUBLAS\_SIDE\_LEFT, generate Q. if side = CUBLAS\_SIDE\_RIGHT, generate P\*\*T. m host input Number of rows of matrix Q or P\*\*T. n host input If side = CUBLAS\_SIDE\_LEFT, m>= n>= min(m,k). if side = CUBLAS\_SIDE\_RIGHT, n>= m>= min(n,k). k host input If side = CUBLAS\_SIDE\_LEFT, the number of columns in the original m-by-k matrix reduced by gebrd. if side = CUBLAS\_SIDE\_RIGHT, the number of rows in the original k-by-n matrix reduced by gebrd. A device in/out array of dimension lda \* n On entry, the vectors which define the elementary reflectors, as returned by gebrd. On exit, the m-by-n matrix Q or P\*\*T. lda host input Leading dimension of two-dimensional array used to store matrix A. lda >= max(1,m); tau device input array of dimension min(m,k) if side is CUBLAS\_SIDE\_LEFT; of dimension min(n,k) if side is CUBLAS\_SIDE\_RIGHT; tau(i) must contain the scalar factor of the elementary reflector H(i) or G(i), which determines Q or P\*\*T, as returned by gebrd in its array argument TAUQ or TAUP. work device in/out Working space, array of size lwork. lwork host input Size of working array work. devInfo device output If info = 0, the ormqr is successful. if info = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or wrong lda ). CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.4.3.3. cusolverDn sytrd() These helper functions calculate the size of work buffers needed. cusolverStatus\_t cusolverDnSsytrd\_bufferSize( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, const float \*A, int lda, const float \*d, const float \*e, const float \*tau, int \*lwork); cusolverStatus\_t cusolverDnDsytrd\_bufferSize( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, const double \*A, int lda, const double \*d, const double \*e, const double \*tau, int \*lwork); cusolverStatus\_t cusolverDnChetrd\_bufferSize( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, const cuComplex \*A, int lda, const float \*d, const float \*e, const cuComplex \*tau, int \*lwork); cusolverStatus\_t cusolverDnZhetrd\_bufferSize( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, const cuDoubleComplex \*A, int lda, const double \*d, const double \*e, const cuDoubleComplex \*tau, int \*lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSsytrd( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, float \*A, int lda, float \*d, float \*e, float \*tau, float \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnDsytrd( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, double \*A, int lda, double \*d, double \*e, double \*tau, double \*work, int lwork, int \*devInfo); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnChetrd( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, float \*d, float \*e, cuComplex \*tau, cuComplex \*work, int lwork, int \*devInfo); cusolverStatus\_t CUDENSEAPI cusolverDnZhetrd( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, double \*d, double \*e, cuDoubleComplex \*tau, cuDoubleComplex \*work, int lwork, int \*devInfo); This function reduces a general symmetric (Hermitian) \\(n \\times n\\) matrix A to real symmetric tridiagonal form T by an orthogonal transformation: \\(Q^{H}\*A\*Q = T\\) As an output, A contains T and householder reflection vectors. If uplo = CUBLAS\_FILL\_MODE\_UPPER, the diagonal and first superdiagonal of A are overwritten by the corresponding elements of the tridiagonal matrix T, and the elements above the first superdiagonal, with the array tau, represent the orthogonal matrix Q as a product of elementary reflectors; If uplo = CUBLAS\_FILL\_MODE\_LOWER, the diagonal and first subdiagonal of A are overwritten by the corresponding elements of the tridiagonal matrix T, and the elements below the first subdiagonal, with the array tau, represent the orthogonal matrix Q as a product of elementary reflectors. The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by sytrd\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). Note that the problem size n is limited by a condition n\*lda < INT32\_MAX primarily due to the current implementation constraints. API of sytrd Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. uplo host input Specifies which part of A is stored. uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of A is stored. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of A is stored. n host input Number of rows (columns) of matrix A. A device in/out array of dimension lda \* n with lda is not less than max(1,n). If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced. On exit, A is overwritten by T and householder reflection vectors. lda host input Leading dimension of two-dimensional array used to store matrix A. lda >= max(1,n). D device output Real array of dimension n. The diagonal elements of the tridiagonal matrix T: D(i) = A(i,i). E device output Real array of dimension (n-1). The off-diagonal elements of the tridiagonal matrix T: if uplo = CUBLAS\_FILL\_MODE\_UPPER, E(i) = A(i,i+1). if uplo = CUBLAS\_FILL\_MODE\_LOWERE(i) = A(i+1,i). tau device output array of dimension (n-1). The scalar factors of the elementary reflectors which represent the orthogonal matrix Q. work device in/out Working space, array of size lwork. lwork host input Size of work, returned by sytrd\_bufferSize. devInfo device output If devInfo = 0, the operation is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, or lda ormtr() These helper functions calculate the size of work buffers needed. cusolverStatus\_t cusolverDnSormtr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasFillMode\_t uplo, cublasOperation\_t trans, int m, int n, const float \*A, int lda, const float \*tau, const float \*C, int ldc, int \*lwork); cusolverStatus\_t cusolverDnDormtr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasFillMode\_t uplo, cublasOperation\_t trans, int m, int n, const double \*A, int lda, const double \*tau, const double \*C, int ldc, int \*lwork); cusolverStatus\_t cusolverDnCunmtr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasFillMode\_t uplo, cublasOperation\_t trans, int m, int n, const cuComplex \*A, int lda, const cuComplex \*tau, const cuComplex \*C, int ldc, int \*lwork); cusolverStatus\_t cusolverDnZunmtr\_bufferSize( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasFillMode\_t uplo, cublasOperation\_t trans, int m, int n, const cuDoubleComplex \*A, int lda, const cuDoubleComplex \*tau, const cuDoubleComplex \*C, int ldc, int \*lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSormtr( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasFillMode\_t uplo, cublasOperation\_t trans, int m, int n, float \*A, int lda, float \*tau, float \*C, int ldc, float \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnDormtr( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasFillMode\_t uplo, cublasOperation\_t trans, int m, int n, double \*A, int lda, double \*tau, double \*C, int ldc, double \*work, int lwork, int \*devInfo); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCunmtr( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasFillMode\_t uplo, cublasOperation\_t trans, int m, int n, cuComplex \*A, int lda, cuComplex \*tau, cuComplex \*C, int ldc, cuComplex \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnZunmtr( cusolverDnHandle\_t handle, cublasSideMode\_t side, cublasFillMode\_t uplo, cublasOperation\_t trans, int m, int n, cuDoubleComplex \*A, int lda, cuDoubleComplex \*tau, cuDoubleComplex \*C, int ldc, cuDoubleComplex \*work, int lwork, int \*devInfo); This function overwrites \\(m \\times n\\) matrix C by where Q is a unitary matrix formed by a sequence of elementary reflection vectors from sytrd. The operation on Q is defined by The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by ormtr\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). API of ormtr Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. side host input side = CUBLAS\_SIDE\_LEFT, apply Q or Q\*\*T from the Left; side = CUBLAS\_SIDE\_RIGHT, apply Q or Q\*\*T from the Right. uplo host input uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of A contains elementary reflectors from sytrd. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of A contains elementary reflectors from sytrd. trans host input Operation op(Q) that is non- or (conj.) transpose. m host input Number of rows of matrix C. n host input Number of columns of matrix C. A device in/out array of dimension lda \* m if side = CUBLAS\_SIDE\_LEFT; lda \* n if side = CUBLAS\_SIDE\_RIGHT. The matrix A from sytrd contains the elementary reflectors. lda host input Leading dimension of two-dimensional array used to store matrix A. if side is CUBLAS\_SIDE\_LEFT, lda >= max(1,m); if side is CUBLAS\_SIDE\_RIGHT, lda >= max(1,n). tau device output array of dimension (m-1) if side is CUBLAS\_SIDE\_LEFT; of dimension (n-1) if side is CUBLAS\_SIDE\_RIGHT; The vector tau is from sytrd, so tau(i) is the scalar of i-th elementary reflection vector. C device in/out array of size ldc \* n. On exit, C is overwritten by op(Q)\*C or C\*op(Q). ldc host input Leading dimension of two-dimensional array of matrix C. ldc >= max(1,m). work device in/out Working space, array of size lwork. lwork host input Size of working array work. devInfo device output If devInfo = 0, the ormqr is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or wrong lda or ldc). CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.4.3.5. cusolverDn orgtr() These helper functions calculate the size of work buffers needed. cusolverStatus\_t cusolverDnSorgtr\_bufferSize( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, const float \*A, int lda, const float \*tau, int \*lwork); cusolverStatus\_t cusolverDnDorgtr\_bufferSize( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, const double \*A, int lda, const double \*tau, int \*lwork); cusolverStatus\_t cusolverDnCungtr\_bufferSize( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, const cuComplex \*A, int lda, const cuComplex \*tau, int \*lwork); cusolverStatus\_t cusolverDnZungtr\_bufferSize( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, const cuDoubleComplex \*A, int lda, const cuDoubleComplex \*tau, int \*lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSorgtr( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, float \*A, int lda, const float \*tau, float \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnDorgtr( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, double \*A, int lda, const double \*tau, double \*work, int lwork, int \*devInfo); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCungtr( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, const cuComplex \*tau, cuComplex \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnZungtr( cusolverDnHandle\_t handle, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, const cuDoubleComplex \*tau, cuDoubleComplex \*work, int lwork, int \*devInfo); This function generates a unitary matrix Q which is defined as the product of n-1 elementary reflectors of order n, as returned by sytrd: The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by orgtr\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). API of orgtr Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. uplo host input uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of A contains elementary reflectors from sytrd. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of A contains elementary reflectors from sytrd. n host input Number of rows (columns) of matrix Q. A device in/out array of dimension lda \* n On entry, matrix A from sytrd contains the elementary reflectors. On exit, matrix A contains the n-by-n orthogonal matrix Q. lda host input Leading dimension of two-dimensional array used to store matrix A. lda >= max(1,n). tau device input array of dimension (n-1)tau(i) is the scalar of i-th elementary reflection vector. work device in/out Working space, array of size lwork. lwork host input Size of working array work. devInfo device output If devInfo = 0, the orgtr is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0 or wrong lda). CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.4.3.6. cusolverDn gesvd() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnSgesvd\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int \*lwork ); cusolverStatus\_t cusolverDnDgesvd\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int \*lwork ); cusolverStatus\_t cusolverDnCgesvd\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int \*lwork ); cusolverStatus\_t cusolverDnZgesvd\_bufferSize( cusolverDnHandle\_t handle, int m, int n, int \*lwork ); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSgesvd ( cusolverDnHandle\_t handle, signed char jobu, signed char jobvt, int m, int n, float \*A, int lda, float \*S, float \*U, int ldu, float \*VT, int ldvt, float \*work, int lwork, float \*rwork, int \*devInfo); cusolverStatus\_t cusolverDnDgesvd ( cusolverDnHandle\_t handle, signed char jobu, signed char jobvt, int m, int n, double \*A, int lda, double \*S, double \*U, int ldu, double \*VT, int ldvt, double \*work, int lwork, double \*rwork, int \*devInfo); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCgesvd ( cusolverDnHandle\_t handle, signed char jobu, signed char jobvt, int m, int n, cuComplex \*A, int lda, float \*S, cuComplex \*U, int ldu, cuComplex \*VT, int ldvt, cuComplex \*work, int lwork, float \*rwork, int \*devInfo); cusolverStatus\_t cusolverDnZgesvd ( cusolverDnHandle\_t handle, signed char jobu, signed char jobvt, int m, int n, cuDoubleComplex \*A, int lda, double \*S, cuDoubleComplex \*U, int ldu, cuDoubleComplex \*VT, int ldvt, cuDoubleComplex \*work, int lwork, double \*rwork, int \*devInfo); This function computes the singular value decomposition (SVD) of an \\(m \\times n\\) matrix A and corresponding the left and/or right singular vectors. The SVD is written \\\[A = U\*\\Sigma\*V^{H}\\\] where Σ is an \\(m \\times n\\) matrix which is zero except for its min(m,n) diagonal elements, U is an \\(m \\times m\\) unitary matrix, and V is an \\(n \\times n\\) unitary matrix. The diagonal elements of Σ are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and V are the left and right singular vectors of A. The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by gesvd\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). if bdsqr did not converge, devInfo specifies how many superdiagonals of an intermediate bidiagonal form did not converge to zero. The rwork is real array of dimension (min(m,n)-1). If devInfo>0 and rwork is not NULL, rwork contains the unconverged superdiagonal elements of an upper bidiagonal matrix. This is slightly different from LAPACK which puts unconverged superdiagonal elements in work if type is real; in rwork if type is complex. rwork can be a NULL pointer if the user does not want the information from superdiagonal. Please visit cuSOLVER Library Samples - gesvd for a code example. Remark 1: gesvd only supports m>=n. Remark 2: the routine returns \\(V^{H}\\), not V. API of gesvd Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. jobu host input Specifies options for computing all or part of the matrix U: = ‘A’: all m columns of U are returned in array U: = ‘S’: the first min(m,n) columns of U (the left singular vectors) are returned in the array U; = ‘O’: the first min(m,n) columns of U (the left singular vectors) are overwritten on the array A; = ‘N’: no columns of U (no left singular vectors) are computed. jobvt host input Specifies options for computing all or part of the matrix V\*\*T: = ‘A’: all N rows of V\*\*T are returned in the array VT; = ‘S’: the first min(m,n) rows of V\*\*T (the right singular vectors) are returned in the array VT; = ‘O’: the first min(m,n) rows of V\*\*T (the right singular vectors) are overwritten on the array A; = ‘N’: no rows of V\*\*T (no right singular vectors) are computed. m host input Number of rows of matrix A. n host input Number of columns of matrix A. A device in/out array of dimension lda \* n with lda is not less than max(1,m). On exit, the contents of A are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix A. S device output Real array of dimension min(m,n). The singular values of A, sorted so that S(i) >= S(i+1). U device output array of dimension ldu \* m with ldu is not less than max(1,m). U contains the \\(m \\times m\\) unitary matrix U. ldu host input Leading dimension of two-dimensional array used to store matrix U. VT device output array of dimension ldvt \* n with ldvt is not less than max(1,n). VT contains the \\(n \\times n\\) unitary matrix V\*\*T. ldvt host input Leading dimension of two-dimensional array used to store matrix Vt. work device in/out Working space, array of size lwork. lwork host input Size of work, returned by gesvd\_bufferSize. rwork device input Real array of dimension min(m,n)-1. It contains the unconverged superdiagonal elements of an upper bidiagonal matrix if devInfo > 0. devInfo device output If devInfo = 0, the operation is successful. if devInfo = -i, the i-th parameter is wrong (not counting handle). If devInfo > 0, devInfo indicates how many superdiagonals of an intermediate bidiagonal form did not converge to zero. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or lda gesvdj() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnSgesvdj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int econ, int m, int n, const float \*A, int lda, const float \*S, const float \*U, int ldu, const float \*V, int ldv, int \*lwork, gesvdjInfo\_t params); cusolverStatus\_t cusolverDnDgesvdj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int econ, int m, int n, const double \*A, int lda, const double \*S, const double \*U, int ldu, const double \*V, int ldv, int \*lwork, gesvdjInfo\_t params); cusolverStatus\_t cusolverDnCgesvdj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int econ, int m, int n, const cuComplex \*A, int lda, const float \*S, const cuComplex \*U, int ldu, const cuComplex \*V, int ldv, int \*lwork, gesvdjInfo\_t params); cusolverStatus\_t cusolverDnZgesvdj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int econ, int m, int n, const cuDoubleComplex \*A, int lda, const double \*S, const cuDoubleComplex \*U, int ldu, const cuDoubleComplex \*V, int ldv, int \*lwork, gesvdjInfo\_t params); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSgesvdj( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int econ, int m, int n, float \*A, int lda, float \*S, float \*U, int ldu, float \*V, int ldv, float \*work, int lwork, int \*info, gesvdjInfo\_t params); cusolverStatus\_t cusolverDnDgesvdj( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int econ, int m, int n, double \*A, int lda, double \*S, double \*U, int ldu, double \*V, int ldv, double \*work, int lwork, int \*info, gesvdjInfo\_t params); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCgesvdj( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int econ, int m, int n, cuComplex \*A, int lda, float \*S, cuComplex \*U, int ldu, cuComplex \*V, int ldv, cuComplex \*work, int lwork, int \*info, gesvdjInfo\_t params); cusolverStatus\_t cusolverDnZgesvdj( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int econ, int m, int n, cuDoubleComplex \*A, int lda, double \*S, cuDoubleComplex \*U, int ldu, cuDoubleComplex \*V, int ldv, cuDoubleComplex \*work, int lwork, int \*info, gesvdjInfo\_t params); This function computes the singular value decomposition (SVD) of an \\(m \\times n\\) matrix A and corresponding the left and/or right singular vectors. The SVD is written: \\\[A = U\*\\Sigma\*V^{H}\\\] where Σ is an \\(m \\times n\\) matrix which is zero except for its min(m,n) diagonal elements, U is an \\(m \\times m\\) unitary matrix, and V is an \\(n \\times n\\) unitary matrix. The diagonal elements of Σ are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and V are the left and right singular vectors of A. gesvdj has the same functionality as gesvd. The difference is that gesvd uses QR algorithm and gesvdj uses Jacobi method. The parallelism of Jacobi method gives GPU better performance on small and medium size matrices. Moreover the user can configure gesvdj to perform approximation up to certain accuracy. gesvdj iteratively generates a sequence of unitary matrices to transform matrix A to the following form \\\[U^{H}\*A\*V = S + E\\\] where S is diagonal and diagonal of E is zero. During the iterations, the Frobenius norm of E decreases monotonically. As E goes down to zero, S is the set of singular values. In practice, Jacobi method stops if \\\[{\\|E\\|}\_{F}\\leq\\operatorname{eps}\*{\\|A\\|}\_{F}\\\] where eps is given tolerance. Note that if the real residual norm \\\[{\\|{S} - {U}^{H}\*{A}\*{V}\\|}\_{F}\\\] is computed, it will differ from \\({\\|{E}\\|}\_{F}\\) up to roundoff errors of order \\(N = max(m, n)\\), to still have the standard SVD accuracy expectation \\\[\\frac{\\|S - U^{H} \* A \* V\\|\_F}{O(N) \* \\|A\\|\_F} \\leq \\frac{\\|E\\|\_F}{\\|A\\|\_F} \\leq \\operatorname{eps}\\\] \\(O(N)\\) is typically \\(N\\), but the constant depends on the number of sweeps, which gives an upper roundoff error bound of \\(sweeps \* N\\). gesvdj has two parameters to control the accuracy. First parameter is tolerance (eps). The default value is machine accuracy but The user can use function cusolverDnXgesvdjSetTolerance to set a priori tolerance. The second parameter is maximum number of sweeps which controls number of iterations of Jacobi method. The default value is 100 but the user can use function cusolverDnXgesvdjSetMaxSweeps to set a proper bound. The experiments show 15 sweeps are good enough to converge to machine accuracy. gesvdj stops either tolerance is met or maximum number of sweeps is met. Jacobi method has quadratic convergence, so the accuracy is not proportional to number of sweeps. To guarantee certain accuracy, the user should configure tolerance only. The user has to provide working space which is pointed by input parameter work. The input parameter lwork is the size of the working space, and it is returned by gesvdj\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle). If info = min(m,n)+1, gesvdj does not converge under given tolerance and maximum sweeps. If the user sets an improper tolerance, gesvdj may not converge. For example, tolerance should not be smaller than machine accuracy. Please visit cuSOLVER Library Samples - gesvdj for a code example. Remark 1: gesvdj supports any combination of m and n. Remark 2: the routine returns V, not \\(V^{H}\\). This is different from gesvd. API of gesvdj Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. jobz host input Specifies options to either compute singular value only or singular vectors as well: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute singular values only; jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute singular values and singular vectors. econ host input econ = 1 for economy size for U and V. m host input Number of rows of matrix A. n host input Number of columns of matrix A. A device in/out array of dimension lda \* n with lda is not less than max(1,m). On exit, the contents of A are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix A. S device output Real array of dimension min(m,n). The singular values of A, sorted so that S(i) >= S(i+1). U device output array of dimension ldu \* m if econ is zero. If econ is nonzero, the dimension is ldu \* min(m,n). U contains the left singular vectors. ldu host input Leading dimension of two-dimensional array used to store matrix U. ldu is not less than max(1,m). V device output array of dimension ldv \* n if econ is zero. If econ is nonzero, the dimension is ldv \* min(m,n). V contains the right singular vectors. ldv host input Leading dimension of two-dimensional array used to store matrix V. ldv is not less than max(1,n). work device in/out array of size lwork, working space. lwork host input Size of work, returned by gesvdj\_bufferSize. info device output If info = 0, the operation is successful. if info = -i, the i-th parameter is wrong (not counting handle). if info = min(m,n)+1, gesvdj dose not converge under given tolerance and maximum sweeps. params host input Structure filled with parameters of Jacobi algorithm and results of gesvdj. params can be destroyed after the host thread exits the routine. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or lda gesvdjBatched() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnSgesvdjBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int m, int n, const float \*A, int lda, const float \*S, const float \*U, int ldu, const float \*V, int ldv, int \*lwork, gesvdjInfo\_t params, int batchSize); cusolverStatus\_t cusolverDnDgesvdjBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int m, int n, const double \*A, int lda, const double \*S, const double \*U, int ldu, const double \*V, int ldv, int \*lwork, gesvdjInfo\_t params, int batchSize); cusolverStatus\_t cusolverDnCgesvdjBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int m, int n, const cuComplex \*A, int lda, const float \*S, const cuComplex \*U, int ldu, const cuComplex \*V, int ldv, int \*lwork, gesvdjInfo\_t params, int batchSize); cusolverStatus\_t cusolverDnZgesvdjBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int m, int n, const cuDoubleComplex \*A, int lda, const double \*S, const cuDoubleComplex \*U, int ldu, const cuDoubleComplex \*V, int ldv, int \*lwork, gesvdjInfo\_t params, int batchSize); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSgesvdjBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int m, int n, float \*A, int lda, float \*S, float \*U, int ldu, float \*V, int ldv, float \*work, int lwork, int \*info, gesvdjInfo\_t params, int batchSize); cusolverStatus\_t cusolverDnDgesvdjBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int m, int n, double \*A, int lda, double \*S, double \*U, int ldu, double \*V, int ldv, double \*work, int lwork, int \*info, gesvdjInfo\_t params, int batchSize); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCgesvdjBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int m, int n, cuComplex \*A, int lda, float \*S, cuComplex \*U, int ldu, cuComplex \*V, int ldv, cuComplex \*work, int lwork, int \*info, gesvdjInfo\_t params, int batchSize); cusolverStatus\_t cusolverDnZgesvdjBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int m, int n, cuDoubleComplex \*A, int lda, double \*S, cuDoubleComplex \*U, int ldu, cuDoubleComplex \*V, int ldv, cuDoubleComplex \*work, int lwork, int \*info, gesvdjInfo\_t params, int batchSize); This function computes singular values and singular vectors of a sequence of general \\(m \\times n\\) matrices \\\[A\_{j} = U\_{j}\*\\Sigma\_{j}\*V\_{j}^{H}\\\] where \\(\\Sigma\_{j}\\) is a real \\(m \\times n\\) diagonal matrix which is zero except for its min(m,n) diagonal elements. \\(U\_{j}\\) (left singular vectors) is an \\(m \\times m\\) unitary matrix and \\(V\_{j}\\) (right singular vectors) is a \\(n \\times n\\) unitary matrix. The diagonal elements of \\(\\Sigma\_{j}\\) are the singular values of \\(A\_{j}\\) in either descending order or non-sorting order. gesvdjBatched performs gesvdj on each matrix. It requires that all matrices are of the same size m,n no greater than 32 and are packed in 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 S also contains singular values of each matrix in contiguous way, \\\[\\begin{split}S = \\begin{pmatrix} {S0} & {S1} & \\cdots \\\\ \\end{pmatrix}\\end{split}\\\] The formula for random access of S is \\(S\_{k}\\operatorname{(j)} = {S\\lbrack\\ j\\ +\\ min(m,n)\*k\\rbrack}\\). Except for tolerance and maximum sweeps, gesvdjBatched can either sort the singular values in descending order (default) or chose as-is (without sorting) by the function cusolverDnXgesvdjSetSortEig. If the user packs several tiny matrices into diagonal blocks of one matrix, non-sorting option can separate singular values of those tiny matrices. gesvdjBatched cannot report residual and executed sweeps by function cusolverDnXgesvdjGetResidual and cusolverDnXgesvdjGetSweeps. Any call of the above two returns CUSOLVER\_STATUS\_NOT\_SUPPORTED. The user needs to compute residual explicitly. The user has to provide working space pointed by input parameter work. The input parameter lwork is the size of the working space, and it is returned by gesvdjBatched\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. The output parameter info is an integer array of size batchSize. If the function returns CUSOLVER\_STATUS\_INVALID\_VALUE, the first element info\[0\] = -i (less than zero) indicates i-th parameter is wrong (not counting handle). Otherwise, if info\[i\] = min(m,n)+1, gesvdjBatched does not converge on i-th matrix under given tolerance and maximum sweeps. Please visit cuSOLVER Library Samples - gesvdjBatched for a code example. API of gesvdjBatched Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. jobz host input Specifies options to either compute singular value only or singular vectors as well: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute singular values only; jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute singular values and singular vectors. m host input Number of rows of matrix Aj. m is no greater than 32. n host input Number of columns of matrix Aj. n is no greater than 32. A device in/out array of dimension lda \* n \* batchSize with lda is not less than max(1,n). on Exit: the contents of Aj are destroyed. lda host input Lading dimension of two-dimensional array used to store matrix Aj. S device output Areal array of dimension min(m,n)\*batchSize. It stores the singular values of Aj in descending order or non-sorting order. U device output array of dimension ldu \* m \* batchSize. Uj contains the left singular vectors of Aj. ldu host input Leading dimension of two-dimensional array used to store matrix Uj. ldu is not less than max(1,m). V device output array of dimension ldv \* n \* batchSize. Vj contains the right singular vectors of Aj. ldv host input Leading dimension of two-dimensional array used to store matrix Vj. ldv is not less than max(1,n). work device in/out array of size lwork, working space. lwork host input Size of work, returned by gesvdjBatched\_bufferSize. info device output An integer array of dimension batchSize. If CUSOLVER\_STATUS\_INVALID\_VALUE is returned, info\[0\] = -i (less than zero) indicates i-th parameter is wrong (not counting handle). Otherwise, if info\[i\] = 0, the operation is successful. if info\[i\] = min(m,n)+1, gesvdjBatched dose not converge on i-th matrix under given tolerance and maximum sweeps. params host input Structure filled with parameters of Jacobi algorithm. params can be destroyed after the host thread exits the routine. batchSize host input Number of matrices. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or lda gesvdaStridedBatched() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnSgesvdaStridedBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int rank, int m, int n, const float \*A, int lda, long long int strideA, const float \*S, long long int strideS, const float \*U, int ldu, long long int strideU, const float \*V, int ldv, long long int strideV, int \*lwork, int batchSize); cusolverStatus\_t cusolverDnDgesvdaStridedBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int rank, int m, int n, const double \*A, int lda, long long int strideA, const double \*S, long long int strideS, const double \*U, int ldu, long long int strideU, const double \*V, int ldv, long long int strideV, int \*lwork, int batchSize); cusolverStatus\_t cusolverDnCgesvdaStridedBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int rank, int m, int n, const cuComplex \*A, int lda, long long int strideA, const float \*S, long long int strideS, const cuComplex \*U, int ldu, long long int strideU, const cuComplex \*V, int ldv, long long int strideV, int \*lwork, int batchSize); cusolverStatus\_t cusolverDnZgesvdaStridedBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int rank, int m, int n, const cuDoubleComplex \*A, int lda, long long int strideA, const double \*S, long long int strideS, const cuDoubleComplex \*U, int ldu, long long int strideU, const cuDoubleComplex \*V, int ldv, long long int strideV, int \*lwork, int batchSize); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSgesvdaStridedBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int rank, int m, int n, const float \*A, int lda, long long int strideA, float \*S, long long int strideS, float \*U, int ldu, long long int strideU, float \*V, int ldv, long long int strideV, float \*work, int lwork, int \*info, double \*h\_R\_nrmF, int batchSize); cusolverStatus\_t cusolverDnDgesvdaStridedBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int rank, int m, int n, const double \*A, int lda, long long int strideA, double \*S, long long int strideS, double \*U, int ldu, long long int strideU, double \*V, int ldv, long long int strideV, double \*work, int lwork, int \*info, double \*h\_R\_nrmF, int batchSize); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCgesvdaStridedBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int rank, int m, int n, const cuComplex \*A, int lda, long long int strideA, float \*S, long long int strideS, cuComplex \*U, int ldu, long long int strideU, cuComplex \*V, int ldv, long long int strideV, cuComplex \*work, int lwork, int \*info, double \*h\_R\_nrmF, int batchSize); cusolverStatus\_t cusolverDnZgesvdaStridedBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, int rank, int m, int n, const cuDoubleComplex \*A, int lda, long long int strideA, double \*S, long long int strideS, cuDoubleComplex \*U, int ldu, long long int strideU, cuDoubleComplex \*V, int ldv, long long int strideV, cuDoubleComplex \*work, int lwork, int \*info, double \*h\_R\_nrmF, int batchSize); This function gesvda (a stands for approximate) approximates the singular value decomposition of a tall skinny \\(m \\times n\\) matrix A and corresponding the left and right singular vectors. The economy form of SVD is written by \\\[A = U\*\\Sigma\*V^{H}\\\] where Σ is an \\(n \\times n\\) matrix. U is an \\(m \\times n\\) unitary matrix, and V is an \\(n \\times n\\) unitary matrix. The diagonal elements of Σ are the singular values of A; they are real and non-negative, and are returned in descending order. U and V are the left and right singular vectors of A. gesvda computes eigenvalues of A\*\*T\*A, or A\*\*H\*A (if A is complex), to approximate singular values and singular vectors. It generates matrices U and V and transforms the matrix A to the following form \\\[U^{H}\*A\*V = S + E\\\] where S is diagonal and E depends on rounding errors. To certain conditions, U, V and S approximate singular values and singular vectors up to machine zero of single precision. In general, V is unitary, S is more accurate than U. If singular value is far from zero, then left singular vector U is accurate. In other words, the accuracy of singular values and left singular vectors depend on the distance between singular value and zero. Since the computation of A\*\*T\*A, or A\*\*H\*A can greatly amplify errors, it is recommended to use gesvda only with well-conditioned data. The input parameter rank decides the number of singular values and singular vectors are computed in parameter S, U and V. The output parameter h\_RnrmF computes Frobenius norm of residual. To compute h\_RnrmF, info!= NULL is required. \\\[A - U\*S\*V^{H}\\\] if the parameter rank is equal n. Otherwise, h\_RnrmF reports \\\[{\\|}U\*S\*V^{H}{\\|} - {\\|S\\|}\\\] in Frobenius norm sense, that is, how far U is from unitary. gesvdaStridedBatched performs gesvda on each matrix. It requires that all matrices are of the same size m,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\\ +\\ strideA\*k\\rbrack}\\). Similarly, the formula for random access of S is \\(S\_{k}\\operatorname{(j)} = {S\\lbrack\\ j\\ +\\ StrideS\*k\\rbrack}\\), the formula for random access of U is \\(U\_{k}\\operatorname{(i,j)} = {U\\lbrack\\ i\\ +\\ ldu\*j\\ +\\ strideU\*k\\rbrack}\\) and the formula for random access of V is \\(V\_{k}\\operatorname{(i,j)} = {V\\lbrack\\ i\\ +\\ ldv\*j\\ +\\ strideV\*k\\rbrack}\\). The user has to provide working space which is pointed by input parameter work. The input parameter lwork is the size of the working space, and it is returned by gesvdaStridedBatched\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. The output parameter info is an integer array of size batchSize. If the function returns CUSOLVER\_STATUS\_INVALID\_VALUE, the first element info\[0\] = -i (less than zero) indicates i-th parameter is wrong (not counting handle). Otherwise, if info\[i\] = min(m,n)+1, gesvdaStridedBatched did not converge on the i-th matrix. If 0 < info\[i\] < min(m,n)+1, gesvdaStridedBatched could not compute an SVD of the i-th matrix fully; the leading singular values Si\[k\], 0 <= k <= info\[i\]-1, and corresponding singular vectors may still be useful. In this case, if h\_RnrmF is requested, h\_RnrmF reports the residual as if rank was set to info\[i\]-1. Note that the problem size is limited by the condition batchSize\*stride{A/S/U/V}<=INT32\_MAX primarily due to the current implementation constraints. Please visit cuSOLVER Library Samples - gesvdaStridedBatched for a code example. Remark 1: The routine returns V, not \\(V^{H}\\). This is different from gesvd. Remark 2: The routine only supports m >=n. Remark 3: It is recommended to use an FP64 data type, that is DgesvdaStridedBatched or ZgesvdaStridedBatched. Remark 4: If the user is confident on the accuracy of singular values and singular vectors, for example, certain conditions hold (required singular value is far from zero), then the performance can be improved by passing a null pointer to h\_RnrmF, i.e. no computation of the residual norm. API of gesvdaStridedBatched Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. jobz host input Specifies options to either compute singular value only or singular vectors as well: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute singular values only; jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute singular values and singular vectors. rank host input Number of singular values (from largest to smallest). m host input Number of rows of matrix Aj. n host input Number of columns of matrix Aj. A device input array of dimension strideA \* batchSize with lda is not less than max(1,m). Aj is of dimension m \* n. lda host input Leading dimension of two-dimensional array used to store matrix Aj. strideA host input Value of type long long int that gives the address offset between A\[i\] and A\[i+1\]. strideA is not less than lda\*n. S device output A real array of dimension strideS\*batchSize. It stores the singular values of Aj in descending order. Sj is of dimension rank \* 1 strideS host input Value of type long long int that gives the address offset between S\[i\] and S\[i+1\]. strideS is not less than rank. U device output array of dimension strideU \* batchSize. Uj contains the left singular vectors of Aj. Uj is of dimension m \* rank. ldu host input Leading dimension of two-dimensional array used to store matrix Uj. ldu is not less than max(1,m). strideU host input Value of type long long int that gives the address offset between U\[i\] and U\[i+1\]. strideU is not less than ldu\*rank. V device output array of dimension strideV \* batchSize. Vj contains the right singular vectors of Aj. Vj is of dimension n \* rank. ldv host input Leading dimension of two-dimensional array used to store matrix Vj. ldv is not less than max(1,n). strideV host input Value of type long long int that gives the address offset between V\[i\] and V\[i+1\]. strideV is not less than ldv\*rank. work device in/out array of size lwork, working space. lwork host input Size of work, returned by gesvdaStridedBatched\_bufferSize. info device output An integer array of dimension batchSize. If CUSOLVER\_STATUS\_INVALID\_VALUE is returned, info\[0\] = -i (less than zero) indicates i-th parameter is wrong (not counting handle). Otherwise, if info\[i\] = 0, the operation is successful. If info\[i\] = min(m,n)+1, gesvdaStridedBatched did not converge on the i-th matrix. If 0 < info\[i\] < min(m,n)+1, gesvdaStridedBatched computed only a partial SVD of the i-th matrix. h\_RnrmF host output array of size batchSize. h\_RnrmF\[i\] is norm of residual of i-th matrix. If 0 < info\[i\] < min(m,n)+1, h\_RnrmF\[i\] reports the residual as if rank of the i-th matrix had been set to info\[i\]-1. batchSize host input Number of matrices. batchSize is not less than 1. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or batchSize\*stride{A/S/U/V}>INT32\_MAX or lda syevd() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnSsyevd\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const float \*A, int lda, const float \*W, int \*lwork); cusolverStatus\_t cusolverDnDsyevd\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const double \*A, int lda, const double \*W, int \*lwork); cusolverStatus\_t cusolverDnCheevd\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const cuComplex \*A, int lda, const float \*W, int \*lwork); cusolverStatus\_t cusolverDnZheevd\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const cuDoubleComplex \*A, int lda, const double \*W, int \*lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSsyevd( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, float \*A, int lda, float \*W, float \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnDsyevd( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, double \*A, int lda, double \*W, double \*work, int lwork, int \*devInfo); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCheevd( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, float \*W, cuComplex \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnZheevd( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, double \*W, cuDoubleComplex \*work, int lwork, int \*devInfo); This function computes eigenvalues and eigenvectors of a symmetric (Hermitian) \\(n \\times n\\) matrix A. The standard symmetric eigenvalue problem is \\\[A\*V = V\*\\Lambda\\\] where Λ is a real \\(n \\times n\\) diagonal matrix. V is an \\(n \\times n\\) unitary matrix. The diagonal elements of Λ are the eigenvalues of A in ascending order. The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by syevd\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). If devInfo = i (greater than zero), i off-diagonal elements of an intermediate tridiagonal form did not converge to zero. If jobz = CUSOLVER\_EIG\_MODE\_VECTOR, A contains the orthonormal eigenvectors of the matrix A. The eigenvectors are computed by a divide and conquer algorithm. Please visit cuSOLVER Library Samples - syevd for a code example. API of syevd Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. jobz host input Specifies options to either compute eigenvalue only or compute eigen-pair: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute eigenvalues only; jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute eigenvalues and eigenvectors. uplo host input Specifies which part of A is stored. uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of A is stored. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of A is stored. n host input Number of rows (or columns) of matrix A. A device in/out array of dimension lda \* n with lda is not less than max(1,n). If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of A contains the upper triangular part of the matrix A. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of A contains the lower triangular part of the matrix A. On exit, if jobz = CUSOLVER\_EIG\_MODE\_VECTOR, and devInfo = 0, A contains the orthonormal eigenvectors of the matrix A. If jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR, the contents of A are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix A. W device output A real array of dimension n. The eigenvalue values of A, in ascending order ie, sorted so that W(i) <= W(i+1). work device in/out Working space, array of size lwork. Lwork host input Size of work, returned by syevd\_bufferSize. devInfo device output If devInfo = 0, the operation is successful. If devInfo = -i, the i-th parameter is wrong (not counting handle). If devInfo = i (> 0), devInfo indicates i off-diagonal elements of an intermediate tridiagonal form did not converge to zero; Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, or lda syevdx() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnSsyevdx\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, const float \*A, int lda, float vl, float vu, int il, int iu, int \*h\_meig, const float \*W, int \*lwork); cusolverStatus\_t cusolverDnDsyevdx\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, const double \*A, int lda, double vl, double vu, int il, int iu, int \*h\_meig, const double \*W, int \*lwork); cusolverStatus\_t cusolverDnCheevdx\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, const cuComplex \*A, int lda, float vl, float vu, int il, int iu, int \*h\_meig, const float \*W, int \*lwork); cusolverStatus\_t cusolverDnZheevdx\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, const cuDoubleComplex \*A, int lda, double vl, double vu, int il, int iu, int \*h\_meig, const double \*W, int \*lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSsyevdx( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, float \*A, int lda, float vl, float vu, int il, int iu, int \*h\_meig, float \*W, float \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnDsyevdx( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, double \*A, int lda, double vl, double vu, int il, int iu, int \*h\_meig, double \*W, double \*work, int lwork, int \*devInfo); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCheevdx( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, float vl, float vu, int il, int iu, int \*h\_meig, float \*W, cuComplex \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnZheevdx( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, double vl, double vu, int il, int iu, int \*h\_meig, double \*W, cuDoubleComplex \*work, int lwork, int \*devInfo); This function computes all or selection of the eigenvalues and optionally eigenvectors of a symmetric (Hermitian) \\(n \\times n\\) matrix A. The standard symmetric eigenvalue problem is: \\\[A\*V = V\*\\Lambda\\\] where Λ is a real n×h\_meig diagonal matrix. V is an n×h\_meig unitary matrix. h\_meig is the number of eigenvalues/eigenvectors computed by the routine, h\_meig is equal to n when the whole spectrum (e.g., range = CUSOLVER\_EIG\_RANGE\_ALL) is requested. The diagonal elements of Λ are the eigenvalues of A in ascending order. The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by syevdx\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). If devInfo = i (greater than zero), i off-diagonal elements of an intermediate tridiagonal form did not converge to zero. If jobz = CUSOLVER\_EIG\_MODE\_VECTOR, A contains the orthonormal eigenvectors of the matrix A. The eigenvectors are computed by a divide and conquer algorithm. Please visit cuSOLVER Library Samples - syevdx for a code example. API of syevdx Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. jobz host input Specifies options to either compute eigenvalue only or compute eigen-pair: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute eigenvalues only; jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute eigenvalues and eigenvectors. range host input Specifies options to which selection of eigenvalues and optionally eigenvectors that need to be computed: range = CUSOLVER\_EIG\_RANGE\_ALL: all eigenvalues/eigenvectors will be found, will becomes the classical syevd/heevd routine; range = CUSOLVER\_EIG\_RANGE\_V: all eigenvalues/eigenvectors in the half-open interval (vl,vu\] will be found; range = CUSOLVER\_EIG\_RANGE\_I: the il-th through iu-th eigenvalues/eigenvectors will be found; uplo host input Specifies which part of A is stored. uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of A is stored. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of A is stored. n host input Number of rows (or columns) of matrix A. A device in/out array of dimension lda \* n with lda is not less than max(1,n). If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of A contains the upper triangular part of the matrix A. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of A contains the lower triangular part of the matrix A. On exit, if jobz = CUSOLVER\_EIG\_MODE\_VECTOR, and devInfo = 0, A contains the orthonormal eigenvectors of the matrix A. If jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR, the contents of A are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix A.lda is not less thanmax(1,n). vl,vu host input Real values float or double for (C, S) or (Z, D) precision respectively. If range = CUSOLVER\_EIG\_RANGE\_V, the lower and upper bounds of the interval to be searched for eigenvalues. vl > vu. Not referenced if range = CUSOLVER\_EIG\_RANGE\_ALL or range = CUSOLVER\_EIG\_RANGE\_I. Note that, if eigenvalues are very close to each other, it is well known that two different eigenvalues routines might find slightly different number of eigenvalues inside the same interval. This is due to the fact that different eigenvalue algorithms, or even same algorithm but different run might find eigenvalues within some rounding error close to the machine precision. Thus, if the user wants to be sure not to miss any eigenvalue within the interval bound, we suggest that the user subtract/add epsilon (machine precision) to the interval bound such as (vl=vl-eps, vu=vu+eps\]. This suggestion is valid for any selective routine from cuSolver or LAPACK. il,iu host input Integer. If range = CUSOLVER\_EIG\_RANGE\_I, the indices (in ascending order) of the smallest and largest eigenvalues to be returned. 1 <= il <= iu <= n, if n > 0; il = 1 and iu = 0 if n = 0. Not referenced if range = CUSOLVER\_EIG\_RANGE\_ALL or range = CUSOLVER\_EIG\_RANGE\_V. h\_meig host output Integer. The total number of eigenvalues found. 0 <= h\_meig <= n. If range = CUSOLVER\_EIG\_RANGE\_ALL, h\_meig = n, and if range = CUSOLVER\_EIG\_RANGE\_I, h\_meig = iu-il+1. W device output A real array of dimension n. The eigenvalue values of A, in ascending order ie, sorted so that W(i) <= W(i+1). work device in/out Working space, array of size lwork. lwork host input Size of work, returned by syevdx\_bufferSize. devInfo device output If devInfo = 0, the operation is successful. If devInfo = -i, the i-th parameter is wrong (not counting handle). If devInfo = i (> 0), devInfo indicates i off-diagonal elements of an intermediate tridiagonal form did not converge to zero. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, or lda sygvd() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnSsygvd\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const float \*A, int lda, const float \*B, int ldb, const float \*W, int \*lwork); cusolverStatus\_t cusolverDnDsygvd\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const double \*A, int lda, const double \*B, int ldb, const double \*W, int \*lwork); cusolverStatus\_t cusolverDnChegvd\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const cuComplex \*A, int lda, const cuComplex \*B, int ldb, const float \*W, int \*lwork); cusolverStatus\_t cusolverDnZhegvd\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const cuDoubleComplex \*A, int lda, const cuDoubleComplex \*B, int ldb, const double \*W, int \*lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSsygvd( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, float \*A, int lda, float \*B, int ldb, float \*W, float \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnDsygvd( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, double \*A, int lda, double \*B, int ldb, double \*W, double \*work, int lwork, int \*devInfo); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnChegvd( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, cuComplex \*B, int ldb, float \*W, cuComplex \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnZhegvd( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, cuDoubleComplex \*B, int ldb, double \*W, cuDoubleComplex \*work, int lwork, int \*devInfo); This function computes eigenvalues and eigenvectors of a symmetric (Hermitian) \\(n \\times n\\) matrix-pair (A,B). The generalized symmetric-definite eigenvalue problem is where the matrix B is positive definite. Λ is a real \\(n \\times n\\) diagonal matrix. The diagonal elements of Λ are the eigenvalues of (A, B) in ascending order. V is an \\(n \\times n\\) orthogonal matrix. The eigenvectors are normalized as follows: The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by sygvd\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). If devInfo = i (i > 0 and i<=n) and jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR, i off-diagonal elements of an intermediate tridiagonal form did not converge to zero. If devInfo = N + i (i > 0), then the leading minor of order i of B is not positive definite. The factorization of B could not be completed and no eigenvalues or eigenvectors were computed. if jobz = CUSOLVER\_EIG\_MODE\_VECTOR, A contains the orthogonal eigenvectors of the matrix A. The eigenvectors are computed by divide and conquer algorithm. Please visit cuSOLVER Library Samples - sygvd for a code example. API of sygvd Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. itype host input Specifies the problem type to be solved: itype=CUSOLVER\_EIG\_TYPE\_1: A\*x = (lambda)\*B\*x. itype=CUSOLVER\_EIG\_TYPE\_2: A\*B\*x = (lambda)\*x. itype=CUSOLVER\_EIG\_TYPE\_3: B\*A\*x = (lambda)\*x. jobz host input Specifies options to either compute eigenvalue only or compute eigen-pair: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute eigenvalues only; jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute eigenvalues and eigenvectors. uplo host input Specifies which part of A and B are stored. uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of A and B are stored. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of A and B are stored. n host input Number of rows (or columns) of matrix A and B. A device in/out array of dimension lda \* n with lda is not less than max(1,n). If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of A contains the upper triangular part of the matrix A. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of A contains the lower triangular part of the matrix A. On exit, if jobz = CUSOLVER\_EIG\_MODE\_VECTOR, and devInfo = 0, A contains the orthonormal eigenvectors of the matrix A. If jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR, the contents of A are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix A. lda is not less than max(1,n). B device in/out array of dimension ldb \* n. If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of B contains the upper triangular part of the matrix B. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of B contains the lower triangular part of the matrix B. On exit, if devInfo is less than n, B is overwritten by triangular factor U or L from the Cholesky factorization of B. ldb host input Leading dimension of two-dimensional array used to store matrix B. ldb is not less than max(1,n). W device output A real array of dimension n. The eigenvalue values of A, sorted so that W(i) >= W(i+1). work device in/out Working space, array of size lwork. Lwork host input Size of work, returned by sygvd\_bufferSize. devInfo device output If devInfo = 0, the operation is successful. If devInfo = -i, the i-th parameter is wrong (not counting handle). If devInfo = i (> 0), devInfo indicates either potrf or syevd is wrong. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, or lda sygvdx() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnSsygvdx\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, const float \*A, int lda, const float \*B, int ldb, float vl, float vu, int il, int iu, int \*h\_meig, const float \*W, int \*lwork); cusolverStatus\_t cusolverDnDsygvdx\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, const double \*A, int lda, const double \*B, int ldb, double vl, double vu, int il, int iu, int \*h\_meig, const double \*W, int \*lwork); cusolverStatus\_t cusolverDnChegvdx\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, const cuComplex \*A, int lda, const cuComplex \*B, int ldb, float vl, float vu, int il, int iu, int \*h\_meig, const float \*W, int \*lwork); cusolverStatus\_t cusolverDnZhegvdx\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, const cuDoubleComplex \*A, int lda, const cuDoubleComplex \*B, int ldb, double vl, double vu, int il, int iu, int \*h\_meig, const double \*W, int \*lwork); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSsygvdx( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, float \*A, int lda, float \*B, int ldb, float vl, float vu, int il, int iu, int \*h\_meig, float \*W, float \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnDsygvdx( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, double \*A, int lda, double \*B, int ldb, double vl, double vu, int il, int iu, int \*h\_meig, double \*W, double \*work, int lwork, int \*devInfo); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnChegvdx( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, cuComplex \*B, int ldb, float vl, float vu, int il, int iu, int \*h\_meig, float \*W, cuComplex \*work, int lwork, int \*devInfo); cusolverStatus\_t cusolverDnZhegvdx( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cusolverEigRange\_t range, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, cuDoubleComplex \*B, int ldb, double vl, double vu, int il, int iu, int \*h\_meig, double \*W, cuDoubleComplex \*work, int lwork, int \*devInfo); This function computes all or selection of the eigenvalues and optionally eigenvectors of a symmetric (Hermitian) \\(n \\times n\\) matrix-pair (A,B). The generalized symmetric-definite eigenvalue problem is where the matrix B is positive definite. Λ is a real \\(n \\times {h\\\_meig}\\) diagonal matrix. The diagonal elements of Λ are the eigenvalues of (A, B) in ascending order. V is an \\(n \\times {h\\\_meig}\\) orthogonal matrix. h\_meig is the number of eigenvalues/eigenvectors computed by the routine, h\_meig is equal to n when the whole spectrum (for example, range = CUSOLVER\_EIG\_RANGE\_ALL) is requested. The eigenvectors are normalized as follows: The user has to provide working space which is pointed by input parameter work. The input parameter lwork is size of the working space, and it is returned by sygvdx\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). If devInfo = i (i > 0 and i<=n) and jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR, i off-diagonal elements of an intermediate tridiagonal form did not converge to zero. If devInfo = n + i (i > 0), then the leading minor of order i of B is not positive definite. The factorization of B could not be completed and no eigenvalues or eigenvectors were computed. If jobz = CUSOLVER\_EIG\_MODE\_VECTOR, A contains the orthogonal eigenvectors of the matrix A. The eigenvectors are computed by divide and conquer algorithm. Please visit cuSOLVER Library Samples - sygvdx for a code example. API of sygvdx Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. itype host input Specifies the problem type to be solved: itype =CUSOLVER\_EIG\_TYPE\_1: A\*x = (lambda)\*B\*x itype =CUSOLVER\_EIG\_TYPE\_2: A\*B\*x = (lambda)\*x itype =CUSOLVER\_EIG\_TYPE\_3: B\*A\*x = (lambda)\*x jobz host input Specifies options to either compute eigenvalue only or compute eigen-pair: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute eigenvalues only; jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute eigenvalues and eigenvectors. range host input Specifies options to which selection of eigenvalues and optionally eigenvectors that need to be computed: range = CUSOLVER\_EIG\_RANGE\_ALL: all eigenvalues/eigenvectors will be found, will becomes the classical syevd/heevd routine; range = CUSOLVER\_EIG\_RANGE\_V: all eigenvalues/eigenvectors in the half-open interval (vl,vu\] will be found; range = CUSOLVER\_EIG\_RANGE\_I: the il-th through iu-th eigenvalues/eigenvectors will be found; uplo host input Specifies which part of A and B are stored. uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of A and B are stored. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of A and B are stored. n host input Number of rows (or columns) of matrix A and B. A device in/out array of dimension lda \* n with lda is not less than max(1,n). If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of A contains the upper triangular part of the matrix A. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of A contains the lower triangular part of the matrix A. On exit, if jobz = CUSOLVER\_EIG\_MODE\_VECTOR, and devInfo = 0, A contains the orthonormal eigenvectors of the matrix A. If jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR, the contents of A are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix A. lda is not less than max(1,n). B device in/out array of dimension ldb \* n. If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of B contains the upper triangular part of the matrix B. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of B contains the lower triangular part of the matrix B. On exit, if devInfo is less than n, B is overwritten by triangular factor U or L from the Cholesky factorization of B. ldb host input Leading dimension of two-dimensional array used to store matrix B. ldb is not less than max(1,n). vl,vu host input Real values float or double for (C, S) or (Z, D) precision respectively. If range = CUSOLVER\_EIG\_RANGE\_V, the lower and upper bounds of the interval to be searched for eigenvalues. vl > vu. Not referenced if range = CUSOLVER\_EIG\_RANGE\_ALL or range = CUSOLVER\_EIG\_RANGE\_I. Note that, if eigenvalues are very close to each other, it is well known that two different eigenvalues routines might find slightly different number of eigenvalues inside the same interval. This is due to the fact that different eigenvalue algorithms, or even same algorithm but different run might find eigenvalues within some rounding error close to the machine precision. Thus, if the user want to be sure not to miss any eigenvalue within the interval bound, we suggest that, the user subtract/add epsilon (machine precision) to the interval bound such as (vl=vl-eps, vu=vu+eps\]. this suggestion is valid for any selective routine from cuSolver or LAPACK. il,iu host input Integer. If range = CUSOLVER\_EIG\_RANGE\_I, the indices (in ascending order) of the smallest and largest eigenvalues to be returned. 1 <= il <= iu <= n, if n > 0; il = 1 and iu = 0 if n = 0. Not referenced if range = CUSOLVER\_EIG\_RANGE\_ALL or range = CUSOLVER\_EIG\_RANGE\_V. h\_meig host output Integer. The total number of eigenvalues found. 0 <= h\_meig <= n. If range = CUSOLVER\_EIG\_RANGE\_ALL, h\_meig = n, and if range = CUSOLVER\_EIG\_RANGE\_I, h\_meig = iu-il+1. W device output A real array of dimension n. The eigenvalue values of A, sorted so that W(i) >= W(i+1). work device in/out Working space, array of size lwork. lwork host input Size of work, returned by sygvdx\_bufferSize. devInfo device output If devInfo = 0, the operation is successful. If devInfo = -i, the i-th parameter is wrong (not counting handle). If devInfo = i (> 0), devInfo indicates either potrf or syevd is wrong. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, or lda syevj() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnSsyevj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const float \*A, int lda, const float \*W, int \*lwork, syevjInfo\_t params); cusolverStatus\_t cusolverDnDsyevj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const double \*A, int lda, const double \*W, int \*lwork, syevjInfo\_t params); cusolverStatus\_t cusolverDnCheevj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const cuComplex \*A, int lda, const float \*W, int \*lwork, syevjInfo\_t params); cusolverStatus\_t cusolverDnZheevj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const cuDoubleComplex \*A, int lda, const double \*W, int \*lwork, syevjInfo\_t params); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSsyevj( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, float \*A, int lda, float \*W, float \*work, int lwork, int \*info, syevjInfo\_t params); cusolverStatus\_t cusolverDnDsyevj( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, double \*A, int lda, double \*W, double \*work, int lwork, int \*info, syevjInfo\_t params); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCheevj( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, float \*W, cuComplex \*work, int lwork, int \*info, syevjInfo\_t params); cusolverStatus\_t cusolverDnZheevj( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, double \*W, cuDoubleComplex \*work, int lwork, int \*info, syevjInfo\_t params); This function computes eigenvalues and eigenvectors of a symmetric (Hermitian) \\(n \\times n\\) matrix A. The standard symmetric eigenvalue problem is \\\[A\*Q = Q\*\\Lambda\\\] where Λ is a real \\(n \\times n\\) diagonal matrix. Q is an \\(n \\times n\\) unitary matrix. The diagonal elements of Λ are the eigenvalues of A in ascending order. syevj has the same functionality as syevd. The difference is that syevd uses QR algorithm and syevj uses Jacobi method. The parallelism of Jacobi method gives GPU better performance on small and medium size matrices. Moreover the user can configure syevj to perform approximation up to certain accuracy. How does it work? syevj iteratively generates a sequence of unitary matrices to transform matrix A to the following form \\\[V^{H}\*A\*V = W + E\\\] where W is diagonal and E is symmetric without diagonal. During the iterations, the Frobenius norm of E decreases monotonically. As E goes down to zero, W is the set of eigenvalues. In practice, Jacobi method stops if \\\[{\\|E\\|}\_{F}\\leq\\operatorname{eps}\*{\\|A\\|}\_{F}\\\] where eps is the given tolerance. syevj has two parameters to control the accuracy. First parameter is tolerance (eps). The default value is machine accuracy but The user can use function cusolverDnXsyevjSetTolerance to set a priori tolerance. The second parameter is maximum number of sweeps which controls number of iterations of Jacobi method. The default value is 100 but the user can use function cusolverDnXsyevjSetMaxSweeps to set a proper bound. The experiments show 15 sweeps are good enough to converge to machine accuracy. syevj stops either tolerance is met or maximum number of sweeps is met. The Jacobi method has quadratic convergence, so the accuracy is not proportional to number of sweeps. To guarantee certain accuracy, the user should configure tolerance only. After syevj, the user can query residual by function cusolverDnXsyevjGetResidual and number of executed sweeps by function cusolverDnXsyevjGetSweeps. However the user needs to be aware that residual is the Frobenius norm of E, not accuracy of individual eigenvalue, i.e. \\\[{residual}={\\|E\\|}\_{F} = {{\\|}\\Lambda - W{\\|}}\_{F}\\\] The same as syevd, the user has to provide working space pointed by input parameter work. The input parameter lwork is the size of the working space, and it is returned by syevj\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle). If info = n+1, syevj does not converge under given tolerance and maximum sweeps. If the user sets an improper tolerance, syevj may not converge. For example, tolerance should not be smaller than machine accuracy. If jobz = CUSOLVER\_EIG\_MODE\_VECTOR, A contains the orthonormal eigenvectors V. Please visit cuSOLVER Library Samples - syevj for a code example. API of syevj Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. jobz host input Specifies options to either compute eigenvalue only or compute eigen-pair: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute eigenvalues only; jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute eigenvalues and eigenvectors. uplo host input Specifies which part of A is stored. uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of A is stored. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of A is stored. n host input Number of rows (or columns) of matrix A. A device in/out array of dimension lda \* n with lda is not less than max(1,n). If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of A contains the upper triangular part of the matrix A. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of A contains the lower triangular part of the matrix A. On exit, if jobz = CUSOLVER\_EIG\_MODE\_VECTOR, and info = 0, A contains the orthonormal eigenvectors of the matrix A. If jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR, the contents of A are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix A. W device output A real array of dimension n. The eigenvalue values of A, in ascending order ie, sorted so that W(i) <= W(i+1). work device in/out Working space, array of size lwork. lwork host input Size of work, returned by syevj\_bufferSize. info device output If info = 0, the operation is successful. If info = -i, the i-th parameter is wrong (not counting handle). If info = n+1, syevj does not converge under given tolerance and maximum sweeps. params host in/out Structure filled with parameters of Jacobi algorithm and results of syevj. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, or lda sygvj() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnSsygvj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const float \*A, int lda, const float \*B, int ldb, const float \*W, int \*lwork, syevjInfo\_t params); cusolverStatus\_t cusolverDnDsygvj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const double \*A, int lda, const double \*B, int ldb, const double \*W, int \*lwork, syevjInfo\_t params); cusolverStatus\_t cusolverDnChegvj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const cuComplex \*A, int lda, const cuComplex \*B, int ldb, const float \*W, int \*lwork, syevjInfo\_t params); cusolverStatus\_t cusolverDnZhegvj\_bufferSize( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const cuDoubleComplex \*A, int lda, const cuDoubleComplex \*B, int ldb, const double \*W, int \*lwork, syevjInfo\_t params); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSsygvj( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, float \*A, int lda, float \*B, int ldb, float \*W, float \*work, int lwork, int \*info, syevjInfo\_t params); cusolverStatus\_t cusolverDnDsygvj( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, double \*A, int lda, double \*B, int ldb, double \*W, double \*work, int lwork, int \*info, syevjInfo\_t params); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnChegvj( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, cuComplex \*B, int ldb, float \*W, cuComplex \*work, int lwork, int \*info, syevjInfo\_t params); cusolverStatus\_t cusolverDnZhegvj( cusolverDnHandle\_t handle, cusolverEigType\_t itype, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, cuDoubleComplex \*B, int ldb, double \*W, cuDoubleComplex \*work, int lwork, int \*info, syevjInfo\_t params); This function computes eigenvalues and eigenvectors of a symmetric (Hermitian) \\(n \\times n\\) matrix-pair (A,B). The generalized symmetric-definite eigenvalue problem is where the matrix B is positive definite. Λ is a real \\(n \\times n\\) diagonal matrix. The diagonal elements of Λ are the eigenvalues of (A, B) in ascending order. V is an \\(n \\times n\\) orthogonal matrix. The eigenvectors are normalized as follows: This function has the same functionality as sygvd except that syevd in sygvd is replaced by syevj in sygvj. Therefore, sygvj inherits properties of syevj, the user can use cusolverDnXsyevjSetTolerance and cusolverDnXsyevjSetMaxSweeps to configure tolerance and maximum sweeps. However the meaning of residual is different from syevj. sygvj first computes Cholesky factorization of matrix B, \\\[B = L\*L^{H}\\\] transform the problem to standard eigenvalue problem, then calls syevj. For example, the standard eigenvalue problem of type I is \\\[M\*Q = Q\*\\Lambda\\\] where matrix M is symmetric \\\[M = L^{-1}\*A\*L^{-H}\\\] The residual is the result of syevj on matrix M, not A. The user has to provide working space which is pointed by input parameter work. The input parameter lwork is the size of the working space, and it is returned by sygvj\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle). If info = i (i > 0 and i<=n), B is not positive definite, the factorization of B could not be completed and no eigenvalues or eigenvectors were computed. If info = n+1, syevj does not converge under given tolerance and maximum sweeps. In this case, the eigenvalues and eigenvectors are still computed because non-convergence comes from improper tolerance of maximum sweeps. if jobz = CUSOLVER\_EIG\_MODE\_VECTOR, A contains the orthogonal eigenvectors V. Please visit cuSOLVER Library Samples - sygvj for a code example. API of sygvj Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. itype host input Specifies the problem type to be solved: itype=CUSOLVER\_EIG\_TYPE\_1: A\*x = (lambda)\*B\*x. itype=CUSOLVER\_EIG\_TYPE\_2: A\*B\*x = (lambda)\*x. itype=CUSOLVER\_EIG\_TYPE\_3: B\*A\*x = (lambda)\*x. jobz host input Specifies options to either compute eigenvalue only or compute eigen-pair: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute eigenvalues only; jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute eigenvalues and eigenvectors. uplo host input Specifies which part of A and B are stored. uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of A and B are stored. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of A and B are stored. n host input Number of rows (or columns) of matrix A and B. A device in/out array of dimension lda \* n with lda is not less than max(1,n). If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of A contains the upper triangular part of the matrix A. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of A contains the lower triangular part of the matrix A. On exit, if jobz = CUSOLVER\_EIG\_MODE\_VECTOR, and info = 0, A contains the orthonormal eigenvectors of the matrix A. If jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR, the contents of A are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix A. lda is not less than max(1,n). B device in/out array of dimension ldb \* n. If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of B contains the upper triangular part of the matrix B. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of B contains the lower triangular part of the matrix B. On exit, if info is less than n, B is overwritten by triangular factor U or L from the Cholesky factorization of B. ldb host input Leading dimension of two-dimensional array used to store matrix B. ldb is not less than max(1,n). W device output A real array of dimension n. The eigenvalue values of A, sorted so that W(i) >= W(i+1). work device in/out Working space, array of size lwork. lwork host input Size of work, returned by sygvj\_bufferSize. info device output If info = 0, the operation is successful. if info = -i, the i-th parameter is wrong (not counting handle). If info = i (> 0), info indicates either B is not positive definite or syevj (called by sygvj) does not converge. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, or lda syevjBatched() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnSsyevjBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const float \*A, int lda, const float \*W, int \*lwork, syevjInfo\_t params, int batchSize ); cusolverStatus\_t cusolverDnDsyevjBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const double \*A, int lda, const double \*W, int \*lwork, syevjInfo\_t params, int batchSize ); cusolverStatus\_t cusolverDnCheevjBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const cuComplex \*A, int lda, const float \*W, int \*lwork, syevjInfo\_t params, int batchSize ); cusolverStatus\_t cusolverDnZheevjBatched\_bufferSize( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, const cuDoubleComplex \*A, int lda, const double \*W, int \*lwork, syevjInfo\_t params, int batchSize ); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverDnSsyevjBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, float \*A, int lda, float \*W, float \*work, int lwork, int \*info, syevjInfo\_t params, int batchSize ); cusolverStatus\_t cusolverDnDsyevjBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, double \*A, int lda, double \*W, double \*work, int lwork, int \*info, syevjInfo\_t params, int batchSize ); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverDnCheevjBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, cuComplex \*A, int lda, float \*W, cuComplex \*work, int lwork, int \*info, syevjInfo\_t params, int batchSize ); cusolverStatus\_t cusolverDnZheevjBatched( cusolverDnHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int n, cuDoubleComplex \*A, int lda, double \*W, cuDoubleComplex \*work, int lwork, int \*info, syevjInfo\_t params, int batchSize ); This function computes eigenvalues and eigenvectors of a sequence of symmetric (Hermitian) \\(n \\times n\\) matrices \\\[A\_{j}\*Q\_{j} = Q\_{j}\*\\Lambda\_{j}\\\] where \\(\\Lambda\_{j}\\) is a real \\(n \\times n\\) diagonal matrix. \\(Q\_j\\) is an \\(n \\times n\\) unitary matrix. The diagonal elements of \\(\\Lambda\_j\\) are the eigenvalues of \\(A\_j\\) in either ascending order or non-sorting order. syevjBatched performs syevj on each matrix. It requires that all matrices are of the same size n and are packed in 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 eigenvalues of each matrix in 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}\\). Except for tolerance and maximum sweeps, syevjBatched can either sort the eigenvalues in ascending order (default) or chose as-is (without sorting) by the function cusolverDnXsyevjSetSortEig. If the user packs several tiny matrices into diagonal blocks of one matrix, non-sorting option can separate spectrum of those tiny matrices. syevjBatched cannot report residual and executed sweeps by function cusolverDnXsyevjGetResidual and cusolverDnXsyevjGetSweeps. Any call of the above two returns CUSOLVER\_STATUS\_NOT\_SUPPORTED. The user needs to compute residual explicitly. The user has to provide working space pointed by input parameter work. The input parameter lwork is the size of the working space, and it is returned by syevjBatched\_bufferSize(). Please note that the size in bytes of the working space is equal to sizeof() \* lwork. The output parameter info is an integer array of size batchSize. If the function returns CUSOLVER\_STATUS\_INVALID\_VALUE, the first element info\[0\] = -i (less than zero) indicates i-th parameter is wrong (not counting handle). Otherwise, if info\[i\] = n+1, syevjBatched does not converge on i-th matrix under given tolerance and maximum sweeps. If jobz = CUSOLVER\_EIG\_MODE\_VECTOR, \\(A\_j\\) contains the orthonormal eigenvectors \\(V\_j\\). Please visit cuSOLVER Library Samples - syevjBatched for a code example. API of syevjBatched Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. jobz host input Specifies options to either compute eigenvalue only or compute eigen-pair: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute eigenvalues only; jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute eigenvalues and eigenvectors. uplo host input Specifies which part of Aj is stored. uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of Aj is stored. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of Aj is stored. n host input Number of rows (or columns) of matrix each Aj. A device in/out array of dimension lda \* n \* batchSize with lda is not less than max(1,n). If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of Aj contains the upper triangular part of the matrix Aj. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of Aj contains the lower triangular part of the matrix Aj. On exit, if jobz = CUSOLVER\_EIG\_MODE\_VECTOR, and info\[j\] = 0, Aj contains the orthonormal eigenvectors of the matrix Aj. If jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR, the contents of Aj are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix Aj. W device output A real array of dimension n\*batchSize. It stores the eigenvalues of Aj in ascending order or non-sorting order. work device in/out array of size lwork, workspace. lwork host input Size of work, returned by syevjBatched\_bufferSize. info device output An integer array of dimension batchSize. If CUSOLVER\_STATUS\_INVALID\_VALUE is returned, info\[0\] = -i (less than zero) indicates i-th parameter is wrong (not counting handle). Otherwise, if info\[i\] = 0, the operation is successful. If info\[i\] = n+1, syevjBatched does not converge on i-th matrix under given tolerance and maximum sweeps. params host in/out Structure filled with parameters of Jacobi algorithm. batchSize host input Number of matrices. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, or lda array of dimension lda \* n with lda is not less than max(1,m). lda host input Leading dimension of two-dimensional array used to store matrix A. ipiv device output Array of size at least min(m,n), containing pivot indices. computeType host in Data type of computation. bufferOnDevice device in/out Device workspace. Array of type void of size workspaceInBytesOnDevice bytes. workspaceInBytesOnDevice host input Size in bytes of bufferOnDevice, returned by cusolverDnXgetrf\_bufferSize. bufferOnHost host in/out Host workspace. Array of type void of size workspaceInBytesOnHost bytes. workspaceInBytesOnHost host input Size in bytes of bufferOnHost, returned by cusolverDnXgetrf\_bufferSize. info device output If info = 0, the LU factorization is successful. if info = -i, the i-th parameter is wrong (not counting handle). If info = i, the U(i,i) = 0. The generic API has two different types, dataTypeA is data type of the matrix A, computeType is compute type of the operation. cusolverDnXgetrf only supports the following four combinations. Valid combination of data type and compute type DataTypeA ComputeType Meaning CUDA\_R\_32F CUDA\_R\_32F SGETRF CUDA\_R\_64F CUDA\_R\_64F DGETRF CUDA\_C\_32F CUDA\_C\_32F CGETRF CUDA\_C\_64F CUDA\_C\_64F ZGETRF Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or lda array of dimension ldb \* nrhs with ldb is not less than max(1,n). ldb host input Leading dimension of two-dimensional array used to store matrix B. info device output If info = 0, the operation is successful. If info = -i, the i-th parameter is wrong (not counting handle). The generic API has two different types: dataTypeA is data type of the matrix A and dataTypeB is data type of the matrix B. cusolverDnXgetrs only supports the following four combinations: Valid combination of data type and compute type DataTypeA dataTypeB Meaning CUDA\_R\_32F CUDA\_R\_32F SGETRS CUDA\_R\_64F CUDA\_R\_64F DGETRS CUDA\_C\_32F CUDA\_C\_32F CGETRS CUDA\_C\_64F CUDA\_C\_64F ZGETRS Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0 or lda sytrf(), only lower or upper part is meaningful, the other part is not touched. If input parameter uplo is CUBLAS\_FILL\_MODE\_LOWER, the details of the factorization are stores as: \\\[A = L\*D\*L^{T}\\\] If input parameter uplo is CUBLAS\_FILL\_MODE\_UPPER, the details of the factorization are stores as: \\\[A = U\*D\*U^{T}\\\] The user has to provide the pivot indices that can be obtained by cusolverDn sytrf() as well as device and host work spaces which are pointed by input parameters bufferOnDevice and bufferOnHost. The input parameters workspaceInBytesOnDevice and workspaceInBytesOnHost are sizes in bytes of the device and host work spaces, and they are returned by cusolverDnXsytrs\_bufferSize(). To factorize and solve the symmetric system without pivoting, the user should set devIpiv = NULL when calling cusolverDn sytrf and cusolverDnXsytrs. If output parameter devInfo = -i (less than zero), the i-th parameter is wrong (not counting handle). List of input arguments for cusolverDnXsytrs\_bufferSize and cusolverDnXsytrs: API of sytrs Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. uplo host input Indicates if matrix A lower or upper part is stored, the other part is not referenced. n host input Number of rows and columns of matrix A. nrhs host input Number of right-hand sides. dataTypeA host in Data type of array A. A device input Array of dimension lda \* n with lda is not less than max(1,n). lda host input Leading dimension of two-dimensional array used to store matrix A. devIpiv device input Array of size at least n, containing pivot indices. To solve the system without pivoting, set the argument NULL. dataTypeB host in Data type of array B. B device in/out Array of dimension ldb \* nrhs with ldb is not less than max(1,nrhs). ldb host input Leading dimension of two-dimensional array used to store matrix B. bufferOnDevice device in/out Device workspace. Array of type void of size workspaceInBytesOnDevice bytes. workspaceInBytesOnDevice host input Size in bytes of bufferOnDevice, returned by cusolverDnXsytrs\_bufferSize. bufferOnHost host in/out Host workspace. Array of type void of size workspaceInBytesOnHost bytes. workspaceInBytesOnHost host input Size in bytes of bufferOnHost, returned by cusolverDnXsytrs\_bufferSize. devInfo device output If devInfo = -i, the i-th parameter is wrong (not counting handle). Otherwise, it sets devInfo = 0 indicating all parameters are valid. The generic API has two different types: dataTypeA is data type of the matrix A, dataTypeB is data type of the matrix A. cusolverDnXsytrs only supports the following four combinations: Valid combination of data type and compute type DataTypeA DataTypeB Meaning CUDA\_R\_32F CUDA\_R\_32F SSYTRS CUDA\_R\_64F CUDA\_R\_64F DSYTRS CUDA\_C\_32F CUDA\_C\_32F CSYTRS CUDA\_C\_64F CUDA\_C\_64F ZSYTRS Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0 or lda \= k scenario is supported. API of larft Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. params host input Structure with information collected by cusolverDnSetAdvOptions. direct host input Specifies the order in which the elementary reflectors are multiplied to form the block reflector. storev host input Specifies how the vectors which define the elementary reflectors are stored. n host input The order of the block reflector H. n >= 0. k host input The order of the triangular factor T (= the number of elementary reflectors). k >= 1. dataTypeV host input Data type of array V. V device input The matrix V of dimension lda \* k. ldv host input Leading dimension of the array V. ldv >= max(1,n). dataTypeTau host input Data type of array tau. tau device input Dimension k. tau(i) must contain the scalar factor of the elementary reflector H(i). dataTypeT host input Data type of array T. T device output Dimension ldt \* k. The \\(k \\times k\\) triangular factor T of the block reflector. If direct == CUBLAS\_DIRECT\_FORWARD, T is upper triangular; if direct == CUBLAS\_DIRECT\_BACKWARD, T is lower triangular. ldt host input The leading dimension of the array T. ldt >= k. computeType host input Data type of computation. bufferOnDevice device in/out Device workspace. Array of type void of size workspaceInBytesOnDevice bytes. workspaceInBytesOnDevice host input Size in bytes of bufferOnDevice, returned by cusolverDnXlarft\_bufferSize. bufferOnHost host in/out Host workspace. Array of type void of size workspaceInBytesOnHost bytes. workspaceInBytesOnHost host input Size in bytes of bufferOnHost, returned by cusolverDnXlarft\_bufferSize. The generic API has four different types: dataTypeV is data type of the array V dataTypeTau is data type of the array tau dataTypeT is data type of the array T computeType is compute type of the operation cusolverDnXlarft only supports the following four combinations. Valid combinations of data types and compute types DataTypeV DataTypeTau DataTypeT ComputeType Meaning CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F SLARFT CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F DLARFT CUDA\_C\_32F CUDA\_C\_32F CUDA\_C\_32F CUDA\_C\_32F CLARFT CUDA\_C\_64F CUDA\_C\_64F CUDA\_C\_64F CUDA\_C\_64F ZLARFT Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n == 0, k > n, or storev == CUBLAS\_STOREV\_ROWWISE). CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.4.5. Dense Eigenvalue Solver Reference (64-bit API) This section describes eigenvalue solver API of cuSolverDN, including bidiagonalization and SVD. 2.4.5.1. cusolverDnXgesvd() The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverDnXgesvd\_bufferSize( cusolverDnHandle\_t handle, cusolverDnParams\_t params, signed char jobu, signed char jobvt, int64\_t m, int64\_t n, cudaDataType dataTypeA, const void \*A, int64\_t lda, cudaDataType dataTypeS, const void \*S, cudaDataType dataTypeU, const void \*U, int64\_t ldu, cudaDataType dataTypeVT, const void \*VT, int64\_t ldvt, cudaDataType computeType, size\_t \*workspaceInBytesOnDevice, size\_t \*workspaceInBytesOnHost) The following routine: cusolverStatus\_t cusolverDnXgesvd( cusolverDnHandle\_t handle, cusolverDnParams\_t params, signed char jobu, signed char jobvt, int64\_t m, int64\_t n, cudaDataType dataTypeA, void \*A, int64\_t lda, cudaDataType dataTypeS, void \*S, cudaDataType dataTypeU, void \*U, int64\_t ldu, cudaDataType dataTypeVT, void \*VT, int64\_t ldvt, cudaDataType computeType, void \*bufferOnDevice, size\_t workspaceInBytesOnDevice, void \*bufferOnHost, size\_t workspaceInBytesOnHost, int \*info) This function computes the singular value decomposition (SVD) of an \\(m \\times n\\) matrix A and corresponding the left and/or right singular vectors. The SVD is written \\\[A = U\*\\Sigma\*V^{H}\\\] where Σ is an \\(m \\times n\\) matrix which is zero except for its min(m,n) diagonal elements, U is an \\(m \\times m\\) unitary matrix, and V is an \\(n \\times n\\) unitary matrix. The diagonal elements of Σ are the singular values of A; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of U and V are the left and right singular vectors of A. The user has to provide device and host working spaces which are pointed by input parameters bufferOnDevice and bufferOnHost. The input parameters workspaceInBytesOnDevice (and workspaceInBytesOnHost) is size in bytes of the device (and host) working space, and it is returned by cusolverDnXgesvd\_bufferSize(). If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle). if bdsqr did not converge, info specifies how many superdiagonals of an intermediate bidiagonal form did not converge to zero. Currently, cusolverDnXgesvd supports only the default algorithm. Algorithms supported by cusolverDnXgesvd CUSOLVER\_ALG\_0 or NULL Default algorithm. Please visit cuSOLVER Library Samples - Xgesvd for a code example. Remark 1: gesvd only supports m>=n. Remark 2: the routine returns \\(V^H\\), not V. List of input arguments for cusolverDnXgesvd\_bufferSize and cusolverDnXgesvd: API of cusolverDnXgesvd Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. params host input Structure with information collected by cusolverDnSetAdvOptions. jobu host input Specifies options for computing all or part of the matrix U: = ‘A’: all m columns of U are returned in array U: = ‘S’: the first min(m,n) columns of U (the left singular vectors) are returned in the array U; = ‘O’: the first min(m,n) columns of U (the left singular vectors) are overwritten on the array A; = ‘N’: no columns of U (no left singular vectors) are computed. jobvt host input Specifies options for computing all or part of the matrix V\*\*T: = ‘A’: all N rows of V\*\*T are returned in the array VT; = ‘S’: the first min(m,n) rows of V\*\*T (the right singular vectors) are returned in the array VT; = ‘O’: the first min(m,n) rows of V\*\*T (the right singular vectors) are overwritten on the array A; = ‘N’: no rows of V\*\*T (no right singular vectors) are computed. m host input Number of rows of matrix A. n host input Number of columns of matrix A. dataTypeA host input Data type of array A. A device in/out Array of dimension lda \* n with lda is not less than max(1,m). On exit, the contents of A are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix A. dataTypeS host input Data type of array S. S device output Real array of dimension min(m,n). The singular values of A, sorted so that S(i) >= S(i+1). dataTypeU host input Data type of array U. U device output Array of dimension ldu \* m with ldu is not less than max(1,m). U contains the \\(m \\times m\\) unitary matrix U. ldu host input Leading dimension of two-dimensional array used to store matrix U. dataTypeVT host input Data type of array VT. VT device output Array of dimension ldvt \* n with ldvt is not less than max(1,n). VT contains the \\(n \\times n\\) unitary matrix V\*\*T. ldvt host input Leading dimension of two-dimensional array used to store matrix Vt. computeType host input Data type of computation. bufferOnDevice device in/out Device workspace. Array of type void of size workspaceInBytesOnDevice bytes. workspaceInBytesOnDevice host input Size in bytes of bufferOnDevice, returned by cusolverDnXgesvd\_bufferSize. bufferOnHost host in/out Host workspace. Array of type void of size workspaceInBytesOnHost bytes. workspaceInBytesOnHost host input Size in bytes of bufferOnHost, returned by cusolverDnXgesvd\_bufferSize. info device output If info = 0, the operation is successful. If info = -i, the i-th parameter is wrong (not counting handle). If info > 0, info indicates how many superdiagonals of an intermediate bidiagonal form did not converge to zero. The generic API has three different types, dataTypeA is data type of the matrix A, dataTypeS is data type of the vector S and dataTypeU is data type of the matrix U, dataTypeVT is data type of the matrix VT, computeType is compute type of the operation. cusolverDnXgesvd only supports the following four combinations. Valid combination of data type and compute type DataTypeA DataTypeS DataTypeU DataTypeVT ComputeType Meaning CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F SGESVD CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F DGESVD CUDA\_C\_32F CUDA\_R\_32F CUDA\_C\_32F CUDA\_C\_32F CUDA\_C\_32F CGESVD CUDA\_C\_64F CUDA\_R\_64F CUDA\_C\_64F CUDA\_C\_64F CUDA\_C\_64F ZGESVD Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or lda \=m as well. Remark 2: the routine returns V, not \\(V^{H}\\) List of input arguments for cusolverDnXgesvdp\_bufferSize and cusolverDnXgesvdp: API of cusolverDnXgesvdp Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. params host input Structure with information collected by cusolverDnSetAdvOptions. jobz host input Specifies options to either compute singular values only or compute singular vectors as well: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute singular values only. jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute singular values and singular vectors. econ host input econ = 1 for economy size for U and V. m host input Number of rows of matrix A. n host input Number of columns of matrix A. dataTypeA host input Data type of array A. A device in/out Array of dimension lda \* n with lda is not less than max(1,m). On exit, the contents of A are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix A. dataTypeS host input Data type of array S. S device output Real array of dimension min(m,n). The singular values of A, sorted so that S(i) >= S(i+1). dataTypeU host input Data type of array U. U device output Array of dimension ldu \* m with ldu is not less than max(1,m). U contains the \\(m \\times m\\) unitary matrix U. If econ=1, only reports first min(m,n) columns of U. ldu host input Leading dimension of two-dimensional array used to store matrix U. dataTypeV host input Data type of array V. V device output Array of dimension ldv \* n with ldv is not less than max(1,n). V contains the \\(n \\times n\\) unitary matrix V. if econ=1, only reports first min(m,n) columns of V. ldv host input Leading dimension of two-dimensional array used to store matrix V. computeType host input Data type of computation. bufferOnDevice device in/out Device workspace. Array of type void of size workspaceInBytesOnDevice bytes. workspaceInBytesOnDevice host input Size in bytes of bufferOnDevice, returned by cusolverDnXgesvdp\_bufferSize. bufferOnHost host in/out Host workspace. Array of type void of size workspaceInBytesOnHost bytes. workspaceInBytesOnHost host input Size in bytes of bufferOnHost, returned by cusolverDnXgesvdp\_bufferSize. info device output If info = 0, the operation is successful. If info = -i, the i-th parameter is wrong (not counting handle). h\_err\_sigma host output Magnitude of the perturbation, showing the accuracy of SVD. The generic API has three different types, dataTypeA is data type of the matrix A, dataTypeS is data type of the vector S and dataTypeU is data type of the matrix U, dataTypeV is data type of the matrix V, computeType is compute type of the operation. cusolverDnXgesvdp only supports the following four combinations: Valid combination of data type and compute type DataTypeA DataTypeS DataTypeU DataTypeV ComputeType Meaning CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F SGESVDP CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F DGESVDP CUDA\_C\_32F CUDA\_R\_32F CUDA\_C\_32F CUDA\_C\_32F CUDA\_C\_32F CGESVDP CUDA\_C\_64F CUDA\_R\_64F CUDA\_C\_64F CUDA\_C\_64F CUDA\_C\_64F ZGESVDP Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or lda \=m as well. Remark 2: the routine returns V, not \\(V^{H}\\) List of input arguments for cusolverDnXgesvdr\_bufferSize and cusolverDnXgesvdr: API of cusolverDnXgesvdr Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. params host input Structure with information collected by cusolverDnSetAdvOptions. jobu host input Specifies options for computing all or part of the matrix U: = ‘S’: the first k columns of U (the left singular vectors) are returned in the array U; = ‘N’: no columns of U (no left singular vectors) are computed. jobv host input Specifies options for computing all or part of the matrix V: = ‘S’: the first k rows of V (the right singular vectors) are returned in the array V; = ‘N’: no rows of V (no right singular vectors) are computed. m host input Number of rows of matrix A. n host input Number of columns of matrix A. k host input Rank of the k-SVD decomposition of matrix A. rank is less than min(m,n). p host input Oversampling. The size of the subspace will be (k + p). (k+p) is less than min(m,n). niters host input Number of iteration of power method. dataTypeA host input Data type of array A. A device in/out Array of dimension lda \* n with lda is not less than max(1,m). On exit, the contents of A are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix A. dataTypeS host input Data type of array S. S device output Real array of dimension min(m,n). The singular values of A, sorted so that S(i) >= S(i+1). dataTypeU host input Data type of array U. U device output Array of dimension ldu \* m with ldu is not less than max(1,m). U contains the \\(m \\times m\\) unitary matrix U. if jobu=S, only reports first min(m,n) columns of U. ldu host input Leading dimension of two-dimensional array used to store matrix U. dataTypeV host input Data type of array V. V device output Array of dimension ldv \* n with ldv is not less than max(1,n). V contains the \\(n \\times n\\) unitary matrix V. If jobv=S, only reports first min(m,n) columns of V. ldv host input Leading dimension of two-dimensional array used to store matrix V. computeType host input Data type of computation. bufferOnDevice device in/out Device workspace. Array of type void of size workspaceInBytesOnDevice bytes. workspaceInBytesOnDevice host input Size in bytes of bufferOnDevice, returned by cusolverDnXgesvdr\_bufferSize. bufferOnHost host in/out Host workspace. Array of type void of size workspaceInBytesOnHost bytes. workspaceInBytesOnHost host input Size in bytes of bufferOnHost, returned by cusolverDnXgesvdr\_bufferSize. d\_info device output If info = 0, the operation is successful. If info = -i, the i-th parameter is wrong (not counting handle). The generic API has five different types, dataTypeA is data type of the matrix A, dataTypeS is data type of the vector S and dataTypeU is data type of the matrix U, dataTypeV is data type of the matrix V, computeType is compute type of the operation. cusolverDnXgesvdr only supports the following four combinations. Valid combination of data type and compute type DataTypeA DataTypeS DataTypeU DataTypeV ComputeType Meaning CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F SGESVDR CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F DGESVDR CUDA\_C\_32F CUDA\_R\_32F CUDA\_C\_32F CUDA\_C\_32F CUDA\_C\_32F CGESVDR CUDA\_C\_64F CUDA\_R\_64F CUDA\_C\_64F CUDA\_C\_64F CUDA\_C\_64F ZGESVDR Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n<0 or lda 0), info indicates i off-diagonal elements of an intermediate tridiagonal form did not converge to zero. The generic API has three different types, dataTypeA is data type of the matrix A, dataTypeW is data type of the matrix W and computeType is compute type of the operation. cusolverDnXsyevd 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 SSYEVD CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F DSYEVD CUDA\_C\_32F CUDA\_R\_32F CUDA\_C\_32F CHEEVD CUDA\_C\_64F CUDA\_R\_64F CUDA\_C\_64F ZHEEVD Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, or lda vu. Not referenced if range = CUSOLVER\_EIG\_RANGE\_ALL or range = CUSOLVER\_EIG\_RANGE\_I. Note that, if eigenvalues are very close to each other, it is well known that two different eigenvalues routines might find slightly different number of eigenvalues inside the same interval. This is due to the fact that different eigenvalue algorithms, or even same algorithm but different run might find eigenvalues within some rounding error close to the machine precision. Thus, if the user want to be sure not to miss any eigenvalue within the interval bound, we suggest that, the user subtract/add epsilon (machine precision) to the interval bound such as (vl=vl-eps, vu=vu+eps\]. this suggestion is valid for any selective routine from cuSolver or LAPACK. il,iu host input Integer. If range = CUSOLVER\_EIG\_RANGE\_I, the indices (in ascending order) of the smallest and largest eigenvalues to be returned. 1 <= il <= iu <= n, if n > 0; il = 1 and iu = 0 if n = 0. Not referenced if range = CUSOLVER\_EIG\_RANGE\_ALL or range = CUSOLVER\_EIG\_RANGE\_V. h\_meig host output Integer. The total number of eigenvalues found. 0 <= h\_meig <= n. If range = CUSOLVER\_EIG\_RANGE\_ALL, h\_meig = n, and if range = CUSOLVER\_EIG\_RANGE\_I, h\_meig = iu-il+1. dataTypeW host in Data type of array W. W device output A real array of dimension n. The eigenvalue values of A, in ascending order, i.e., sorted so that W(i) <= W(i+1). computeType host in Data type of computation. bufferOnDevice device in/out Device workspace. Array of type void of size workspaceInBytesOnDevice bytes. workspaceInBytesOnDevice host input Size in bytes of bufferOnDevice, returned by cusolverDnXsyevdx\_bufferSize. bufferOnHost host in/out Host workspace. Array of type void of size workspaceInBytesOnHost bytes. workspaceInBytesOnHost host input Size in bytes of bufferOnHost, returned by cusolverDnXsyevdx\_bufferSize. info device output If info = 0, the operation is successful. if info = -i, the i-th parameter is wrong (not counting handle). If info = i (> 0), info indicates i off-diagonal elements of an intermediate tridiagonal form did not converge to zero. The generic API has three different types, dataTypeA is data type of the matrix A, dataTypeW is data type of the matrix W and computeType is compute type of the operation. cusolverDnXsyevdx 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 SSYEVDX CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F DSYEVDX CUDA\_C\_32F CUDA\_R\_32F CUDA\_C\_32F CHEEVDX CUDA\_C\_64F CUDA\_R\_64F CUDA\_C\_64F ZHEEVDX Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, or lda 0, syevBatched does not converge on the i-th matrix. If jobz = 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 n\*lda\*batchSize<=INT32\_MAX primarily due to the current implementation constraints. Algorithms supported by cusolverDnXsyevBatched CUSOLVER\_ALG\_0 or NULL Default. May switch between algorithms for best performance. CUSOLVER\_ALG\_1 Uses a single algorithm for consistent accuracy over all n. List of input arguments for cusolverDnXsyevBatched\_bufferSize and cusolverDnXsyevBatched: API of cusolverDnXsyevBatched Parameter Memory In/out Meaning handle host input Handle to the cuSolverDN library context. params host input Structure with information collected by cusolverDnSetAdvOptions. jobz host input Specifies options to either compute eigenvalue only or compute eigen-pair: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute eigenvalues only; jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute eigenvalues and eigenvectors. uplo host input Specifies which part of A is stored. uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of A is stored. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of A is stored. n host input Number of rows (or columns) of matrix A. dataTypeA host in Data type of array A. A device in/out Array of dimension lda \* n \* batchSize with lda is not less than max(1,n). If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading n-by-n upper triangular part of Aj contains the upper triangular part of the matrix Aj. If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading n-by-n lower triangular part of Aj contains the lower triangular part of the matrix Aj. On exit, if jobz = CUSOLVER\_EIG\_MODE\_VECTOR, and info\[j\] = 0, Aj contains the orthonormal eigenvectors of the matrix Aj. If jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR, the contents of Aj are destroyed. lda host input Leading dimension of two-dimensional array used to store matrix Aj.lda is not less thanmax(1,n). dataTypeW host in Data type of array W. W device output A real array of dimension n \* batchSize. The eigenvalue values of Aj, in ascending order, i.e., sorted so that Wj(i) <= Wj(i+1). computeType host in Data type of computation. bufferOnDevice device in/out Device workspace. Array of type void of size workspaceInBytesOnDevice bytes. workspaceInBytesOnDevice host input Size in bytes of bufferOnDevice, returned by cusolverDnXsyevBatched\_bufferSize. bufferOnHost host in/out Host workspace. Array of type void of size workspaceInBytesOnHost bytes. workspaceInBytesOnHost host input Size in bytes of bufferOnHost, returned by cusolverDnXsyevBatched\_bufferSize. info device output An integer array of dimension batchSize. If CUSOLVER\_STATUS\_INVALID\_VALUE is returned, info\[0\] = -i (less than zero) indicates i-th parameter is wrong (not counting handle). Otherwise, if info\[i\] = 0, the operation is successful. If info\[i\] > 0, syevBatched does not converge on the i-th matrix. batchSize host input Number of matrices. batchSize is not less than 1. 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 Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n<0, or n\*lda\*batchSize>INT32\_MAX, or lda \= 1. If jobvl = CUSOLVER\_EIG\_MODE\_VECTOR, ldvl >= n. dataTypeVR host in Data type of array VR. VR device output Array of dimension ldvr \* n. If jobvr = CUSOLVER\_EIG\_MODE\_VECTOR, the right eigenvectors v(j) are stored one after another in the columns of VR, in the same order as their eigenvalues. If datatypeVR is complex or the j-th eigenvalue is real, then v(j) = VR(:,j), the j-th column of VR. If dataTypeVR is real and the j-th and (j+1)-st eigenvalues form a complex conjugate pair, then v(j) = VR(:,j) + i\*VR(:,j+1) and v(j+1) = VR(:,j) - i\*VR(:,j+1). If jobvr = CUSOLVER\_EIG\_MODE\_NOVECTOR, VR is not referenced. ldvr host input Leading dimension of two-dimensional array used to store matrix VR with ldvr >= 1. If jobvr = CUSOLVER\_EIG\_MODE\_VECTOR, ldvr >= n. computeType host in Data type of computation. bufferOnDevice device in/out Device workspace. Array of type void of size workspaceInBytesOnDevice bytes. workspaceInBytesOnDevice host input Size in bytes of bufferOnDevice, returned by cusolverDnXgeev\_bufferSize. bufferOnHost host in/out Host workspace. Array of type void of size workspaceInBytesOnHost bytes. workspaceInBytesOnHost host input Size in bytes of bufferOnHost, returned by cusolverDnXgeev\_bufferSize. info device output If info = 0, the operation is successful. If info = -i, the i-th parameter is wrong (not counting handle). If info = i (greater than zero), the QR algorithm failed to compute all the eigenvalues and no eigenvectors have been computed; elements i+1:n of W contain eigenvalues which have converged. The generic API has five different types, dataTypeA is the data type of the matrix A, dataTypeW is the data type of the array W, dataTypeVL is the data type of the matrix VL, dataTypeVR is the data type of the matrix VR and computeType is compute type of the operation. cusolverDnXgeev only supports the following four combinations: Valid combination of data type and compute type DataTypeA DataTypeW DataTypeVL DataTypeVR ComputeType Meaning CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F SGEEV CUDA\_R\_32F CUDA\_C\_32F CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F 32F mixed real-complex CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F DGEEV CUDA\_R\_64F CUDA\_C\_64F CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F 64F mixed real-complex CUDA\_C\_32F CUDA\_C\_32F CUDA\_C\_32F CUDA\_C\_32F CUDA\_C\_32F CGEEV CUDA\_C\_64F CUDA\_C\_64F CUDA\_C\_64F CUDA\_C\_64F CUDA\_C\_64F ZGEEV Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (jobvl is not CUSOLVER\_EIG\_MODE\_NOVECTOR or CUSOLVER\_EIG\_MODE\_VECTOR, or jobvr is not CUSOLVER\_EIG\_MODE\_NOVECTOR or CUSOLVER\_EIG\_MODE\_VECTOR, n<0, or lda < max(1,n), or ldvl < n if jobvl is CUSOLVER\_EIG\_MODE\_VECTOR, or ldvr < n if jobvr is CUSOLVER\_EIG\_MODE\_VECTOR). CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.5. cuSolverSP: sparse LAPACK Function Reference \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] cuSolverSP is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. This section describes the API of cuSolverSP, which provides a subset of LAPACK functions for sparse matrices in CSR or CSC format. 2.5.1. Helper Function Reference 2.5.1.1. cusolverSpCreate() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverSpCreate(cusolverSpHandle\_t \*handle) This function initializes the cuSolverSP library and creates a handle on the cuSolver context. It must be called before any other cuSolverSP API function is invoked. It allocates hardware resources necessary for accessing the GPU. Output handle The pointer to the handle to the cuSolverSP context. Status Returned CUSOLVER\_STATUS\_SUCCESS The initialization succeeded. CUSOLVER\_STATUS\_NOT\_INITIALIZED The CUDA Runtime initialization failed. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. 2.5.1.2. cusolverSpDestroy() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverSpDestroy(cusolverSpHandle\_t handle) This function releases CPU-side resources used by the cuSolverSP library. Input handle The handle to the cuSolverSP context. Status Returned CUSOLVER\_STATUS\_SUCCESS The shutdown succeeded. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.5.1.3. cusolverSpSetStream() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverSpSetStream(cusolverSpHandle\_t handle, cudaStream\_t streamId) This function sets the stream to be used by the cuSolverSP library to execute its routines. Input handle The handle to the cuSolverSP context. streamId The stream to be used by the library. Status Returned CUSOLVER\_STATUS\_SUCCESS The stream was set successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.5.1.4. cusolverSpXcsrissym() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. cusolverStatus\_t cusolverSpXcsrissymHost(cusolverSpHandle\_t handle, int m, int nnzA, const cusparseMatDescr\_t descrA, const int \*csrRowPtrA, const int \*csrEndPtrA, const int \*csrColIndA, int \*issym); This function checks if A has symmetric pattern or not. The output parameter issym reports 1 if A is symmetric; otherwise, it reports 0. The matrix A is an \\(m \\times m\\) sparse matrix that is defined in CSR storage format by the four arrays csrValA, csrRowPtrA, csrEndPtrA and csrColIndA. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. The csrlsvlu and csrlsvqr do not accept non-general matrix. the user has to extend the matrix into its missing upper/lower part, otherwise the result is not expected. The user can use csrissym to check if the matrix has symmetric pattern or not. Remark 1: only CPU path is provided. Remark 2: the user has to check returned status to get valid information. The function converts A to CSC format and compare CSR and CSC format. If the CSC failed because of insufficient resources, issym is undefined, and this state can only be detected by the return status code. Input Parameter MemorySpace Description handle host Handle to the cuSolverSP library context. m host Number of rows and columns of matrix A. nnzA host Number of nonzeros of matrix A. It is the size of csrValA and csrColIndA. descrA host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrRowPtrA host Integer array of m elements that contains the start of every row. csrEndPtrA host Integer array of m elements that contains the end of the last row plus one. csrColIndA host Integer array of nnzAcolumn indices of the nonzero elements of matrix A. Output Parameter MemorySpace Description issym host 1 if A is symmetric; 0 otherwise. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,nnzA<=0), base index is not 0 or 1. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.2. High Level Function Reference This section describes high level API of cuSolverSP, including linear solver, least-square solver and eigenvalue solver. The high-level API is designed for ease-of-use, so it allocates any required memory under the hood automatically. If the host or GPU system memory is not enough, an error is returned. 2.5.2.1. cusolverSp csrlsvlu() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverSpScsrlsvlu\[Host\](cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const float \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const float \*b, float tol, int reorder, float \*x, int \*singularity); cusolverStatus\_t cusolverSpDcsrlsvlu\[Host\](cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const double \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const double \*b, double tol, int reorder, double \*x, int \*singularity); cusolverStatus\_t cusolverSpCcsrlsvlu\[Host\](cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const cuComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const cuComplex \*b, float tol, int reorder, cuComplex \*x, int \*singularity); cusolverStatus\_t cusolverSpZcsrlsvlu\[Host\](cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const cuDoubleComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const cuDoubleComplex \*b, double tol, int reorder, cuDoubleComplex \*x, int \*singularity); This function solves the linear system \\\[A\*x = b\\\] where A is an \\(n \\times n\\) sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA, and csrColIndA. b is the right-hand-side vector of size n, and x is the solution vector of size n. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. If matrix A is symmetric/Hermitian and only lower/upper part is used or meaningful, the user has to extend the matrix into its missing upper/lower part, otherwise the result would be wrong. The linear system is solved by sparse LU with partial pivoting: \\\[P\*A = L\*U\\\] cusolver library provides three reordering schemes, symrcmsymamd, and csrmetisnd to reduce zero fill-in which dramatically affects the performance of LU factorization. The input parameter reorder can enable symrcm (symamd or csrmetisnd) if reorder is 1 (2, or 3), otherwise, no reordering is performed. If reorder is nonzero, csrlsvlu does \\\[P\*A\*Q^{T} = L\*U\\\] where \\(Q = {symrcm}(A + A^{T})\\). If A is singular under given tolerance (max(tol,0)), then some diagonal elements of U is zero, i.e. \\\[{|U(j,j)|} < {tol\\ for\\ some\\ j}\\\] The output parameter singularity is the smallest index of such j. If A is non-singular, singularity is -1. The index is base-0, independent of base index of A. For example, if 2nd column of A is the same as first column, then A is singular and singularity = 1 which means U(1,1)≈0. Remark 1: csrlsvlu performs traditional LU with partial pivoting, the pivot of k-th column is determined dynamically based on the k-th column of intermediate matrix. csrlsvlu follows Gilbert and Peierls’s algorithm \[4\] which uses depth-first-search and topological ordering to solve triangular system (Davis also describes this algorithm in detail in his book \[1\]). Since CUDA 10.1, csrlsvlu will incrementally reallocate the memory to store L and U. This feature can avoid over-estimate size from QR factorization. In some cases, zero fill-in of QR can be order of magnitude higher than LU. Remark 2: only CPU (Host) path is provided. Input Parameter cusolverSp MemSpace \*Host MemSpace Description handle host host Handle to the cuSolverSP library context. n host host Number of rows and columns of matrix A. nnzA host host Number of nonzeros of matrix A. descrA host host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrValA device host array of nnzA\\(( =\\)csrRowPtrA(n)\\(-\\)csrRowPtrA(0)\\()\\) nonzero elements of matrix A. csrRowPtrA device host Integer array of n\\(+ 1\\) elements that contains the start of every row and the end of the last row plus one. csrColIndA device host Integer array of nnzA\\(( =\\)csrRowPtrA(n)\\(-\\)csrRowPtrA(0)\\()\\) column indices of the nonzero elements of matrix A. b device host Right hand side vector of size n. tol host host Tolerance to decide if singular or not. reorder host host No ordering if reorder=0. Otherwise, symrcm, symamd, or csrmetisnd is used to reduce zero fill-in. Output Parameter cusolverSp MemSpace \*Host MemSpace Description x device host Solution vector of size n, x = inv(A)\*b. singularity host host -1 if A is invertible. Otherwise, first index j such that U(j,j)≈0 Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n,nnzA<=0, base index is not 0 or 1, reorder is not 0,1,2,3). CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.2.2. cusolverSp csrlsvqr() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. cusolverStatus\_t cusolverSpScsrlsvqr\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const float \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const float \*b, float tol, int reorder, float \*x, int \*singularity); cusolverStatus\_t cusolverSpDcsrlsvqr\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const double \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const double \*b, double tol, int reorder, double \*x, int \*singularity); cusolverStatus\_t cusolverSpCcsrlsvqr\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const cuComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const cuComplex \*b, float tol, int reorder, cuComplex \*x, int \*singularity); cusolverStatus\_t cusolverSpZcsrlsvqr\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const cuDoubleComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const cuDoubleComplex \*b, double tol, int reorder, cuDoubleComplex \*x, int \*singularity); This function solves the linear system \\\[A\*x = b\\\] A is an \\(m \\times m\\) sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA, and csrColIndA. b is the right-hand-side vector of size m, and x is the solution vector of size m. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. If matrix A is symmetric/Hermitian and only lower/upper part is used or meaningful, the user has to extend the matrix into its missing upper/lower part, otherwise the result would be wrong. The linear system is solved by sparse QR factorization, \\\[A\\ =\\ Q\*R\\\] If A is singular under given tolerance (max(tol,0)), then some diagonal elements of R is zero, i.e. \\\[{|R(j,j)|} < {tol\\ for\\ some\\ j}\\\] The output parameter singularity is the smallest index of such j. If A is non-singular, singularity is -1. The singularity is base-0, independent of base index of A. For example, if 2nd column of A is the same as first column, then A is singular and singularity = 1 which means R(1,1)≈0. cusolver library provides three reordering schemes, symrcmsymamd, and csrmetisnd to reduce zero fill-in which dramatically affects the performance of QR factorization. The input parameter reorder can enable symrcm (symamd or csrmetisnd) if reorder is 1 (2, or 3), otherwise, no reordering is performed. Input Parameter cusolverSp MemSpace \*Host MemSpace Description handle host host Handle to the cuSolverSP library context. m host host Number of rows and columns of matrix A. nnz host host Number of nonzeros of matrix A. descrA host host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrValA device host array of nnz\\(( =\\)csrRowPtrA(m)\\(-\\)csrRowPtrA(0)\\()\\) nonzero elements of matrix A. csrRowPtrA device host Integer array of m\\(+ 1\\) elements that contains the start of every row and the end of the last row plus one. csrColIndA device host Integer array of nnz\\(( =\\)csrRowPtrA(m)\\(-\\)csrRowPtrA(0)\\()\\) column indices of the nonzero elements of matrix A. b device host Right hand side vector of size m. tol host host Tolerance to decide if singular or not. reorder host host No ordering if reorder=0. Otherwise, symrcm, symamd, or csrmetisnd is used to reduce zero fill-in. Output Parameter cusolverSp MemSpace \*Host MemSpace Description x device host Solution vector of size m, x = inv(A)\*b. singularity host host -1 if A is invertible. Otherwise, first index j such that R(j,j)≈0 Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,nnz<=0, base index is not 0 or 1, reorder is not 0,1,2,3) CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.2.3. cusolverSp csrlsvchol() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverSpScsrlsvchol\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const float \*csrVal, const int \*csrRowPtr, const int \*csrColInd, const float \*b, float tol, int reorder, float \*x, int \*singularity); cusolverStatus\_t cusolverSpDcsrlsvchol\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const double \*csrVal, const int \*csrRowPtr, const int \*csrColInd, const double \*b, double tol, int reorder, double \*x, int \*singularity); cusolverStatus\_t cusolverSpCcsrlsvchol\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const cuComplex \*csrVal, const int \*csrRowPtr, const int \*csrColInd, const cuComplex \*b, float tol, int reorder, cuComplex \*x, int \*singularity); cusolverStatus\_t cusolverSpZcsrlsvchol\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const cuDoubleComplex \*csrVal, const int \*csrRowPtr, const int \*csrColInd, const cuDoubleComplex \*b, double tol, int reorder, cuDoubleComplex \*x, int \*singularity); This function solves the linear system \\\[A\*x = b\\\] A is an \\(m \\times m\\) symmetric positive definite sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA, and csrColIndA. b is the right-hand-side vector of size m, and x is the solution vector of size m. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL and upper triangular part of A is ignored (if parameter reorder is zero). In other words, suppose input matrix A is decomposed as \\(A = L + D + U\\), where L is lower triangular, D is diagonal and U is upper triangular. The function would ignore U and regard A as a symmetric matrix with the formula \\(A = L + D + L^{H}\\). If parameter reorder is nonzero, the user has to extend A to a full matrix, otherwise the solution would be wrong. The linear system is solved by sparse Cholesky factorization, \\\[A = G\*G^{H}\\\] where G is the Cholesky factor, a lower triangular matrix. The output parameter singularity has two meanings: If A is not positive definite, there exists some integer k such that A(0:k, 0:k) is not positive definite. singularity is the minimum of such k. If A is positive definite but near singular under tolerance (max(tol,0)), i.e. there exists some integer k such that \\(G\\begin{pmatrix} {k,k} \\\\ \\end{pmatrix}<={tol}\\). singularity is the minimum of such k. singularity is base-0. If A is positive definite and not near singular under tolerance, singularity is -1. If the user wants to know if A is positive definite or not, tol=0 is enough. cusolver library provides three reordering schemes, symrcmsymamd, and csrmetisnd to reduce zero fill-in which dramatically affects the performance of Cholesky factorization. The input parameter reorder can enable symrcm (symamd or csrmetisnd) if reorder is 1 (2, or 3), otherwise, no reordering is performed. Remark 1: the function works for in-place (x and b point to the same memory block) and out-of-place. Remark 2: the function only works on 32-bit index, if matrix G has large zero fill-in such that number of nonzeros is bigger than \\(2^{31}\\), then CUSOLVER\_STATUS\_ALLOC\_FAILED is returned. Input Parameter cusolverSp MemSpace \*Host MemSpace Description handle host host Handle to the cuSolverSP library context. m host host Number of rows and columns of matrix A. nnz host host Number of nonzeros of matrix A. descrA host host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrValA device host array of nnz\\(( =\\)csrRowPtrA(m)\\(-\\)csrRowPtrA(0)\\()\\) nonzero elements of matrix A. csrRowPtrA device host Integer array of m\\(+ 1\\) elements that contains the start of every row and the end of the last row plus one. csrColIndA device host Integer array of nnz\\(( =\\)csrRowPtrA(m)\\(-\\)csrRowPtrA(0)\\()\\) column indices of the nonzero elements of matrix A. b device host Right hand side vector of size m. tol host host Tolerance to decide singularity. reorder host host No ordering if reorder=0. Otherwise, symrcm, symamd, or csrmetisnd is used to reduce zero fill-in. Output Parameter cusolverSp MemSpace \*Host MemSpace Description x device host Solution vector of size m, x = inv(A)\*b. singularity host host -1 if A is symmetric positive definite. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,nnz<=0, base index is not 0 or 1, reorder is not 0,1,2,3). CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.2.4. cusolverSp csrlsqvqr() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverSpScsrlsqvqr\[Host\](cusolverSpHandle\_t handle, int m, int n, int nnz, const cusparseMatDescr\_t descrA, const float \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const float \*b, float tol, int \*rankA, float \*x, int \*p, float \*min\_norm); cusolverStatus\_t cusolverSpDcsrlsqvqr\[Host\](cusolverSpHandle\_t handle, int m, int n, int nnz, const cusparseMatDescr\_t descrA, const double \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const double \*b, double tol, int \*rankA, double \*x, int \*p, double \*min\_norm); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverSpCcsrlsqvqr\[Host\](cusolverSpHandle\_t handle, int m, int n, int nnz, const cusparseMatDescr\_t descrA, const cuComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const cuComplex \*b, float tol, int \*rankA, cuComplex \*x, int \*p, float \*min\_norm); cusolverStatus\_t cusolverSpZcsrlsqvqr\[Host\](cusolverSpHandle\_t handle, int m, int n, int nnz, const cusparseMatDescr\_t descrA, const cuDoubleComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const cuDoubleComplex \*b, double tol, int \*rankA, cuDoubleComplex \*x, int \*p, double \*min\_norm); This function solves the following least-square problem: \\\[x = {argmin}{\\|}A\*z - b{\\|}\\\] A is an \\(m \\times n\\) sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA, and csrColIndA. b is the right-hand-side vector of size m, and x is the least-square solution vector of size n. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. If A is square, symmetric/Hermitian and only lower/upper part is used or meaningful, the user has to extend the matrix into its missing upper/lower part, otherwise the result is wrong. This function only works if m is greater or equal to n, in other words, A is a tall matrix. The least-square problem is solved by sparse QR factorization with column pivoting, \\\[A\*P^{T} = Q\*R\\\] If A is of full rank (i.e. all columns of A are linear independent), then matrix P is an identity. Suppose rank of A is k, less than n, the permutation matrix P reorders columns of A in the following sense: \\\[\\begin{split}A\*P^{T} = \\begin{pmatrix} A\_1 & A\_2 \\\\ \\end{pmatrix} = \\begin{pmatrix} Q\_1 & Q\_2 \\\\ \\end{pmatrix}\\begin{pmatrix} R\_{11} & R\_{12} \\\\ & R\_{22} \\\\ \\end{pmatrix}\\end{split}\\\] where \\(R\_{11}\\) and A have the same rank, but \\(R\_{22}\\) is almost zero, i.e. every column of \\(A\_{2}\\) is linear combination of \\(A\_{1}\\). The input parameter tol decides numerical rank. The absolute value of every entry in \\(R\_{22}\\) is less than or equal to tolerance=max(tol,0). The output parameter rankA denotes numerical rank of A. Suppose \\(y = P\*x\\) and \\(c = Q^{H}\*b\\), the least square problem can be reformed by \\\[\\left. \\min\\|A\*x - b\\| = \\min\\|R\*y - c \\right.\\|\\\] or in matrix form \\\[\\begin{split}\\begin{pmatrix} R\_{11} & R\_{12} \\\\ & R\_{22} \\\\ \\end{pmatrix}\\begin{pmatrix} y\_{1} \\\\ y\_{2} \\\\ \\end{pmatrix} = \\begin{pmatrix} c\_{1} \\\\ c\_{2} \\\\ \\end{pmatrix}\\end{split}\\\] The output parameter min\_norm is \\(\\left. \\|c\_{2} \\right.\\|\\), which is minimum value of least-square problem. If A is not of full rank, above equation does not have a unique solution. The least-square problem is equivalent to \\\[\\begin{split}\\begin{matrix} \\left. \\min\\|y \\right.\\| \\\\ {{subject\\ to}R\_{11}\*y\_{1} + R\_{12}\*y\_{2} = c\_{1}} \\\\ \\end{matrix}\\end{split}\\\] Or equivalently another least-square problem \\\[\\begin{split} \\left.min\\| \\begin{pmatrix} R\_{11} \\backslash R\_{12} \\\\ I \\end{pmatrix} \* y\_2 - \\begin{pmatrix} R\_{11} \\backslash c\_1 \\\\ O \\end{pmatrix} \\right.\\|\\end{split}\\\] The output parameter x is \\(P^{T}\*y\\), the solution of least-square problem. The output parameter p is a vector of size n. It corresponds to a permutation matrix P. p(i)=j means (P\*x)(i) = x(j). If A is of full rank, p=0:n-1. Remark 1: p is always base 0, independent of base index of A. Remark 2: only CPU (Host) path is provided. Input Parameter cusolverSp MemSpace \*Host MemSpace Description handle host host Handle to the cuSolver library context. m host host Number of rows of matrix A. n host host Number of columns of matrix A. nnz host host Number of nonzeros of matrix A. descrA host host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrValA device host array of nnz\\(( =\\)csrRowPtrA(m)\\(-\\)csrRowPtrA(0)\\()\\) nonzero elements of matrix A. csrRowPtrA device host Integer array of m\\(+ 1\\) elements that contains the start of every row and the end of the last row plus one. csrColIndA device host Integer array of nnz\\(( =\\)csrRowPtrA(m)\\(-\\)csrRowPtrA(0)\\()\\) column indices of the nonzero elements of matrix A. b device host Right hand side vector of size m. tol host host Tolerance to decide rank of A. Output Parameter cusolverSp MemSpace \*Host MemSpace Description rankA host host Numerical rank of A. x device host Solution vector of size n, x=pinv(A)\*b. p device host A vector of size n, which represents the permutation matrix P satisfying A\*P^T=Q\*R. min\_norm host host ||A\*x-b||, x=pinv(A)\*b. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n,nnz<=0), base index is not 0 or 1. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.2.5. cusolverSp csreigvsi() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverSpScsreigvsi\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const float \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, float mu0, const float \*x0, int maxite, float tol, float \*mu, float \*x); cusolverStatus\_t cusolverSpDcsreigvsi\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const double \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, double mu0, const double \*x0, int maxite, double tol, double \*mu, double \*x); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverSpCcsreigvsi\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const cuComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, cuComplex mu0, const cuComplex \*x0, int maxite, float tol, cuComplex \*mu, cuComplex \*x); cusolverStatus\_t cusolverSpZcsreigvsi(cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const cuDoubleComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, cuDoubleComplex mu0, const cuDoubleComplex \*x0, int maxite, double tol, cuDoubleComplex \*mu, cuDoubleComplex \*x); This function solves the simple eigenvalue problem \\(A\*x = \\lambda\*x\\) by shift-inverse method. A is an \\(m \\times m\\) sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA, and csrColIndA. The output parameter x is the approximated eigenvector of size m, The following shift-inverse method corrects eigenpair step-by-step until convergence. It accepts several parameters: mu0 is an initial guess of eigenvalue. The shift-inverse method will converge to the eigenvalue mu nearest mu0 if mu is a singleton. Otherwise, the shift-inverse method may not converge. x0 is an initial eigenvector. If the user has no preference, just chose x0 randomly. x0 must be nonzero. It can be non-unit length. tol is the tolerance to decide convergence. If tol is less than zero, it would be treated as zero. maxite is maximum number of iterations. It is useful when shift-inverse method does not converge because the tolerance is too small or the desired eigenvalue is not a singleton. Shift-Inverse Method Given an initial guess of eigenvalue μ0 and initial vector x0 \\\[\\begin{split}x (0) = x0 \\text{ of unit length} \\\\ \\text{for }j = 0: maxite \\\\ & \\text{solve } ( A - \\mu0 \* I ) \* x^{k+1} = x^{k} \\\\ & \\text{normalize } x^{k+1} \\text{ to unit length} \\\\ & \\text{compute approx. eigenvalue } \\mu = x^H \* A \* x \\text{ where } x = x^{k+1} \\\\ & if \\| A \* x^{k+1} - \\mu \* x^{k+1} \\| < \\text{ tolerance, then stop} \\\\ \\text{endfor}\\end{split}\\\] The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. If A is symmetric/Hermitian and only lower/upper part is used or meaningful, the user has to extend the matrix into its missing upper/lower part, otherwise the result is wrong. Remark 1: \[cu|h\]solver\[S|D\]csreigvsi only allows mu0 as a real number. This works if A is symmetric. Otherwise, the non-real eigenvalue has a conjugate counterpart on the complex plan, and shift-inverse method would not converge to such eigenvalue even the eigenvalue is a singleton. The user has to extend A to complex numbers and call \[cu|h\]solver\[C|Z\]csreigvsi with mu0 not on real axis. Remark 2: the tolerance tol should not be smaller than |mu0|\*eps, where eps is machine zero. Otherwise, shift-inverse may not converge because of small tolerance. Input Parameter cusolverSp MemSpace \*Host MemSpace Description handle host host Handle to the cuSolver library context. m host host Number of rows and columns of matrix A. nnz host host Number of nonzeros of matrix A. descrA host host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrValA device host array of nnz\\(( =\\)csrRowPtrA(m)\\(-\\)csrRowPtrA(0)\\()\\) nonzero elements of matrix A. csrRowPtrA device host Integer array of m\\(+ 1\\) elements that contains the start of every row and the end of the last row plus one. csrColIndA device host Integer array of nnz\\(( =\\)csrRowPtrA(m)\\(-\\)csrRowPtrA(0)\\()\\) column indices of the nonzero elements of matrix A. mu0 host host Initial guess of eigenvalue. x0 device host Initial guess of eigenvector, a vector of size m. maxite host host Maximum iterations in shift-inverse method. tol host host Tolerance for convergence. Output Parameter cusolverSp MemSpace \*Host MemSpace Description mu device host Approximated eigenvalue nearest mu0 under tolerance. x device host Approximated eigenvector of size m. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,nnz<=0), base index is not 0 or 1. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.2.6. cusolverSp csreigs() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t solverspScsreigs\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const float \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, cuComplex left\_bottom\_corner, cuComplex right\_upper\_corner, int \*num\_eigs); cusolverStatus\_t cusolverSpDcsreigs\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const double \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, cuDoubleComplex left\_bottom\_corner, cuDoubleComplex right\_upper\_corner, int \*num\_eigs); cusolverStatus\_t cusolverSpCcsreigs\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const cuComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, cuComplex left\_bottom\_corner, cuComplex right\_upper\_corner, int \*num\_eigs); cusolverStatus\_t cusolverSpZcsreigs\[Host\](cusolverSpHandle\_t handle, int m, int nnz, const cusparseMatDescr\_t descrA, const cuDoubleComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, cuDoubleComplex left\_bottom\_corner, cuDoubleComplex right\_upper\_corner, int \*num\_eigs); This function computes number of algebraic eigenvalues in a given box B by contour integral \\\[\\text{number of algebraic eigenvalues in box B} = \\frac{1}{2\*\\pi\*\\sqrt{- 1}}\\oint\_{C}\\frac{P^{\\prime}{(z)}}{P(z)}dz\\\] where closed line C is boundary of the box B which is a rectangle specified by two points, one is left bottom corner (input parameter left\_bottom\_corner) and the other is right upper corner (input parameter right\_upper\_corner). P(z)=det(A - z\*I) is the characteristic polynomial of A. A is an \\(m \\times m\\) sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA, and csrColIndA. The output parameter num\_eigs is number of algebraic eigenvalues in the box B. This number may not be accurate due to several reasons: The contour C is close to some eigenvalues or even passes through some eigenvalues. The numerical integration is not accurate due to coarse grid size. The default resolution is 1200 grids along contour C uniformly. Even though csreigs may not be accurate, it still can give the user some idea how many eigenvalues in a region where the resolution of disk theorem is bad. For example, standard 3-point stencil of finite difference of Laplacian operator is a tridiagonal matrix, and disk theorem would show “all eigenvalues are in the interval \[0, 4\*N^2\]” where N is number of grids. In this case, csreigs is useful for any interval inside \[0, 4\*N^2\]. Remark 1: if A is symmetric in real or Hermitian in complex, all eigenvalues are real. The user still needs to specify a box, not an interval. The height of the box can be much smaller than the width. Remark 2: only CPU (Host) path is provided. Input Parameter cusolverSp MemSpace \*Host MemSpace Description handle host host Handle to the cuSolverSP library context. m host host Number of rows and columns of matrix A. nnz host host Number of nonzeros of matrix A. descrA host host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrValA device host array of nnz\\(( =\\)csrRowPtrA(m)\\(-\\)csrRowPtrA(0)\\()\\) nonzero elements of matrix A. csrRowPtrA device host Integer array of m\\(+ 1\\) elements that contains the start of every row and the end of the last row plus one. csrColIndA device host Integer array of nnz\\(( =\\)csrRowPtrA(m)\\(-\\)csrRowPtrA(0)\\()\\) column indices of the nonzero elements of matrix A. left\_bottom\_corner host host Left bottom corner of the box. right\_upper\_corner host host Right upper corner of the box. Output Parameter cusolverSp MemSpace \*Host MemSpace Description num\_eigs host host Number of algebraic eigenvalues in a box. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,nnz<=0), base index is not 0 or 1. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.3. Low Level Function Reference This section describes low level API of cuSolverSP, including symrcm and batched QR. 2.5.3.1. cusolverSpXcsrsymrcm() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. cusolverStatus\_t cusolverSpXcsrsymrcmHost(cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const int \*csrRowPtrA, const int \*csrColIndA, int \*p); This function implements Symmetric Reverse Cuthill-McKee permutation. It returns a permutation vector p such that A(p,p) would concentrate nonzeros to diagonal. This is equivalent to symrcm in MATLAB, however the result may not be the same because of different heuristics in the pseudoperipheral finder. The cuSolverSP library implements symrcm based on the following two papers: E. Cuthill and J. McKee, Reducing the bandwidth of sparse symmetric matrices, ACM ‘69 Proceedings of the 1969 24th national conference, Pages 157-172 Alan George, Joseph W. H. Liu, An Implementation of a Pseudoperipheral Node Finder, ACM Transactions on Mathematical Software (TOMS) Volume 5 Issue 3, Sept. 1979, Pages 284-295 The output parameter p is an integer array of n elements. It represents a permutation array and it indexed using the base-0 convention. The permutation array p corresponds to a permutation matrix P, and satisfies the following relation: \\\[{A(p,p)} = P\*A\*P^{T}\\\] A is an \\(n \\times n\\) sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA, and csrColIndA. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Internally rcm works on \\(A + A^{T}\\), the user does not need to extend the matrix if the matrix is not symmetric. Remark 1: only CPU (Host) path is provided. Input Parameter \*Host MemSpace Description handle host Handle to the cuSolverSP library context. n host Number of rows and columns of matrix A. nnzA host Number of nonzeros of matrix A. It is the size of csrValA and csrColIndA. descrA host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrRowPtrA host Integer array of n+1 elements that contains the start of every row and the end of the last row plus one. csrColIndA host Integer array of nnzAcolumn indices of the nonzero elements of matrix A. Output Parameter hsolver Description p host Permutation vector of size n. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n,nnzA<=0), base index is not 0 or 1. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.3.2. cusolverSpXcsrsymmdq() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. cusolverStatus\_t cusolverSpXcsrsymmdqHost(cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const int \*csrRowPtrA, const int \*csrColIndA, int \*p); This function implements Symmetric Minimum Degree Algorithm based on Quotient Graph. It returns a permutation vector p such that A(p,p) would have less zero fill-in during Cholesky factorization. The cuSolverSP library implements symmdq based on the following two papers: Patrick R. Amestoy, Timothy A. Davis, Iain S. Duff, An Approximate Minimum Degree Ordering Algorithm, SIAM J. Matrix Analysis Applic. Vol 17, no 4, pp. 886-905, Dec. 1996. Alan George, Joseph W. Liu, A Fast Implementation of the Minimum Degree Algorithm Using Quotient Graphs, ACM Transactions on Mathematical Software, Vol 6, No. 3, September 1980, page 337-358. The output parameter p is an integer array of n elements. It represents a permutation array with base-0 index. The permutation array p corresponds to a permutation matrix P, and satisfies the following relation: \\\[{A(p,p)} = P\*A\*P^{T}\\\] A is an \\(n \\times n\\) sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA, and csrColIndA. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Internally mdq works on \\(A + A^{T}\\), the user does not need to extend the matrix if the matrix is not symmetric. Remark 1: only CPU (Host) path is provided. Input Parameter \*Host MemSpace Description handle host Handle to the cuSolverSP library context. n host Number of rows and columns of matrix A. nnzA host Number of nonzeros of matrix A. It is the size of csrValA and csrColIndA. descrA host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrRowPtrA host Integer array of n+1 elements that contains the start of every row and the end of the last row plus one. csrColIndA host Integer array of nnzAcolumn indices of the nonzero elements of matrix A. Output Parameter hsolver Description p host Permutation vector of size n. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n,nnzA<=0), base index is not 0 or 1. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.3.3. cusolverSpXcsrsymamd() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. cusolverStatus\_t cusolverSpXcsrsymamdHost(cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const int \*csrRowPtrA, const int \*csrColIndA, int \*p); This function implements Symmetric Approximate Minimum Degree Algorithm based on Quotient Graph. It returns a permutation vector p such that A(p,p) would have less zero fill-in during Cholesky factorization. The cuSolverSP library implements symamd based on the following paper: Patrick R. Amestoy, Timothy A. Davis, Iain S. Duff, An Approximate Minimum Degree Ordering Algorithm, SIAM J. Matrix Analysis Applic. Vol 17, no 4, pp. 886-905, Dec. 1996. The output parameter p is an integer array of n elements. It represents a permutation array with base-0 index. The permutation array p corresponds to a permutation matrix P, and satisfies the following relation: \\\[{A(p,p)} = P\*A\*P^{T}\\\] A is an \\(n \\times n\\) sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA, and csrColIndA. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Internally amd works on \\(A + A^{T}\\), the user does not need to extend the matrix if the matrix is not symmetric. Remark 1: only CPU (Host) path is provided. Input Parameter \*Host MemSpace Description handle host Handle to the cuSolverSP library context. n host Number of rows and columns of matrix A. nnzA host Number of nonzeros of matrix A. It is the size of csrValA and csrColIndA. descrA host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrRowPtrA host Integer array of n+1 elements that contains the start of every row and the end of the last row plus one. csrColIndA host Integer array of nnzAcolumn indices of the nonzero elements of matrix A. Output Parameter hsolver Description p host Permutation vector of size n. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n,nnzA<=0), base index is not 0 or 1. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.3.4. cusolverSpXcsrmetisnd() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. cusolverStatus\_t cusolverSpXcsrmetisndHost( cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const int \*csrRowPtrA, const int \*csrColIndA, const int64\_t \*options, int \*p); This function is a wrapper of METIS\_NodeND. It returns a permutation vector p such that A(p,p) would have less zero fill-in during nested dissection. The cuSolverSP library links libcusolver\_metis\_static.a which is 64-bit metis-5.1.0. The parameter options is the configuration of metis. For those who do not have experiences of metis, set options = NULL for default setting. The output parameter p is an integer array of n elements. It represents a permutation array with base-0 index. The permutation array p corresponds to a permutation matrix P, and satisfies the following relation: \\\[{A(p,p)} = P\*A\*P^{T}\\\] A is an \\(n \\times n\\) sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA, and csrColIndA. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Internally csrmetisnd works on \\(A + A^{T}\\), the user does not need to extend the matrix if the matrix is not symmetric. Remark 1: only CPU (Host) path is provided. Input Parameter \*Host MemSpace Description handle host Handle to the cuSolverSP library context. n host Number of rows and columns of matrix A. nnzA host Number of nonzeros of matrix A. It is the size of csrValA and csrColIndA. descrA host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrRowPtrA host Integer array of n+1 elements that contains the start of every row and the end of the last row plus one. csrColIndA host Integer array of nnzAcolumn indices of the nonzero elements of matrix A. options host Integer array to configure metis. Output Parameter \*Host MemSpace Description p host Permutation vector of size n. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n,nnzA<=0), base index is not 0 or 1. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.3.5. cusolverSpXcsrzfd() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. cusolverStatus\_t cusolverSpScsrzfdHost( cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const float \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, int \*P, int \*numnz) cusolverStatus\_t cusolverSpDcsrzfdHost( cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const double \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, int \*P, int \*numnz) cusolverStatus\_t cusolverSpCcsrzfdHost( cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const cuComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, int \*P, int \*numnz) cusolverStatus\_t cusolverSpZcsrzfdHost( cusolverSpHandle\_t handle, int n, int nnzA, const cusparseMatDescr\_t descrA, const cuDoubleComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, int \*P, int \*numnz) This function implements MC21, zero-free diagonal algorithm. It returns a permutation vector p such that A(p,:) has no zero diagonal. A is an \\(n \\times n\\) sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA, and csrColIndA. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. The output parameter p is an integer array of n elements. It represents a permutation array with base-0 index. The permutation array p corresponds to a permutation matrix P, and satisfies the following relation: \\\[{A(p,:)} = P\*A\\\] The output parameter numnz describes number of nonzero diagonal in permutated matrix A(p,:). If numnz is less than n, matrix A has structural singularity. Remark 1: only CPU (Host) path is provided. Remark 2: this routine does not maximize diagonal value of permuted matrix. The user cannot expect this routine can make “LU without pivoting” stable. Input Parameter \*Host MemSpace Description handle host Handle to the cuSolverSP library context. n host Number of rows and columns of matrix A. nnzA host Number of nonzeros of matrix A. It is the size of csrValA and csrColIndA. descrA host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrValA host array of nnzA\\(( =\\)csrRowPtrA(m)\\(-\\)csrRowPtrA(0)\\()\\) nonzero elements of matrix A. csrRowPtrA host Integer array of n+1 elements that contains the start of every row and the end of the last row plus one. csrColIndA host Integer array of nnzAcolumn indices of the nonzero elements of matrix A. Output Parameter \*Host MemSpace Description p host Permutation vector of size n. numnz host Number of nonzeros on diagonal of permuted matrix. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (n,nnzA<=0), base index is not 0 or 1. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.3.6. cusolverSpXcsrperm() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. cusolverStatus\_t cusolverSpXcsrperm\_bufferSizeHost(cusolverSpHandle\_t handle, int m, int n, int nnzA, const cusparseMatDescr\_t descrA, int \*csrRowPtrA, int \*csrColIndA, const int \*p, const int \*q, size\_t \*bufferSizeInBytes); cusolverStatus\_t cusolverSpXcsrpermHost(cusolverSpHandle\_t handle, int m, int n, int nnzA, const cusparseMatDescr\_t descrA, int \*csrRowPtrA, int \*csrColIndA, const int \*p, const int \*q, int \*map, void \*pBuffer); Given a left permutation vector p which corresponds to permutation matrix P and a right permutation vector q which corresponds to permutation matrix Q, this function computes permutation of matrix A by \\\[B = P\*A\*Q^T\\\] A is an \\(m \\times n\\) sparse matrix that is defined in CSR storage format by the three arrays csrValA, csrRowPtrA and csrColIndA. The operation is in-place, i.e. the matrix A is overwritten by B. The permutation vector p and q are base 0. p performs row permutation while q performs column permutation. One can also use MATLAB command \\(B = {A(p,q)}\\) to permutate matrix A. This function only computes sparsity pattern of B. The user can use parameter map to get csrValB as well. The parameter map is an input/output. If the user sets map=0:1:(nnzA-1) before calling csrperm, csrValB=csrValA(map). The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. If A is symmetric and only lower/upper part is provided, the user has to pass \\(A + A^{T}\\) into this function. This function requires a buffer size returned by csrperm\_bufferSize(). The address of pBuffer must be a multiple of 128 bytes. If it is not, CUSOLVER\_STATUS\_INVALID\_VALUE is returned. For example, if matrix A is \\\[\\begin{split}A = \\begin{pmatrix} {1.0} & {2.0} & {3.0} \\\\ {4.0} & {5.0} & {6.0} \\\\ {7.0} & {8.0} & {9.0} \\\\ \\end{pmatrix}\\end{split}\\\] and left permutation vector p=(0,2,1), right permutation vector q=(2,1,0), then \\(P\*A\*Q^{T}\\) is \\\[\\begin{split}P\*A\*Q^{T} = \\begin{pmatrix} {3.0} & {2.0} & {1.0} \\\\ {9.0} & {8.0} & {7.0} \\\\ {6.0} & {5.0} & {4.0} \\\\ \\end{pmatrix}\\end{split}\\\] Remark 1: only CPU (Host) path is provided. Remark 2: the user can combine csrsymrcm and csrperm to get \\(P\*A\*P^{T}\\) which has less zero fill-in during QR factorization. Input Parameter cusolverSp MemSpace Description handle host Handle to the cuSolver library context. m host Number of rows of matrix A. n host Number of columns of matrix A. nnzA host Number of nonzeros of matrix A. It is the size of csrValA and csrColIndA. descrA host The descriptor of matrix A. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrRowPtrA host Integer array of m+1 elements that contains the start of every row and end of last row plus one of matrix A. csrColIndA host Integer array of nnzAcolumn indices of the nonzero elements of matrix A. p host Left permutation vector of size m. q host Right permutation vector of size n. map host Integer array of nnzA indices. If the user wants to get relationship between A and B, map must be set 0:1:(nnzA-1). pBuffer host Buffer allocated by the user, the size is returned by csrperm\_bufferSize(). Output Parameter hsolver Description csrRowPtrA host Integer array of m+1 elements that contains the start of every row and end of last row plus one of matrix B. csrColIndA host Integer array of nnzAcolumn indices of the nonzero elements of matrix B. map host Integer array of nnzA indices that maps matrix A to matrix B. pBufferSizeInBytes host Number of bytes of the buffer. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n,nnzA<=0), base index is not 0 or 1. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.5.3.7. cusolverSpXcsrqrBatched() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. The create and destroy methods start and end the lifetime of a csrqrInfo object. cusolverStatus\_t cusolverSpCreateCsrqrInfo(csrqrInfo\_t \*info); cusolverStatus\_t cusolverSpDestroyCsrqrInfo(csrqrInfo\_t info); Analysis is the same for all data types, but each data type has a unique buffer size. cusolverStatus\_t cusolverSpXcsrqrAnalysisBatched(cusolverSpHandle\_t handle, int m, int n, int nnzA, const cusparseMatDescr\_t descrA, const int \*csrRowPtrA, const int \*csrColIndA, csrqrInfo\_t info); cusolverStatus\_t cusolverSpScsrqrBufferInfoBatched(cusolverSpHandle\_t handle, int m, int n, int nnzA, const cusparseMatDescr\_t descrA, const float \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, int batchSize, csrqrInfo\_t info, size\_t \*internalDataInBytes, size\_t \*workspaceInBytes); cusolverStatus\_t cusolverSpDcsrqrBufferInfoBatched(cusolverSpHandle\_t handle, int m, int n, int nnzA, const cusparseMatDescr\_t descrA, const double \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, int batchSize, csrqrInfo\_t info, size\_t \*internalDataInBytes, size\_t \*workspaceInBytes); Calculate buffer sizes for complex valued data types. cusolverStatus\_t cusolverSpCcsrqrBufferInfoBatched(cusolverSpHandle\_t handle, int m, int n, int nnzA, const cusparseMatDescr\_t descrA, const cuComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, int batchSize, csrqrInfo\_t info, size\_t \*internalDataInBytes, size\_t \*workspaceInBytes); cusolverStatus\_t cusolverSpZcsrqrBufferInfoBatched(cusolverSpHandle\_t handle, int m, int n, int nnzA, const cusparseMatDescr\_t descrA, const cuDoubleComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, int batchSize, csrqrInfo\_t info, size\_t \*internalDataInBytes, size\_t \*workspaceInBytes); The S and D data types are real valued single and double precision, respectively. cusolverStatus\_t cusolverSpScsrqrsvBatched(cusolverSpHandle\_t handle, int m, int n, int nnzA, const cusparseMatDescr\_t descrA, const float \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const float \*b, float \*x, int batchSize, csrqrInfo\_t info, void \*pBuffer); cusolverStatus\_t cusolverSpDcsrqrsvBatched(cusolverSpHandle\_t handle, int m, int n, int nnz, const cusparseMatDescr\_t descrA, const double \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const double \*b, double \*x, int batchSize, csrqrInfo\_t info, void \*pBuffer); The C and Z data types are complex valued single and double precision, respectively. cusolverStatus\_t cusolverSpCcsrqrsvBatched(cusolverSpHandle\_t handle, int m, int n, int nnzA, const cusparseMatDescr\_t descrA, const cuComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const cuComplex \*b, cuComplex \*x, int batchSize, csrqrInfo\_t info, void \*pBuffer); cusolverStatus\_t cusolverSpZcsrqrsvBatched(cusolverSpHandle\_t handle, int m, int n, int nnzA, const cusparseMatDescr\_t descrA, const cuDoubleComplex \*csrValA, const int \*csrRowPtrA, const int \*csrColIndA, const cuDoubleComplex \*b, cuDoubleComplex \*x, int batchSize, csrqrInfo\_t info, void \*pBuffer); The batched sparse QR factorization is used to solve either a set of least-squares problems \\\[x\_j = {argmin}{\\|}A\_{j}\*z - b\_{j}{\\|}{,\\ j\\ =\\ 1,2,...,\\ batchSize}\\\] or a set of linear systems \\\[A\_{j}x\_{j} = b\_{j}{,\\ j\\ =\\ 1,2,...,\\ batchSize}\\\] where each \\(A\_{j}\\) is an \\(m \\times n\\) sparse matrix that is defined in CSR storage format by the four arrays csrValA, csrRowPtrA and csrColIndA. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. If A is symmetric and only lower/upper part is provided, the user has to pass \\(A + A^{H}\\) into this function. The prerequisite to use batched sparse QR has two-folds. First all matrices \\(A\_{j}\\) must have the same sparsity pattern. Second, no column pivoting is used in least-square problem, so the solution is valid only if \\(A\_{j}\\) is of full rank for all j = 1,2,..., batchSize. All matrices have the same sparsity pattern, so only one copy of csrRowPtrA and csrColIndA is used. But the array csrValA stores coefficients of \\(A\_{j}\\) one after another. In other words, csrValA\[k\*nnzA: (k+1)\*nnzA\] is the value of \\(A\_{k}\\). The batched QR uses opaque data structure csrqrInfo to keep intermediate data, for example, matrix Q and matrix R of QR factorization. The user needs to create csrqrInfo first by cusolverSpCreateCsrqrInfo before any function in batched QR operation. The csrqrInfo would not release internal data until cusolverSpDestroyCsrqrInfo is called. There are three routines in batched sparse QR, cusolverSpXcsrqrAnalysisBatched, cusolverSp\[S|D|C|Z\]csrqrBufferInfoBatched and cusolverSp\[S|D|C|Z\]csrqrsvBatched. First, cusolverSpXcsrqrAnalysisBatched is the analysis phase, used to analyze sparsity pattern of matrix Q and matrix R of QR factorization. Also parallelism is extracted during analysis phase. Once analysis phase is done, the size of working space to perform QR is known. However cusolverSpXcsrqrAnalysisBatched uses CPU to analyze the structure of matrix A, and this may consume a lot of memory. If host memory is not sufficient to finish the analysis, CUSOLVER\_STATUS\_ALLOC\_FAILED is returned. The required memory for analysis is proportional to zero fill-in in QR factorization. The user may need to perform some kind of reordering to minimize zero fill-in, for example, colamd or symrcm in MATLAB. cuSolverSP library provides symrcm (cusolverSpXcsrsymrcm). Second, the user needs to choose proper batchSize and to prepare working space for sparse QR. There are two memory blocks used in batched sparse QR. One is internal memory block used to store matrix Q and matrix R. The other is working space used to perform numerical factorization. The size of the former is proportional to batchSize, and the size is specified by returned parameter internalDataInBytes of cusolverSp\[S|D|C|Z\]csrqrBufferInfoBatched. while the size of the latter is almost independent of batchSize, and the size is specified by returned parameter workspaceInBytes of cusolverSp\[S|D|C|Z\]csrqrBufferInfoBatched. The internal memory block is allocated implicitly during first call of cusolverSp\[S|D|C|Z\]csrqrsvBatched. The user only needs to allocate working space for cusolverSp\[S|D|C|Z\]csrqrsvBatched. Instead of trying all batched matrices, the user can find maximum batchSize by querying cusolverSp\[S|D|C|Z\]csrqrBufferInfoBatched. For example, the user can increase batchSize till summation of internalDataInBytes and workspaceInBytes is greater than size of available device memory. Suppose that the user needs to perform 253 linear solvers and available device memory is 2GB. if cusolverSp\[S|D|C|Z\]csrqrsvBatched can only afford batchSize 100, the user has to call cusolverSp\[S|D|C|Z\]csrqrsvBatched three times to finish all. The user calls cusolverSp\[S|D|C|Z\]csrqrBufferInfoBatched with batchSize 100. The opaque info would remember this batchSize and any subsequent call of cusolverSp\[S|D|C|Z\]csrqrsvBatched cannot exceed this value. In this example, the first two calls of cusolverSp\[S|D|C|Z\]csrqrsvBatched will use batchSize 100, and last call of cusolverSp\[S|D|C|Z\]csrqrsvBatched will use batchSize 53. Example: suppose that A0, A1,.., A9 have the same sparsity pattern, the following code solves 10 linear systems \\(A\_{j}x\_{j} = b\_{j}{,\\ j\\ =\\ 0,2,...,\\ 9}\\) by batched sparse QR. // Suppose that A0, A1,.., A9 are m x m sparse matrix represented by CSR format, // Each matrix Aj has nonzero nnzA, and shares the same csrRowPtrA and csrColIndA. // csrValA is aggregation of A0, A1,..., A9. int m; // number of rows and columns of each Aj int nnzA; // number of nonzeros of each Aj int \*csrRowPtrA; // each Aj has the same csrRowPtrA int \*csrColIndA; // each Aj has the same csrColIndA double \*csrValA; // aggregation of A0,A1,...,A9 const int batchSize = 10; // 10 linear systems cusolverSpHandle\_t handle; // handle to cusolver library csrqrInfo\_t info = NULL; cusparseMatDescr\_t descrA = NULL; void \*pBuffer = NULL; // working space for numerical factorization // step 1: create a descriptor cusparseCreateMatDescr(&descrA); cusparseSetMatIndexBase(descrA, CUSPARSE\_INDEX\_BASE\_ONE); // A is base-1 cusparseSetMatType(descrA, CUSPARSE\_MATRIX\_TYPE\_GENERAL); // A is a general matrix // step 2: create empty info structure cusolverSpCreateCsrqrInfo(&info); // step 3: symbolic analysis cusolverSpXcsrqrAnalysisBatched( handle, m, m, nnzA, descrA, csrRowPtrA, csrColIndA, info); // step 4: allocate working space for Aj\*xj=bj cusolverSpDcsrqrBufferInfoBatched( handle, m, m, nnzA, descrA, csrValA, csrRowPtrA, csrColIndA, batchSize, info, &internalDataInBytes, &workspaceInBytes); cudaMalloc(&pBuffer, workspaceInBytes); // step 5: solve Aj\*xj = bj cusolverSpDcsrqrsvBatched( handle, m, m, nnzA, descrA, csrValA, csrRowPtrA, csrColIndA, b, x, batchSize, info, pBuffer); // step 7: destroy info cusolverSpDestroyCsrqrInfo(info); Please refer to cuSOLVER Library Samples - csrqr for a code example. Remark 1: only GPU (device) path is provided. Input Parameter cusolverSp MemSpace Description handle host Handle to the cuSolverSP library context. m host Number of rows of each matrix Aj. n host Number of columns of each matrix Aj. nnzA host Number of nonzeros of each matrix Aj. It is the size csrColIndA. descrA host The descriptor of each matrix Aj. The supported matrix type is CUSPARSE\_MATRIX\_TYPE\_GENERAL. Also, the supported index bases are CUSPARSE\_INDEX\_BASE\_ZERO and CUSPARSE\_INDEX\_BASE\_ONE. csrValA device array of nnzA\*batchSize nonzero elements of matrices A0, A1,.... All matrices are aggregated one after another. csrRowPtrA device Integer array of m+1 elements that contains the start of every row and the end of the last row plus one. csrColIndA device Integer array of nnzAcolumn indices of the nonzero elements of each matrix Aj. b device array of m\*batchSize of right-hand-side vectors b0, b1,.... All vectors are aggregated one after another. batchSize host Number of systems to be solved. info host Opaque structure for QR factorization. pBuffer device Buffer allocated by the user, the size is returned by cusolverSpXcsrqrBufferInfoBatched(). Output Parameter cusolverSp MemSpace Description x device array of m\*batchSize of solution vectors x0, x1,.... All vectors are aggregated one after another. internalDataInBytes host Number of bytes of the internal data. workspaceInBytes host Number of bytes of the buffer in numerical factorization. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (m,n,nnzA<=0), base index is not 0 or 1. CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. CUSOLVER\_STATUS\_MATRIX\_TYPE\_NOT\_SUPPORTED The matrix type is not supported. 2.6. cuSolverRF: Refactorization Reference \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] cuSolverRF is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. This section describes API of cuSolverRF, a library for fast refactorization. 2.6.1. cusolverRfAccessBundledFactorsDevice() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfAccessBundledFactorsDevice(/\* Input \*/ cusolverRfHandle\_t handle, /\* Output (in the host memory) \*/ int\* nnzM, /\* Output (in the device memory) \*/ int\*\* Mp, int\*\* Mi, double\*\* Mx); This routine allows direct access to the lower L and upper U triangular factors stored in the cuSolverRF library handle. The factors are compressed into a single matrix M=(L-I)+U, where the unitary diagonal of L is not stored. It is assumed that a prior call to the cusolverRfRefactor() was done in order to generate these triangular factors. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. nnzM host output The number of non-zero elements of matrix M. Mp device output The array of offsets corresponding to the start of each row in the arrays Mi and Mx. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix M. The array size is n+1. Mi device output The array of column indices corresponding to the non-zero elements in the matrix M. It is assumed that this array is sorted by row and by column within each row. The array size is nnzM. Mx device output The array of values corresponding to the non-zero elements in the matrix M. It is assumed that this array is sorted by row and by column within each row. The array size is nnzM. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. 2.6.2. cusolverRfAnalyze() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfAnalyze(cusolverRfHandle\_t handle); This routine performs the appropriate analysis of parallelism available in the LU re-factorization depending upon the algorithm chosen by the user. \\\[A = L\*U\\\] It is assumed that a prior call to the cusolverRfSetup\[Host|Device\]() was done in order to create internal data structures needed for the analysis. This routine needs to be called only once for a single linear system \\\[A\_{i}x\_{i} = f\_{i}\\\] Parameter MemSpace In/out Meaning handle host in/out The handle to the cuSolverRF library. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. CUSOLVER\_STATUS\_ALLOC\_FAILED An allocation of memory failed. cusolverRfSetupDevice() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfSetupDevice(/\* Input (in the device memory) \*/ int n, int nnzA, int\* csrRowPtrA, int\* csrColIndA, double\* csrValA, int nnzL, int\* csrRowPtrL, int\* csrColIndL, double\* csrValL, int nnzU, int\* csrRowPtrU, int\* csrColIndU, double\* csrValU, int\* P, int\* Q, /\* Output \*/ cusolverRfHandle\_t handle); This routine assembles the internal data structures of the cuSolverRF library. It is often the first routine to be called after the call to the cusolverRfCreate() routine. This routine accepts as input (on the device) the original matrix A, the lower (L) and upper (U) triangular factors, as well as the left (P) and the right (Q) permutations resulting from the full LU factorization of the first (i=1) linear system \\\[A\_{i}x\_{i} = f\_{i}\\\] The permutations P and Q represent the final composition of all the left and right reorderings applied to the original matrix A, respectively. However, these permutations are often associated with partial pivoting and reordering to minimize fill-in, respectively. This routine needs to be called only once for a single linear system \\\[A\_{i}x\_{i} = f\_{i}\\\] Parameter MemSpace In/out Meaning n host input The number of rows (and columns) of matrix A. nnzA host input The number of non-zero elements of matrix A. csrRowPtrA device input The array of offsets corresponding to the start of each row in the arrays csrColIndA and csrValA. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix. The array size is n+1. csrColIndA device input The array of column indices corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is nnzA. csrValA device input The array of values corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is nnzA. nnzL host input The number of non-zero elements of matrix L. csrRowPtrL device input The array of offsets corresponding to the start of each row in the arrays csrColIndL and csrValL. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix L. The array size is n+1. csrColIndL device input The array of column indices corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by row and by column within each row. The array size is nnzL. csrValL device input The array of values corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by row and by column within each row. The array size is nnzL. nnzU host input The number of non-zero elements of matrix U. csrRowPtrU device input The array of offsets corresponding to the start of each row in the arrays csrColIndU and csrValU. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix U. The array size is n+1. csrColIndU device input The array of column indices corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by row and by column within each row. The array size is nnzU. csrValU device input The array of values corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by row and by column within each row. The array size is nnzU. P device input The left permutation (often associated with pivoting). The array size in n. Q device input The right permutation (often associated with reordering). The array size in n. handle host output The handle to the cuSolverRF library. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE An unsupported value or parameter was passed. CUSOLVER\_STATUS\_ALLOC\_FAILED An allocation of memory failed. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.6.3. cusolverRfSetupHost() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfSetupHost(/\* Input (in the host memory) \*/ int n, int nnzA, int\* h\_csrRowPtrA, int\* h\_csrColIndA, double\* h\_csrValA, int nnzL, int\* h\_csrRowPtrL, int\* h\_csrColIndL, double\* h\_csrValL, int nnzU, int\* h\_csrRowPtrU, int\* h\_csrColIndU, double\* h\_csrValU, int\* h\_P, int\* h\_Q, /\* Output \*/ cusolverRfHandle\_t handle); This routine assembles the internal data structures of the cuSolverRF library. It is often the first routine to be called after the call to the cusolverRfCreate() routine. This routine accepts as input (on the host) the original matrix A, the lower (L) and upper (U) triangular factors, as well as the left (P) and the right (Q) permutations resulting from the full LU factorization of the first (i=1) linear system \\\[A\_{i}x\_{i} = f\_{i}\\\] The permutations P and Q represent the final composition of all the left and right reorderings applied to the original matrix A, respectively. However, these permutations are often associated with partial pivoting and reordering to minimize fill-in, respectively. This routine needs to be called only once for a single linear system \\\[A\_{i}x\_{i} = f\_{i}\\\] Parameter MemSpace In/out Meaning n host input The number of rows (and columns) of matrix A. nnzA host input The number of non-zero elements of matrix A. h\_csrRowPtrA host input The array of offsets corresponding to the start of each row in the arrays h\_csrColIndA and h\_csrValA. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix. The array size is n+1. h\_csrColIndA host input The array of column indices corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is nnzA. h\_csrValA host input The array of values corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is nnzA. nnzL host input The number of non-zero elements of matrix L. h\_csrRowPtrL host input The array of offsets corresponding to the start of each row in the arrays h\_csrColIndL and h\_csrValL. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix L. The array size is n+1. h\_csrColIndL host input The array of column indices corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by row and by column within each row. The array size is nnzL. h\_csrValL host input The array of values corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by row and by column within each row. The array size is nnzL. nnzU host input The number of non-zero elements of matrix U. h\_csrRowPtrU host input The array of offsets corresponding to the start of each row in the arrays h\_csrColIndU and h\_csrValU. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix U. The array size is n+1. h\_csrColIndU host input The array of column indices corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by row and by column within each row. The array size is nnzU. h\_csrValU host input The array of values corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by row and by column within each row. The array size is nnzU. h\_P host input The left permutation (often associated with pivoting). The array size in n. h\_Q host input The right permutation (often associated with reordering). The array size in n. handle host output The handle to the cuSolverRF library. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE An unsupported value or parameter was passed. CUSOLVER\_STATUS\_ALLOC\_FAILED An allocation of memory failed. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.6.4. cusolverRfCreate() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfCreate(cusolverRfHandle\_t \*handle); This routine initializes the cuSolverRF library. It allocates required resources and must be called prior to any other cuSolverRF library routine. Parameter MemSpace In/out Meaning handle host output The pointer to the cuSolverRF library handle. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED An allocation of memory failed. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.6.5. cusolverRfExtractBundledFactorsHost() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfExtractBundledFactorsHost(/\* Input \*/ cusolverRfHandle\_t handle, /\* Output (in the host memory) \*/ int\* h\_nnzM, int\*\* h\_Mp, int\*\* h\_Mi, double\*\* h\_Mx); This routine extracts lower (L) and upper (U) triangular factors from the cuSolverRF library handle into the host memory. The factors are compressed into a single matrix M=(L-I)+U, where the unitary diagonal of (L) is not stored. It is assumed that a prior call to the cusolverRfRefactor() was done in order to generate these triangular factors. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. h\_nnzM host output The number of non-zero elements of matrix M. h\_Mp host output The array of offsets corresponding to the start of each row in the arrays h\_Mi and h\_Mx. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix M. The array size is n+1. h\_Mi host output The array of column indices corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is h\_nnzM. h\_Mx host output The array of values corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is h\_nnzM. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED An allocation of memory failed. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. 2.6.6. cusolverRfExtractSplitFactorsHost() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfExtractSplitFactorsHost(/\* Input \*/ cusolverRfHandle\_t handle, /\* Output (in the host memory) \*/ int\* h\_nnzL, int\*\* h\_Lp, int\*\* h\_Li, double\*\* h\_Lx, int\* h\_nnzU, int\*\* h\_Up, int\*\* h\_Ui, double\*\* h\_Ux); This routine extracts lower (L) and upper (U) triangular factors from the cuSolverRF library handle into the host memory. It is assumed that a prior call to the cusolverRfRefactor() was done in order to generate these triangular factors. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. h\_nnzL host output The number of non-zero elements of matrix L. h\_Lp host output The array of offsets corresponding to the start of each row in the arrays h\_Li and h\_Lx. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix L. The array size is n+1. h\_Li host output The array of column indices corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by row and by column within each row. The array size is h\_nnzL. h\_Lx host output The array of values corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by row and by column within each row. The array size is h\_nnzL. h\_nnzU host output The number of non-zero elements of matrix U. h\_Up host output The array of offsets corresponding to the start of each row in the arrays h\_Ui and h\_Ux. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix U. The array size is n+1. h\_Ui host output The array of column indices corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by row and by column within each row. The array size is h\_nnzU. h\_Ux host output The array of values corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by row and by column within each row. The array size is h\_nnzU. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ALLOC\_FAILED An allocation of memory failed. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. 2.6.7. cusolverRfDestroy() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfDestroy(cusolverRfHandle\_t handle); This routine shuts down the cuSolverRF library. It releases acquired resources and must be called after all the cuSolverRF library routines. Parameter MemSpace In/out Meaning handle host input The cuSolverRF library handle. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.6.8. cusolverRfGetMatrixFormat() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfGetMatrixFormat(cusolverRfHandle\_t handle, cusolverRfMatrixFormat\_t \*format, cusolverRfUnitDiagonal\_t \*diag); This routine gets the matrix format used in the cusolverRfSetupDevice(), cusolverRfSetupHost(), cusolverRfResetValues(), cusolverRfExtractBundledFactorsHost() and cusolverRfExtractSplitFactorsHost() routines. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. format host output The enumerated matrix format type. diag host output The enumerated unit diagonal type. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.6.9. cusolverRfGetNumericProperties() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfGetNumericProperties(cusolverRfHandle\_t handle, double \*zero, double \*boost); This routine gets the numeric values used for checking for ‘’zero’’ pivot and for boosting it in the cusolverRfRefactor() and cusolverRfSolve() routines. The numeric boosting will be used only if boost > 0.0. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. zero host output The value below which zero pivot is flagged. boost host output The value which is substituted for zero pivot (if the later is flagged). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.6.10. cusolverRfGetNumericBoostReport() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfGetNumericBoostReport(cusolverRfHandle\_t handle, cusolverRfNumericBoostReport\_t \*report); This routine gets the report whether numeric boosting was used in the cusolverRfRefactor() and cusolverRfSolve() routines. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. report host output The enumerated boosting report type. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.6.11. cusolverRfGetResetValuesFastMode() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfGetResetValuesFastMode(cusolverRfHandle\_t handle, cusolverRfResetValuesFastMode\_t \*fastMode); This routine gets the mode used in the cusolverRfResetValues routine. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. fastMode host output The enumerated mode type. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.6.12. cusolverRfGetAlgs() cusolverStatus\_t cusolverRfGetAlgs(cusolverRfHandle\_t handle, cusolverRfFactorization\_t\* fact\_alg, cusolverRfTriangularSolve\_t\* solve\_alg); This routine gets the algorithm used for the refactorization in cusolverRfRefactor() and the triangular solve in cusolverRfSolve(). Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. alg host output The enumerated algorithm type. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.6.13. cusolverRfRefactor() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfRefactor(cusolverRfHandle\_t handle); This routine performs the LU re-factorization: \\\[A = L\*U\\\] exploring the available parallelism on the GPU. It is assumed that a prior call to the cusolverRfAnalyze() was done in order to find the available parallelism. This routine may be called multiple times, once for each of the linear systems: \\\[A\_{i}x\_{i} = f\_{i}\\\] There are some constraints to the combination of algorithms used for refactorization and solving routines, cusolverRfRefactor() and cusolverRfSolve(). The wrong combination generates the error code CUSOLVER\_STATUS\_INVALID\_VALUE. The table below summarizes the supported combinations of algorithms: Compatible algorithms for solving and refactorization routines. Factorization Solving CUSOLVERRF\_FACTORIZATION\_ALG0 TRIANGULAR\_SOLVE\_ALG1 CUSOLVERRF\_FACTORIZATION\_ALG1 TRIANGULAR\_SOLVE\_ALG2, TRIANGULAR\_SOLVE\_ALG3 CUSOLVERRF\_FACTORIZATION\_ALG2 TRIANGULAR\_SOLVE\_ALG2, TRIANGULAR\_SOLVE\_ALG3 Parameter MemSpace In/out Meaning handle host in/out The handle to the cuSolverRF library. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. CUSOLVER\_STATUS\_ZERO\_PIVOT A zero pivot was encountered during the computation. 2.6.14. cusolverRfResetValues() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfResetValues(/\* Input (in the device memory) \*/ int n, int nnzA, int\* csrRowPtrA, int\* csrColIndA, double\* csrValA, int\* P, int\* Q, /\* Output \*/ cusolverRfHandle\_t handle); This routine updates internal data structures with the values of the new coefficient matrix. It is assumed that the arrays csrRowPtrA, csrColIndA, P and Q have not changed since the last call to the cusolverRfSetup\[Host|Device\] routine. This assumption reflects the fact that the sparsity pattern of coefficient matrices as well as reordering to minimize fill-in and pivoting remain the same in the set of linear systems: \\\[A\_{i}x\_{i} = f\_{i}\\\] This routine may be called multiple times, once for each of the linear systems: \\\[A\_{i}x\_{i} = f\_{i}\\\] Parameter MemSpace In/out Meaning n host input The number of rows (and columns) of matrix A. nnzA host input The number of non-zero elements of matrix A. csrRowPtrA device input The array of offsets corresponding to the start of each row in the arrays csrColIndA and csrValA. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix. The array size is n+1. csrColIndA device input The array of column indices corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is nnzA. csrValA device input The array of values corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is nnzA. P device input The left permutation (often associated with pivoting). The array size in n. Q device input The right permutation (often associated with reordering). The array size in n. handle host output The handle to the cuSolverRF library. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE An unsupported value or parameter was passed. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. 2.6.15. cusolverRfSetMatrixFormat() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfSetMatrixFormat(cusolverRfHandle\_t handle, cusolverRfMatrixFormat\_t format, cusolverRfUnitDiagonal\_t diag); This routine sets the matrix format used in the cusolverRfSetupDevice(), cusolverRfSetupHost(), cusolverRfResetValues(), cusolverRfExtractBundledFactorsHost() and cusolverRfExtractSplitFactorsHost() routines. It may be called once prior to cusolverRfSetupDevice() and cusolverRfSetupHost() routines. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. format host input The enumerated matrix format type. diag host input The enumerated unit diagonal type. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE An enumerated mode parameter is wrong. 2.6.16. cusolverRfSetNumericProperties() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfSetNumericProperties(cusolverRfHandle\_t handle, double zero, double boost); This routine sets the numeric values used for checking for ‘’zero’’ pivot and for boosting it in the cusolverRfRefactor() and cusolverRfSolve() routines. It may be called multiple times prior to cusolverRfRefactor() and cusolverRfSolve() routines. The numeric boosting will be used only if boost > 0.0. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. zero host input The value below which zero pivot is flagged. boost host input The value which is substituted for zero pivot (if the later is flagged). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.6.17. cusolverRfSetResetValuesFastMode() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfSetResetValuesFastMode(cusolverRfHandle\_t handle, cusolverRfResetValuesFastMode\_t fastMode); This routine sets the mode used in the cusolverRfResetValues routine. The fast mode requires extra memory and is recommended only if very fast calls to cusolverRfResetValues() are needed. It may be called once prior to cusolverRfAnalyze() routine. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. fastMode host input The enumerated mode type. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE An enumerated mode parameter is wrong. 2.6.18. cusolverRfSetAlgs() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfSetAlgs(cusolverRfHandle\_t handle, cusolverRfFactorization\_t fact\_alg, cusolverRfTriangularSolve\_t alg); This routine sets the algorithm used for the refactorization in cusolverRfRefactor() and the triangular solve in cusolverRfSolve(). It may be called once prior to cusolverRfAnalyze() routine. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. alg host input The enumerated algorithm type. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. 2.6.19. cusolverRfSolve() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfSolve(/\* Input (in the device memory) \*/ cusolverRfHandle\_t handle, int \*P, int \*Q, int nrhs, double \*Temp, int ldt, /\* Input/Output (in the device memory) \*/ double \*XF, /\* Input \*/ int ldxf); This routine performs the forward and backward solve with the lower \\(L\\in R^{nxn}\\) and upper \\(U\\in R^{nxn}\\) triangular factors resulting from the LU re-factorization: \\\[A = L\*U\\\] which is assumed to have been computed by a prior call to the cusolverRfRefactor() routine. The routine can solve linear systems with multiple right-hand-sides (RHS): \\\[AX = {(LU)}X = L{(UX)} = LY = F~{where}~UX = Y\\\] even though currently only a single RHS is supported. This routine may be called multiple times, once for each of the linear systems: \\\[A\_{i}x\_{i} = f\_{i}\\\] Parameter MemSpace In/out Meaning handle host output The handle to the cuSolverRF library. P device input The left permutation (often associated with pivoting). The array size in n. Q device input The right permutation (often associated with reordering). The array size in n. nrhs host input The number right-hand-sides to be solved. Temp device input The dense matrix that contains temporary workspace (of size ldt\*nrhs). ldt host input The leading dimension of dense matrix Temp (ldt >= n). XF device in/out The dense matrix that contains the right-hand-sides F and solutions X (of size ldxf\*nrhs). ldxf host input The leading dimension of dense matrix XF (ldxf >= n). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE An unsupported value or parameter was passed. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.6.20. cusolverRfBatchSetupHost() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfBatchSetupHost(/\* Input (in the host memory) \*/ int batchSize, int n, int nnzA, int\* h\_csrRowPtrA, int\* h\_csrColIndA, double \*h\_csrValA\_array\[\], int nnzL, int\* h\_csrRowPtrL, int\* h\_csrColIndL, double \*h\_csrValL, int nnzU, int\* h\_csrRowPtrU, int\* h\_csrColIndU, double \*h\_csrValU, int\* h\_P, int\* h\_Q, /\* Output \*/ cusolverRfHandle\_t handle); This routine assembles the internal data structures of the cuSolverRF library for batched operation. It is called after the call to the cusolverRfCreate() routine, and before any other batched routines. The batched operation assumes that the user has the following linear systems: \\\[A\_{j}x\_{j} = b\_{j}{, j = 1,2,..., batchSize}\\\] where each matrix in the set: \\(\\{ A\_{j}\\}\\) has the same sparsity pattern, and quite similar such that factorization can be done by the same permutation P and Q. In other words, \\(A\_{j}{,\\ j>1}\\) is a small perturbation of \\(A\_{1}\\). This routine accepts as input (on the host) the original matrix A (sparsity pattern and batched values), the lower (L) and upper (U) triangular factors, as well as the left (P) and the right (Q) permutations resulting from the full LU factorization of the first (i=1) linear system: \\\[A\_{i}x\_{i} = f\_{i}\\\] The permutations P and Q represent the final composition of all the left and right reorderings applied to the original matrix A, respectively. However, these permutations are often associated with partial pivoting and reordering to minimize fill-in, respectively. Remark 1: the matrices A, L and U must be CSR format and base-0. Remark 2: to get best performance, batchSize should be multiple of 32 and greater or equal to 32. The algorithm is memory-bound, once bandwidth limit is reached, there is no room to improve performance by large batchSize. In practice, batchSize of 32 - 128 is often enough to obtain good performance, but in some cases larger batchSize might be beneficial. The following routine needs to be called only once for a single linear system: \\\[A\_{i}x\_{i} = f\_{i}\\\] Parameter MemSpace In/out Meaning batchSize host input The number of matrices in the batched mode. n host input The number of rows (and columns) of matrix A. nnzA host input The number of non-zero elements of matrix A. h\_csrRowPtrA host input The array of offsets corresponding to the start of each row in the arrays h\_csrColIndA and h\_csrValA. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix. The array size is n+1. h\_csrColIndA host input The array of column indices corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is nnzA. h\_csrValA\_array host input Array of pointers of size batchSize, each pointer points to the array of values corresponding to the non-zero elements in the matrix. nnzL host input The number of non-zero elements of matrix L. h\_csrRowPtrL host input The array of offsets corresponding to the start of each row in the arrays h\_csrColIndL and h\_csrValL. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix L. The array size is n+1. h\_csrColIndL host input The array of column indices corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by row and by column within each row. The array size is nnzL. h\_csrValL host input The array of values corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by row and by column within each row. The array size is nnzL. nnzU host input The number of non-zero elements of matrix U. h\_csrRowPtrU host input The array of offsets corresponding to the start of each row in the arrays h\_csrColIndU and h\_csrValU. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix U. The array size is n+1. h\_csrColIndU host input The array of column indices corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by row and by column within each row. The array size is nnzU. h\_csrValU host input The array of values corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by row and by column within each row. The array size is nnzU. h\_P host input The left permutation (often associated with pivoting). The array size in n. h\_Q host input The right permutation (often associated with reordering). The array size in n. handle host output The handle to the cuSolverRF library. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE An unsupported value or parameter was passed. CUSOLVER\_STATUS\_ALLOC\_FAILED An allocation of memory failed. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.6.21. cusolverRfBatchAnalyze() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfBatchAnalyze(cusolverRfHandle\_t handle); This routine performs the appropriate analysis of parallelism available in the batched LU re-factorization. It is assumed that a prior call to the cusolverRfBatchSetup\[Host\]() was done in order to create internal data structures needed for the analysis. The following routine needs to be called only once for a single linear system: \\\[A\_{j}x\_{j} = b\_{j}{, j = 1,2,..., batchSize}\\\] Parameter Memory In/out Meaning handle host in/out The handle to the cuSolverRF library. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. CUSOLVER\_STATUS\_ALLOC\_FAILED An allocation of memory failed. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.6.22. cusolverRfBatchResetValues() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfBatchResetValues(/\* Input (in the device memory) \*/ int batchSize, int n, int nnzA, int\* csrRowPtrA, int\* csrColIndA, double\* csrValA\_array\[\], int \*P, int \*Q, /\* Output \*/ cusolverRfHandle\_t handle); This routine updates internal data structures with the values of the new coefficient matrix. It is assumed that the arrays csrRowPtrA, csrColIndA, P and Q have not changed since the last call to the cusolverRfbatch\_setup\_host routine. This assumption reflects the fact that the sparsity pattern of coefficient matrices as well as reordering to minimize fill-in and pivoting remain the same in the set of linear systems: \\\[A\_{j}x\_{j} = b\_{j}{, j\\ = 1,2,..., batchSize}\\\] The input parameter csrValA\_array is an array of pointers on device memory. csrValA\_array(j) points to matrix: \\(A\_{j}\\) which is also on device memory. Parameter MemSpace In/out Meaning batchSize host input The number of matrices in batched mode. n host input The number of rows (and columns) of matrix A. nnzA host input The number of non-zero elements of matrix A. csrRowPtrA device input The array of offsets corresponding to the start of each row in the arrays csrColIndA and csrValA. This array has also an extra entry at the end that stores the number of non-zero elements in the matrix. The array size is n+1. csrColIndA device input The array of column indices corresponding to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is nnzA. csrValA\_array device input Array of pointers of size batchSize, each pointer points to the array of values corresponding to the non-zero elements in the matrix. P device input The left permutation (often associated with pivoting). The array size in n. Q device input The right permutation (often associated with reordering). The array size in n. handle host output The handle to the cuSolverRF library. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE An unsupported value or parameter was passed. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. 2.6.23. cusolverRfBatchRefactor() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfBatchRefactor(cusolverRfHandle\_t handle); This routine performs the LU re-factorization: \\\[M\_{j} = P\*A\_{j}\*Q^{T} = L\_{j}\*U\_{j}\\\] exploring the available parallelism on the GPU. It is assumed that a prior call to the cusolverRfBatchAnalyze() was done in order to find the available parallelism. Remark: cusolverRfBatchRefactor() would not report any failure of LU refactorization. The user has to call cusolverRfBatchZeroPivot() to know which matrix failed the LU refactorization. Parameter Memory In/out Meaning handle host in/out The handle to the cuSolverRF library. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. 2.6.24. cusolverRfBatchSolve() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfBatchSolve(/\* Input (in the device memory) \*/ cusolverRfHandle\_t handle, int \*P, int \*Q, int nrhs, double \*Temp, int ldt, /\* Input/Output (in the device memory) \*/ double \*XF\_array\[\], /\* Input \*/ int ldxf); To solve \\(A\_{j}\*x\_{j} = b\_{j}\\), first we reform the equation by \\(M\_{j}\*Q\*x\_{j} = P\*b\_{j}\\) where \\(M\_{j} = P\*A\_{j}\*Q^{T}\\). Then do refactorization \\(M\_{j} = L\_{j}\*U\_{j}\\) by cusolverRfBatch\_Refactor(). Further cusolverRfBatch\_Solve() takes over the remaining steps, including: \\(z\_{j} = P\*b\_{j}\\) \\(M\_{j}\*y\_{j} = z\_{j}\\) \\(x\_{j} = Q^{T}\*y\_{j}\\) The input parameter XF\_array is an array of pointers on device memory. XF\_array(j) points to matrix \\(x\_{j}\\) which is also on device memory. Remark 1: only a single rhs is supported. Remark 2: no singularity is reported during backward solve. If some matrix \\(A\_{j}\\) failed the refactorization and \\(U\_{j}\\) has some zero diagonal, backward solve would compute NAN. The user has to call cusolverRfBatch\_Zero\_Pivot to check if refactorization is successful or not. Parameter MemSpace In/out Meaning handle host output The handle to the cuSolverRF library. P device input The left permutation (often associated with pivoting). The array size in n. Q device input The right permutation (often associated with reordering). The array size in n. nrhs host input The number right-hand-sides to be solved. Temp device input The dense matrix that contains temporary workspace (of size ldt\*nrhs). ldt host input The leading dimension of dense matrix Temp (ldt >= n). XF\_array device in/out Array of pointers of size batchSize, each pointer points to the dense matrix that contains the right-hand-sides F and solutions X (of size ldxf\*nrhs). ldxf host input The leading dimension of dense matrix XF (ldxf >= n). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE An unsupported value or parameter was passed. CUSOLVER\_STATUS\_EXECUTION\_FAILED A kernel failed to launch on the GPU. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 2.6.25. cusolverRfBatchZeroPivot() \[\[DEPRECATED\]\] \[\[DEPRECATED\]\] This function is deprecated and will be removed in a future major version. Please use the cuDSS library instead for better performance and support. For the transition, please visit cuDSS Library Samples for a code example. cusolverStatus\_t cusolverRfBatchZeroPivot(/\* Input \*/ cusolverRfHandle\_t handle /\* Output (in the host memory) \*/ int \*position); Although \\(A\_{j}\\) is close to each other, it does not mean \\(M\_{j} = P\*A\_{j}\*Q^{T} = L\_{j}\*U\_{j}\\) exists for every j. The user can query which matrix failed LU refactorization by checking corresponding value in position array. The input parameter position is an integer array of size batchSize. The j-th component denotes the refactorization result of matrix \\(A\_{j}\\). If position(j) is -1, the LU refactorization of matrix \\(A\_{j}\\) is successful. If position(j) is k >= 0, matrix \\(A\_{j}\\) is not LU factorizable and its matrix \\(U\_{j}{(j,j)}\\) is zero. The return value of cusolverRfBatch\_Zero\_Pivot is CUSOLVER\_STATUS\_ZERO\_PIVOT if there exists one \\(A\_{j}\\) which failed LU refactorization. The user can redo LU factorization to get new permutation P and Q if error code CUSOLVER\_STATUS\_ZERO\_PIVOT is returned. Parameter MemSpace In/out Meaning handle host input The handle to the cuSolverRF library. position host output Integer array of size batchSize. The value of position(j) reports singularity of matrix Aj, -1 if no structural/numerical zero, k >= 0 if Aj(k,k) is either structural zero or numerical zero. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_ZERO\_PIVOT A zero pivot was encountered during the computation. 3. Using the CUSOLVERMG API Note cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. 3.1. General Description This section describes how to use the cuSolverMG library API. It is not a reference for the cuSolverMG API data types and functions; that is provided in subsequent chapters. 3.1.1. Thread Safety The library is thread-safe only if there is one cuSolverMG context per thread. 3.1.2. Determinism Currently all cuSolverMG API routines from a given toolkit version generate the same bit-wise results when the following conditions are respected: all GPUs participating to the computation have the same compute-capabilities and the same number of SMs. the tiles size is kept the same between run. number of logical GPUs is kept the same. The order of GPUs are not important because all have the same compute-capabilities. 3.1.3. Tile Strategy The tiling strategy of cuSolverMG is compatible with ScaLAPACK. The current release only supports 1-D column block cyclic, column-major PACKED format. Figure 1.a shows a partition of the matrix A of dimension M\_A by N\_A. Each column tile has T\_A columns. There are seven columns of tiles, labeled as 0,1,2,3,4,5,6, distributed into three GPUs in a cyclic way, i.e. each GPU takes one column tile in turn. For example, GPU 0 has column tile 0, 3, 6 (yellow tiles) and GPU 1 takes column tiles next to GPU 0 (blue tiles). Not all GPUs have the same number of tiles; in this example, GPU 0 has three tiles, others have only two tiles. Figure 1.b shows two possible formats to store those column tiles locally in each GPU. Left side is called PACKED format and right side is UNPACKED format. PACKED format aggregates three column tiles in a contiguous memory block while UNPACKED format distributes these three column tiles into different memory blocks. The only difference between them is that PACKED format can have a big GEMM call instead of three GEMM calls in UNPACKED format. So theoretically speaking, PACKED format can deliver better performance than UNPACKED format. cuSolverMG only supports PACKED format in the API. In order to achieve maximal performance, the user just needs to choose the proper tile size T\_A to partition the matrix, not too small, for example 256 or above is enough. There is another parameter, called LLD\_A, to control the leading dimension of the local matrix in each GPU. LLD\_A must be greater or equal to M\_A. The purpose of LLD\_A is for better performance of GEMM. For small problems, GEMM is faster if LLD\_A is power of 2. However for big problems, LLD\_A does not show significant improvement. cuSolverMG only supports LLD\_A=M\_A. Example of cuSolverMG tiling for 3 GPUs The processing grid in cuSolverMG is a list of GPU IDs, similar to the process ID in ScaLAPACK. cuSolverMG only supports 1D column block cyclic, so only 1D grid is supported as well. Suppose deviceId is a list of GPU IDs, both deviceId=1,1,1 and deviceId=2,1,0 are valid. The former describes three logical devices that are selected to run cuSolverMG routines, and all have the same physical ID, 0. The latter still uses three logical devices, but each has a different physical ID. The current design only accepts 32 logical devices, that is, the length of deviceId is less or equal to 32. Figure 1 uses deviceId=0,1,2. In practice, the matrix A is distributed into GPUs listed in deviceId. If the user chooses deviceId=1,1,1, all columns tile are located in GPU 1, this will limit the size of the problem because of memory capacity of one GPU. Besides, multiGPU routine adds extra overhead on data communication through the off-chip bus, which has a big performance impact if NVLINK is not supported or used. It would be faster to run on a single GPU instead of running multiGPU version with devices of the same GPU ID. 3.1.4. Global Matrix Versus Local Matrix Operating a submatrix of the matrix A is simple in dense linear algebra, just shift the pointer to the starting point of the submatrix relative to A. For example, gesvd(10,10, A) is SVD of A(0:9,0:9). gesvd(10,10, A + 5 + 2\*lda ) is SVD of 10-by-10 submatrix starting at A(5,2). However it is not simple to operate on a submatrix of a distributed matrix because different starting point of the submatrix changes the distribution of the layout of that submatrix. ScaLAPACK introduces two parameters, IA and JA, to locate the submatrix. Figure 2 shows (global) matrix A of dimension M\_A by N\_A. The sub(A) is a M by N submatrix of A, starting at IA and JA. Please be aware that IA and JA are base-1. Given a distributed matrix A, the user can compute eigenvalues of the submatrix sub(A) by either calling syevd(A, IA, JA) or gathering sub(A) to another distributed matrix B and calling syevd(B, IB=1, JB=1). global matrix and local matrix 3.1.5. Usage of \_bufferSize There is no cudaMalloc inside cuSolverMG library, so the user must allocate the device workspace explicitly. The routine xyz\_bufferSize is to query the size of workspace of the routine xyz, for example xyz = syevd. To make the API simple, xyz\_bufferSize follows almost the same signature of xyz even it only depends on some parameters, for example, the device pointer is not used to decide the size of workspace. In most cases, xyz\_bufferSize is called in the beginning before actual device data (pointing by a device pointer) is prepared or before the device pointer is allocated. In such cases, the user can pass a null pointer to xyz\_bufferSize without breaking the functionality. xyz\_bufferSize returns bufferSize for each device. The size is number of elements, not number of bytes. 3.1.6. Synchronization All routines are in synchronous (blocking call) manner. The data is ready after the routine. However the user has to prepare the distributed data before calling the routine. For example, if the user has multiple streams to set up the matrix, stream synchronization or device synchronization is necessary to guarantee the distributed matrix is ready. 3.1.7. Context Switch The user does not need to restore the device by cudaSetDevice() after each cuSolverMG call. All routines set the device back to what the caller has. 3.1.8. NVLINK The peer-to-peer communication via NVLINK can dramatically reduce the overhead of data exchange among GPUs. cuSolverMG does not enable NVLINK implicitly, instead, it gives this option back to the user, not to interfere with other libraries. The example code H.1 shows how to enable peer-to-peer communication. 3.2. cuSolverMG Types Reference 3.2.1. cuSolverMG Types The float, double, cuComplex, and cuDoubleComplex data types are supported. The first two are standard C data types, while the last two are exported from cuComplex.h. In addition, cuSolverMG uses some familiar types from cuBLAS. 3.2.2. cusolverMgHandle\_t This is a pointer type to an opaque cuSolverMG context, which the user must initialize by calling cusolverMgCreate() prior to calling any other library function. An un-initialized handle object will lead to unexpected behavior, including crashes of cuSolverMG. The handle created and returned by cusolverMgCreate() must be passed to every cuSolverMG function. 3.2.3. cusolverMgGridMapping\_t The type indicates layout of grids. Value Meaning CUDALIBMG\_GRID\_MAPPING\_ROW\_MAJOR Row-major ordering. CUDALIBMG\_GRID\_MAPPING\_COL\_MAJOR Column-major ordering. 3.2.4. cudaLibMgGrid\_t Opaque structure of the distributed grid. 3.2.5. cudaLibMgMatrixDesc\_t Opaque structure of the distributed matrix descriptor. 3.3. Helper Function Reference 3.3.1. cusolverMgCreate() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. cusolverStatus\_t cusolverMgCreate(cusolverMgHandle\_t \*handle) This function initializes the cuSolverMG library and creates a handle on the cuSolverMG context. It must be called before any other cuSolverMG API function is invoked. It allocates hardware resources necessary for accessing the GPU. Output handle The pointer to the handle to the cuSolverMG context. Status Returned CUSOLVER\_STATUS\_SUCCESS The initialization succeeded. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. 3.3.2. cusolverMgDestroy() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. cusolverStatus\_t cusolverMgDestroy( cusolverMgHandle\_t handle) This function releases CPU-side resources used by the cuSolverMG library. Input handle The handle to the cuSolverMG context. Status Returned CUSOLVER\_STATUS\_SUCCESS The shutdown succeeded. 3.3.3. cusolverMgDeviceSelect() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. cusolverStatus\_t cusolverMgDeviceSelect( cusolverMgHandle\_t handle, int nbDevices, int deviceId\[\] ) This function registers a subset of devices (GPUs) to cuSolverMG handle. Such subset of devices is used in subsequent API calls. The array deviceId contains a list of logical device ID. The term logical means repeated device ID are permitted. For example, suppose the user has only one GPU in the system, say device 0. If the user sets deviceId=0,0,0, then cuSolverMG treats them as three independent GPUs, one stream each, so concurrent kernel launches still hold. The current design only supports up to 32 logical devices. Input handle The pointer to the handle to the cuSolverMG context. nbDevices The number of logical devices. deviceId An integer array of size nbDevices. Status Returned CUSOLVER\_STATUS\_SUCCESS The initialization succeeded. CUSOLVER\_STATUS\_INVALID\_VALUE nbDevices must be greater than zero, and less or equal to 32. CUSOLVER\_STATUS\_ALLOC\_FAILED The resources could not be allocated. CUSOLVER\_STATUS\_INTERNAL\_ERROR Internal error occurred when setting internal streams and events. 3.3.4. cusolverMgCreateDeviceGrid() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. cusolverStatus\_t cusolverMgCreateDeviceGrid( cusolverMgGrid\_t\* grid, int32\_t numRowDevices, int32\_t numColDevices, const int32\_t deviceId\[\], cusolverMgGridMapping\_t mapping) This function sets up a grid of devices. Only 1-D column block cyclic is supported, so numRowDevices must be equal to 1. Warning cusolverMgCreateDeviceGrid() must be consistent with cusolverMgDeviceSelect(), i.e. numColDevices must be equal to nbDevices in cusolverMgDeviceSelect(). Parameter MemSpace In/out Meaning grid host output The pointer to the opaque structure. numRowDevices host input Number of devices in the row. numColDevices host input Number of devices in the column. deviceId host input Integer array of size numColDevices, containing device IDs. mapping host input Row-major or column-major ordering. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_INVALID\_VALUE numColDevices is not greater than 0. numRowDevices is not 1. 3.3.5. cusolverMgDestroyGrid() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. cusolverStatus\_t cusolverMgDestroyGrid( cusolverMgGrid\_t grid) This function releases resources of a grid. Parameter MemSpace In/out Meaning grid host input/output The pointer to the opaque structure. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. 3.3.6. cusolverMgCreateMatrixDesc() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. cusolverStatus\_t cusolverMgCreateMatrixDesc( cusolverMgMatrixDesc\_t \* desc, int64\_t numRows, int64\_t numCols, int64\_t rowBlockSize, int64\_t colBlockSize, cudaDataType\_t dataType, const cusolverMgGrid\_t grid) This function sets up the matrix descriptor desc. Only 1-D column block cyclic is supported, so numRows must be equal to rowBlockSize. Parameter Memory In/out Meaning desc host output The matrix descriptor. numRows host input The number of rows of global A. numCols host input The number of columns of global A. rowBlockSize host input The number of rows per tile. colBlockSize host input The number of columns per tile. dataType host input Data type of the matrix. grid host input The pointer to structure of grid. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_INVALID\_VALUE numRows, numCols, or rowBlockSize or colBlockSize is less than 0. numRows is not equal to rowBlockSize. 3.3.7. cusolverMgDestroyMatrixDesc() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. cusolverStatus\_t cusolverMgDestroyMatrixDesc( cusolverMgMatrixDesc\_t desc) This function releases the matrix descriptor desc. Parameter Memory In/out Meaning desc host input/output The matrix descriptor. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. 3.4. Dense Linear Solver Reference This section describes the linear solver API of cuSolverMG. 3.4.1. cusolverMgPotrf() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. The following helper function can calculate the sizes needed for pre-allocated buffer for cusolverMgPotrf: cusolverStatus\_t cusolverMgPotrf\_bufferSize( cusolverMgHandle\_t handle, cublasFillMode\_t uplo, int N, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, cudaDataType computeType, int64\_t \*lwork) The following routine: cusolverStatus\_t cusolverMgPotrf( cusolverMgHandle\_t handle, cublasFillMode\_t uplo, int N, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, cudaDataType computeType, void \*array\_d\_work\[\], int64\_t lwork, int \*info) computes the Cholesky factorization of a Hermitian positive-definite matrix using the generic API interface. A is an \\(n \\times n\\) Hermitian matrix; only lower or upper part is meaningful. The input parameter uplo indicates which part of the matrix is used. The function would leave other parts untouched. If input parameter uplo is CUBLAS\_FILL\_MODE\_LOWER, only lower triangular part of A is processed, and replaced by lower triangular Cholesky factor L: \\\[A = L\*L^{H}\\\] If input parameter uplo is CUBLAS\_FILL\_MODE\_UPPER, only upper triangular part of A is processed, and replaced by upper triangular Cholesky factor U: \\\[A = U^{H}\*U\\\] The user has to provide device working space in array\_d\_work. array\_d\_work is a host pointer array of dimension G, where G is number of devices. array\_d\_work\[j\] is a device pointer pointing to a device memory in j-th device. The data type of array\_d\_work\[j\] is computeType. The size of array\_d\_work\[j\] is lwork which is the number of elements per device, returned by cusolverMgPotrf\_bufferSize(). If Cholesky factorization failed, i.e. some leading minor of A is not positive definite, or equivalently some diagonal elements of L or U is not a real number. The output parameter info would indicate smallest leading minor of A which is not positive definite. If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle). The generic API has two different types, dataTypeA is data type of the matrix A, andcomputeType is compute type of the operation and data type of the workspace (array\_d\_work) descrA contains dataTypeA, so there is no explicit parameter of dataTypeA. cusolverMgPotrf only supports the following four combinations. Please visit cuSOLVER Library Samples - MgPotrf for a code example. Valid combination of data type and compute type DataTypeA ComputeType Meaning CUDA\_R\_32F CUDA\_R\_32F SPOTRF CUDA\_R\_64F CUDA\_R\_64F DPOTRF CUDA\_C\_32F CUDA\_C\_32F CPOTRF CUDA\_C\_64F CUDA\_C\_64F ZPOTRF API of potrf Parameter Memory In/out Meaning handle host input Handle to the cuSolverMg library context. uplo host input Indicates if matrix A lower or upper part is stored, the other part is not referenced. Only CUBLAS\_FILL\_MODE\_LOWER is supported. N host input Number of rows and columns of matrix sub(A). array\_d\_A host in/out A host pointer array of dimension G. It contains a distributed array containing sub(A) of dimension N \* N. On exit, sub(A) contains the factors L or U. IA host input The row index in the global array A indicating the first row of sub(A). JA host input The column index in the global array A indicating the first column of sub(A). descrA host input Matrix descriptor for the distributed matrix A. computeType host input Data type used for computation. array\_d\_work host in/out A host pointer array of dimension G. array\_d\_work\[j\] points to a device working space in j-th device, array of size lwork. lwork host input Sze of array\_d\_work\[j\], returned by cusolverMgPotrf\_bufferSize. lwork denotes number of elements, not number of bytes. info host output If info = 0, the Cholesky factorization is successful. If info = -i, the i-th parameter is wrong (not counting handle). If info = i, the leading minor of order i is not positive definite. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (M,N<0). CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 3.4.2. cusolverMgPotrs() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. The helper function below can calculate the sizes needed for pre-allocated buffer for cusolverMgPotrs. cusolverStatus\_t cusolverMgPotrs\_bufferSize( cusolverMgHandle\_t handle, cublasFillMode\_t uplo, int n, int nrhs, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, void \*array\_d\_B\[\], int IB, int JB, cudaLibMgMatrixDesc\_t descrB, cudaDataType computeType, int64\_t \*lwork ) The following routine: cusolverStatus\_t cusolverMgPotrs( cusolverMgHandle\_t handle, cublasFillMode\_t uplo, int n, int nrhs, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, void \*array\_d\_B\[\], int IB, int JB, cudaLibMgMatrixDesc\_t descrB, cudaDataType computeType, void \*array\_d\_work\[\], int64\_t lwork, int \*info) This function solves a system of linear equations: \\\[A\*X = B\\\] where A is an \\(n \\times n\\) Hermitian matrix, only lower or upper part is meaningful using the generic API interface. The input parameter uplo indicates which part of the matrix is used. The function would leave other parts untouched. If input parameter uplo is CUBLAS\_FILL\_MODE\_LOWER, the matrix should A contain the lower triangular factor for Cholesky decomposition previously computed by cusolverMgPotrf routine. \\\[A = L\*L^{H}\\\] If input parameter uplo is CUBLAS\_FILL\_MODE\_UPPER, the matrix should A contain the upper triangular factor for Cholesky decomposition previously computed by the cusolverMgPotrf routine. \\\[A = U^{H}\*U\\\] The operation is in-place, i.e. matrix B contains the solution of the linear system on exit. If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle). The user has to provide device working space in array\_d\_work. array\_d\_work is a host pointer array of dimension G, where G is the number of devices. array\_d\_work\[j\] is a device pointer pointing to a device memory in the j-th device. The data type of array\_d\_work\[j\] is computeType. The size of array\_d\_work\[j\] is lwork which is number of elements per device, returned by cusolverMgPotrs\_bufferSize(). If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle). The generic API has four different types: dataTypeA is data type of the matrix A, dataTypeB is data type of the matrix B, computeType is compute type of the operation and data type of the workspace (array\_d\_work) descrA contains dataTypeA and descrB contains dataTypeB and so there is no explicit parameter of dataTypeA and dataTypeB. cusolverMgPotrs only supports the following four combinations. Please visit cuSOLVER Library Samples - MgPotrf for a code example. Valid combination of data type and compute type DataTypeA DataTypeB ComputeType Meaning CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F SPOTRS CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F DPOTRS CUDA\_C\_32F CUDA\_C\_32F CUDA\_C\_32F CPOTRS CUDA\_C\_64F CUDA\_C\_64F CUDA\_C\_64F ZPOTRS API of potrs Parameter Memory In/out Meaning handle host input Handle to the cuSolverMg library context. uplo host input Indicates if matrix A lower or upper part is stored, the other part is not referenced. Only CUBLAS\_FILL\_MODE\_LOWER is supported. N host input Number of rows and columns of matrix sub(A). NRHS host input Number of columns of matrix sub(A) and sub(B). array\_d\_A host in/out A host pointer array of dimension G. It contains a distributed array containing sub(A) of dimension M \* N. On exit, sub(A) contains the factors L and U. IA host input The row index in the global array A indicating the first row of sub(A). JA host input The column index in the global array A indicating the first column of sub(A). descrA host input Matrix descriptor for the distributed matrix A. array\_d\_B host in/out A host pointer array of dimension G. It contains a distributed array containing sub(B) of dimension N \* NRHS. On exit, sub(A) contains the solution to the linear system. IB host input The row index in the global array B indicating the first row of sub(B). JB host input The column index in the global array B indicating the first column of sub(B). descrB host input Matrix descriptor for the distributed matrix B. computeType host input Data type used for computation. array\_d\_work host in/out A host pointer array of dimension G. array\_d\_work\[j\] points to a device working space in j-th device, array of size lwork. lwork host input Size of array\_d\_work\[j\], returned by cusolverMgPotrs\_bufferSize. lwork denotes number of elements, not number of bytes. info host output If info = 0, the routine successful. If info = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (M,N<0). CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 3.4.3. cusolverMgPotri() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. The helper function below can calculate the sizes needed for pre-allocated buffer for cusolverMgPotri. cusolverStatus\_t cusolverMgPotri\_bufferSize( cusolverMgHandle\_t handle, cublasFillMode\_t uplo, int N, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, cudaDataType computeType, int64\_t \*lwork) The following routine: cusolverStatus\_t cusolverMgPotri( cusolverMgHandle\_t handle, cublasFillMode\_t uplo, int N, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, cudaDataType computeType, void \*array\_d\_work\[\], int64\_t lwork, int \*info) This function computes the inverse of a Hermitian positive-definite matrix A using the Cholesky factorization \\\[A = L\*L^{H} = U^{H}\*U\\\] computed by cusolverMgPotrf(). If the input parameter uplo is CUBLAS\_FILL\_MODE\_LOWER, on input, matrix A contains the lower triangular factor of A computed by cusolverMgPotrf. Only lower triangular part of A is processed, and replaced the by lower triangular part of the inverse of A. If the input parameter uplo is CUBLAS\_FILL\_MODE\_UPPER, on input, matrix A contains the upper triangular factor of A computed by cusolverMgPotrf. Only upper triangular part of A is processed, and replaced the by upper triangular part of the inverse of A. The user has to provide device working space in array\_d\_work. array\_d\_work is a host pointer array of dimension G, where G is number of devices. array\_d\_work\[j\] is a device pointer pointing to a device memory in the j-th device. The data type of array\_d\_work\[j\] is computeType. The size of array\_d\_work\[j\] is lwork which is number of elements per device, returned by cusolverMgPotri\_bufferSize(). If the computation of the inverse fails, i.e. some leading minor of L or U, is null, the output parameter info would indicate the smallest leading minor of L or U which is not positive definite. If the output parameter info = -i (less than zero), the i-th parameter is wrong (not counting the handle). The generic API has two different types, dataTypeA is data type of the matrix A, computeType is compute type of the operation and data type of the workspace (array\_d\_work) descrA contains dataTypeA, so there is no explicit parameter of dataTypeA. cusolverMgPotri only supports the following four combinations. Please visit cuSOLVER Library Samples - MgPotrf for a code example. Valid combinations of data type and compute type DataTypeA ComputeType Meaning CUDA\_R\_32F CUDA\_R\_32F SPOTRI CUDA\_R\_64F CUDA\_R\_64F DPOTRI CUDA\_C\_32F CUDA\_C\_32F CPOTRI CUDA\_C\_64F CUDA\_C\_64F ZPOTRI API of potri Parameter Memory In/out Meaning handle host input Handle to the cuSolverMg library context. uplo host input Indicates if matrix A lower or upper part is stored, the other part is not referenced. Only CUBLAS\_FILL\_MODE\_LOWER is supported. N host input Number of rows and columns of matrix sub(A). array\_d\_A host in/out A host pointer array of dimension G. It contains a distributed array containing sub(A) of dimension N \* N. On exit, sub(A) contains the upper or lower triangular part of the inverse of A depending on the value of uplo argument. IA host input The row index in the global array A indicating the first row of sub(A). JA host input The column index in the global array A indicating the first column of sub(A). descrA host input Matrix descriptor for the distributed matrix A. computeType host input Data type used for computation. array\_d\_work host in/out A host pointer array of dimension G. array\_d\_work\[j\] points to a device working space in j-th device, array of size lwork. lwork host input Size of array\_d\_work\[j\], returned by cusolverMgPotri\_bufferSize. lwork denotes number of elements, not number of bytes. info host output If info = 0, the Cholesky factorization is successful. If info = -i, the i-th parameter is wrong (not counting handle). If info = i, the leading minor of order i is zero. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_NOT\_INITIALIZED The library was not initialized. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (M,N<0). CUSOLVER\_STATUS\_ARCH\_MISMATCH The device only supports compute capability 5.0 and above. CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 3.4.4. cusolverMgGetrf() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverMgGetrf\_bufferSize( cusolverMgHandle\_t handle, int M, int N, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, int \*array\_d\_IPIV\[\], cudaDataType\_t computeType, int64\_t \*lwork); cusolverStatus\_t cusolverMgGetrf( cusolverMgHandle\_t handle, int M, int N, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, int \*array\_d\_IPIV\[\], cudaDataType\_t computeType, void \*array\_d\_work\[\], int64\_t lwork, int \*info ); This function computes the LU factorization of an \\(M \\times N\\) matrix \\\[P\*A = L\*U\\\] where A is an \\(M \\times N\\) matrix, P is a permutation matrix, L is a lower triangular matrix with unit diagonal, and U is an upper triangular matrix. The user has to provide device working space in array\_d\_work. array\_d\_work is a host pointer array of dimension G, where G is number of devices. array\_d\_work\[j\] is a device pointer pointing to a device memory in j-th device. The data type of array\_d\_work\[j\] is computeType. The size of array\_d\_work\[j\] is lwork which is number of elements per device, returned by cusolverMgGetrf\_bufferSize(). If LU factorization failed, i.e. matrix A (U) is singular, The output parameter info=i indicates U(i,i) = 0. If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle). If array\_d\_IPIV is null, no pivoting is performed. The factorization is A=L\*U, which is not numerically stable. array\_d\_IPIV must be consistent with array\_d\_A, i.e. JA is the first column of sub(A), also the first column of sub(IPIV). No matter LU factorization failed or not, the output parameter array\_d\_IPIV contains pivoting sequence, row i is interchanged with row array\_d\_IPIV(i). The generic API has three different types, dataTypeA is data type of the matrix A, computeType is compute type of the operation and data type of the workspace (array\_d\_work) descrA contains dataTypeA, so there is no explicit parameter of dataTypeA. cusolverMgGetrf only supports the following four combinations. Please visit cuSOLVER Library Samples - MgGetrf for a code example. Valid combinations of data type and compute type DataTypeA ComputeType Meaning CUDA\_R\_32F CUDA\_R\_32F SGETRF CUDA\_R\_64F CUDA\_R\_64F DGETRF CUDA\_C\_32F CUDA\_C\_32F CGETRF CUDA\_C\_64F CUDA\_C\_64F ZGETRF Remark 1: tile size TA must be less or equal to 512. API of getrf Parameter Memory In/out Meaning handle host input Handle to the cuSolverMg library context. M host input Number of rows of matrix sub(A). N host input Number of columns of matrix sub(A). array\_d\_A host in/out A host pointer array of dimension G. It contains a distributed array containing sub(A) of dimension M \* N. On exit, sub(A) contains the factors L and U. IA host input The row index in the global array A indicating the first row of sub(A). JA host input The column index in the global array A indicating the first column of sub(A). descrA host input Matrix descriptor for the distributed matrix A. array\_d\_IPIV host output A host pointer array of dimension G. it contains a distributed integer array containing sub(IPIV) of size min(M,N). sub(IPIV) contains pivot indices. computeType host input Data type used for computation. array\_d\_work host in/out A host pointer array of dimension G. array\_d\_work\[j\] points to a device working space in j-th device, array of size lwork. lwork host input Size of array\_d\_work\[j\], returned by cusolverMgGetrf\_bufferSize. lwork denotes number of elements, not number of bytes. info host output If info = 0, the LU factorization is successful. If info = -i, the i-th parameter is wrong (not counting handle). If info = i, the U(i,i) = 0. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (M,N<0). CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 3.4.5. cusolverMgGetrs() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverMgGetrs\_bufferSize( cusolverMgHandle\_t handle, cublasOperation\_t TRANS, int N, int NRHS, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, int \*array\_d\_IPIV\[\], void \*array\_d\_B\[\], int IB, int JB, cudaLibMgMatrixDesc\_t descrB, cudaDataType\_t computeType, int64\_t \*lwork); cusolverStatus\_t cusolverMgGetrs( cusolverMgHandle\_t handle, cublasOperation\_t TRANS, int N, int NRHS, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, int \*array\_d\_IPIV\[\], void \*array\_d\_B\[\], int IB, int JB, cudaLibMgMatrixDesc\_t descrB, cudaDataType\_t computeType, void \*array\_d\_work\[\], int64\_t lwork, int \*info ); This function solves a linear system of multiple right-hand sides \\\[op(A)\*X = B\\\] where A is an \\(N \\times N\\) matrix, and was LU-factored by getrf, that is, lower triangular part of A is L, and upper triangular part (including diagonal elements) of A is U. B is an \\(N \\times {NRHS}\\) right-hand side matrix. The solution matrix X overwrites the right-hand-side matrix B. The input parameter TRANS is defined by The user has to provide device working space in array\_d\_work. array\_d\_work is a host pointer array of dimension G, where G is number of devices. array\_d\_work\[j\] is a device pointer pointing to a device memory in j-th device. The data type of array\_d\_work\[j\] is computeType. The size of array\_d\_work\[j\] is lwork which is number of elements per device, returned by cusolverMgGetrs\_bufferSize(). If array\_d\_IPIV is null, no pivoting is performed. Otherwise, array\_d\_IPIV is an output of getrf. It contains pivot indices, which are used to permutate right-hand sides. If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle). The generic API has three different types, dataTypeA is data type of the matrix A, dataTypeB is data type of the matrix B, and computeType is compute type of the operation and data type of the workspace (array\_d\_work) descrA contains dataTypeA, so there is no explicit parameter of dataTypeA. descrB contains dataTypeB, so there is no explicit parameter of dataTypeB. cusolverMgGetrs only supports the following four combinations. Valid combinations of data type and compute type DataTypeA DataTypeB ComputeType Meaning CUDA\_R\_32F CUDA\_R\_32F CUDA\_R\_32F SGETRS CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F DGETRS CUDA\_C\_32F CUDA\_C\_32F CUDA\_C\_32F CGETRS CUDA\_C\_64F CUDA\_C\_64F CUDA\_C\_64F ZGETRS Remark 1: tile size TA must be less or equal to 512. Remark 2: only support TRANS=CUBLAS\_OP\_N. Please visit cuSOLVER Library Samples - MgGetrf for a code example. API of getrs Parameter Memory In/out Meaning handle host input Handle to the cuSolverMG library context. TRANS host input Operation op(A) that is non- or (conj.) transpose. N host input Number of rows and columns of matrix sub(A). NRHS host input Number of columns of matrix sub(B). array\_d\_A host input A host pointer array of dimension G. It contains a distributed array containing sub(A) of dimension M \* N. sub(A) contains the factors L and U. IA host input The row index in the global array A indicating the first row of sub(A). JA host input The column index in the global array A indicating the first column of sub(A). descrA host input Matrix descriptor for the distributed matrix A. array\_d\_IPIV host input A host pointer array of dimension G. it contains a distributed integer array containing sub(IPIV) of dimension min(M,N). sub(IPIV) contains pivot indices. array\_d\_B host in/out A host pointer array of dimension G. It contains a distributed array containing sub(B) of dimension N \* NRHS. IB host input The row index in the global array B indicating the first row of sub(B). JB host input The column index in the global array B indicating the first column of sub(B). descrB host input Matrix descriptor for the distributed matrix B. computeType host input Data type used for computation. array\_d\_work host in/out A host pointer array of dimension G. array\_d\_work\[j\] points to a device working space in j-th device, array of size lwork. lwork host input Size of array\_d\_work\[j\], returned by cusolverMgGetrs\_bufferSize. lwork denotes number of elements, not number of bytes. info host output If info = 0, the operation is successful. If info = -i, the i-th parameter is wrong (not counting handle). Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (N<0 or NRHS<0). CUSOLVER\_STATUS\_INTERNAL\_ERROR An internal operation failed. 3.5. Dense Eigenvalue Solver Reference This section describes the eigenvalue solver API of cuSolverMG. 3.5.1. cusolverMgSyevd() \[DEPRECATED\] \[\[DEPRECATED\]\] cuSolverMG is deprecated. Users are encouraged to use cuSOLVERMp for multi-GPU functionality, both single- and multi-node. The helper functions below can calculate the sizes needed for pre-allocated buffer. cusolverStatus\_t cusolverMgSyevd\_bufferSize( cusolverMgHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int N, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, void \*W, cudaDataType\_t dataTypeW, cudaDataType\_t computeType, int64\_t \*lwork ); cusolverStatus\_t cusolverMgSyevd( cusolverMgHandle\_t handle, cusolverEigMode\_t jobz, cublasFillMode\_t uplo, int N, void \*array\_d\_A\[\], int IA, int JA, cudaLibMgMatrixDesc\_t descrA, void \*W, cudaDataType\_t dataTypeW, cudaDataType\_t computeType, void \*array\_d\_work\[\], int64\_t lwork, int \*info ); This function computes eigenvalues and eigenvectors of a symmetric (Hermitian) \\(N \\times N\\) matrix A. The standard symmetric eigenvalue problem is: \\\[A\*V = V\*\\Lambda\\\] where Λ is a real \\(N \\times N\\) diagonal matrix. V is an \\(N \\times N\\) unitary matrix. The diagonal elements of Λ are the eigenvalues of A in ascending order. cusolverMgSyevd returns the eigenvalues in W and overwrites the eigenvectors in A. W is a host \\(1 \\times N\\) vector. The generic API has three different types, dataTypeA is data type of the matrix A, dataTypeW is data type of the vector W, and computeType is compute type of the operation and data type of the workspace (array\_d\_work) descrA contains dataTypeA, so there is no explicit parameter of dataTypeA. cusolverMgSyevd 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 SSYEVD CUDA\_R\_64F CUDA\_R\_64F CUDA\_R\_64F DSYEVD CUDA\_C\_32F CUDA\_R\_32F CUDA\_C\_32F CHEEVD CUDA\_C\_64F CUDA\_R\_64F CUDA\_C\_64F ZHEEVD The user has to provide device working space in array\_d\_work. array\_d\_work is a host pointer array of dimension G, where G is number of devices. array\_d\_work\[j\] is a device pointer pointing to a device memory in j-th device. The data type of array\_d\_work\[j\] is computeType. The size of array\_d\_work\[j\] is lwork which is number of elements per device, returned by cusolverMgSyevd\_bufferSize(). array\_d\_A is also a host pointer array of dimension G. array\_d\_A\[j\] is a device pointer pointing to a device memory in j-th device. The data type of array\_d\_A\[j\] is dataTypeA. The size of array\_d\_A\[j\] is about N\*TA\*(blocks per device). The user has to prepare array\_d\_A manually (seecuSOLVER Library Samples - MgSyevd for a code example.). If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle). If info = i (greater than zero), the algorithm failed to converge all eigenvalues. If jobz = CUSOLVER\_EIG\_MODE\_VECTOR, A contains the orthonormal eigenvectors of the matrix A. The eigenvectors are computed by a divide and conquer algorithm. Remark 1: only CUBLAS\_FILL\_MODE\_LOWER is supported, so the user has to prepare lower triangle of A. Remark 2: only IA=1 and JA=1 are supported. Remark 3: tile size TA must be less or equal to 1024. To achieve best performance, TA should be 256 or 512. Please visit cuSOLVER Library Samples - MgSyevd for a code example. API of syevd Parameter Memory In/out Meaning handle host input Handle to the cuSolverMG library context. jobz host input Specifies options to either compute eigenvalue only or compute eigen-pair: jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR: Compute eigenvalues only jobz = CUSOLVER\_EIG\_MODE\_VECTOR: Compute eigenvalues and eigenvectors uplo host input Specifies which part of A is stored. uplo = CUBLAS\_FILL\_MODE\_LOWER: Lower triangle of A is stored. uplo = CUBLAS\_FILL\_MODE\_UPPER: Upper triangle of A is stored. Only CUBLAS\_FILL\_MODE\_LOWER is supported. N host input Number of rows (or columns) of matrix sub(A). array\_d\_A host in/out A host pointer array of dimension G. It contains a distributed array containing sub(A) of dimension N \* N. If uplo = CUBLAS\_FILL\_MODE\_UPPER, the leading N-by-N upper triangular part of sub(A) contains the upper triangular part of the matrix sub(A). If uplo = CUBLAS\_FILL\_MODE\_LOWER, the leading N-by-N lower triangular part of sub(A) contains the lower triangular part of the matrix sub(A). On exit, if jobz = CUSOLVER\_EIG\_MODE\_VECTOR, and info = 0, sub(A) contains the orthonormal eigenvectors of the matrix sub(A). If jobz = CUSOLVER\_EIG\_MODE\_NOVECTOR, the contents of A are destroyed. IA host input The row index in the global array A indicating the first row of sub(A). JA host input The column index in the global array A indicating the first column of sub(A). descrA host input Matrix descriptor for the distributed matrix A. W host output A real array of dimension N. The eigenvalue values of sub(A), in ascending order, that is, sorted so that W(i) <= W(i+1). dataTypeW host input Data type of the vector W. computeType host input Data type used for computation. array\_d\_work host in/out A host pointer array of dimension G. array\_d\_work\[j\] points to a device working space in j-th device, array of size lwork. lwork host input Size of array\_d\_work\[j\], returned by cusolverMgSyevd\_bufferSize. lwork denotes number of elements, not number of bytes. info host output If info = 0, the operation is successful. If info = -i, the i-th parameter is wrong (not counting handle). If info = i (> 0), not all eigenvalues converged. Status Returned CUSOLVER\_STATUS\_SUCCESS The operation completed successfully. CUSOLVER\_STATUS\_INVALID\_VALUE Invalid parameters were passed (N<0, or lda