org.apache.sysds.runtime.matrix.data

## Interface CudaSupportFunctions

- All Known Implementing Classes:
    DoublePrecisionCudaSupportFunctions, SinglePrecisionCudaSupportFunctions

      public interface CudaSupportFunctions

  DESIGN DOCUMENTATION FOR SUPPORTING LOWER PRECISION: 1. SystemDS.cu has been templatized in following way to support different datatype: - Similar to CuBLAS and CuSPARSE, the global kernels have the datatype specification in their name (for example: f for float and d for datatpe). But unlike CuBLAS and CuSPARSE, these are suffixes so as to simplify the engine. - The global kernels with datatype specification invoke a corresponding templatized kernel (without suffix) which contains the core logic. - The suffixes are added in JCudaKernels's launchKernel method before invocation. For example: `template < typename T > __device__ void matrix_atan(T *A, T *C, unsigned int size) { int index = blockIdx.x * blockDim.x + threadIdx.x; if (index < size){ C[index] = atan(A[index]); } } extern "C" __global__ void matrix_atand(double *A, double *C, unsigned int size) { matrix_atan(A, C, size); } extern "C" __global__ void matrix_atanf(float *A, float *C, unsigned int size) { matrix_atan(A, C, size); }` 2. The CUDA library calls (such as CuBLAS, CuSPARSE, etc) go through this interface. The naming and parameters of the methods in this class are consistent with that of CUDA library to simplify development. 3. During SystemDS initialization, the appropriate class implementing CudaKernels interface is set based on the configuration property sysds.dataType.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `PERFORM_CONVERSION_ON_DEVICE`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `cublasaxpy(jcuda.jcublas.cublasHandle handle, int n, jcuda.Pointer alpha, jcuda.Pointer x, int incx, jcuda.Pointer y, int incy)`
    `int` | `cublasdot(jcuda.jcublas.cublasHandle handle, int n, jcuda.Pointer x, int incx, jcuda.Pointer y, int incy, jcuda.Pointer result)`
    `int` | `cublasgeam(jcuda.jcublas.cublasHandle handle, int transa, int transb, int m, int n, jcuda.Pointer alpha, jcuda.Pointer A, int lda, jcuda.Pointer beta, jcuda.Pointer B, int ldb, jcuda.Pointer C, int ldc)`
    `int` | `cublasgemm(jcuda.jcublas.cublasHandle handle, int transa, int transb, int m, int n, int k, jcuda.Pointer alpha, jcuda.Pointer A, int lda, jcuda.Pointer B, int ldb, jcuda.Pointer beta, jcuda.Pointer C, int ldc)`
    `int` | `cublasgemv(jcuda.jcublas.cublasHandle handle, int trans, int m, int n, jcuda.Pointer alpha, jcuda.Pointer A, int lda, jcuda.Pointer x, int incx, jcuda.Pointer beta, jcuda.Pointer y, int incy)`
    `int` | `cublassyrk(jcuda.jcublas.cublasHandle handle, int uplo, int trans, int n, int k, jcuda.Pointer alpha, jcuda.Pointer A, int lda, jcuda.Pointer beta, jcuda.Pointer C, int ldc)`
    `int` | `cublastrsm(jcuda.jcublas.cublasHandle handle, int side, int uplo, int trans, int diag, int m, int n, jcuda.Pointer alpha, jcuda.Pointer A, int lda, jcuda.Pointer B, int ldb)`
    `int` | `cusolverDngeqrf_bufferSize(jcuda.jcusolver.cusolverDnHandle handle, int m, int n, jcuda.Pointer A, int lda, int[] Lwork)`
    `int` | `cusolverDngeqrf(jcuda.jcusolver.cusolverDnHandle handle, int m, int n, jcuda.Pointer A, int lda, jcuda.Pointer TAU, jcuda.Pointer Workspace, int Lwork, jcuda.Pointer devInfo)`
    `int` | `cusolverDnormqr(jcuda.jcusolver.cusolverDnHandle handle, int side, int trans, int m, int n, int k, jcuda.Pointer A, int lda, jcuda.Pointer tau, jcuda.Pointer C, int ldc, jcuda.Pointer work, int lwork, jcuda.Pointer devInfo)`
    `int` | `cusparsecsr2csc(jcuda.jcusparse.cusparseHandle handle, int m, int n, int nnz, jcuda.Pointer csrVal, jcuda.Pointer csrRowPtr, jcuda.Pointer csrColInd, jcuda.Pointer cscVal, jcuda.Pointer cscRowInd, jcuda.Pointer cscColPtr, int copyValues, int idxBase)`
    `int` | `cusparsecsr2dense(jcuda.jcusparse.cusparseHandle handle, int m, int n, jcuda.jcusparse.cusparseMatDescr descrA, jcuda.Pointer csrValA, jcuda.Pointer csrRowPtrA, jcuda.Pointer csrColIndA, jcuda.Pointer A, int lda)`
    `int` | `cusparsecsrgeam(jcuda.jcusparse.cusparseHandle handle, int m, int n, jcuda.Pointer alpha, jcuda.jcusparse.cusparseMatDescr descrA, int nnzA, jcuda.Pointer csrValA, jcuda.Pointer csrRowPtrA, jcuda.Pointer csrColIndA, jcuda.Pointer beta, jcuda.jcusparse.cusparseMatDescr descrB, int nnzB, jcuda.Pointer csrValB, jcuda.Pointer csrRowPtrB, jcuda.Pointer csrColIndB, jcuda.jcusparse.cusparseMatDescr descrC, jcuda.Pointer csrValC, jcuda.Pointer csrRowPtrC, jcuda.Pointer csrColIndC)`
    `int` | `cusparsecsrgemm(jcuda.jcusparse.cusparseHandle handle, int transA, int transB, int m, int n, int k, jcuda.jcusparse.cusparseMatDescr descrA, int nnzA, jcuda.Pointer csrValA, jcuda.Pointer csrRowPtrA, jcuda.Pointer csrColIndA, jcuda.jcusparse.cusparseMatDescr descrB, int nnzB, jcuda.Pointer csrValB, jcuda.Pointer csrRowPtrB, jcuda.Pointer csrColIndB, jcuda.jcusparse.cusparseMatDescr descrC, jcuda.Pointer csrValC, jcuda.Pointer csrRowPtrC, jcuda.Pointer csrColIndC)`
    `int` | `cusparsecsrmm2(jcuda.jcusparse.cusparseHandle handle, int transa, int transb, int m, int n, int k, int nnz, jcuda.Pointer alpha, jcuda.jcusparse.cusparseMatDescr descrA, jcuda.Pointer csrValA, jcuda.Pointer csrRowPtrA, jcuda.Pointer csrColIndA, jcuda.Pointer B, int ldb, jcuda.Pointer beta, jcuda.Pointer C, int ldc)`
    `int` | `cusparsecsrmv(jcuda.jcusparse.cusparseHandle handle, int transA, int m, int n, int nnz, jcuda.Pointer alpha, jcuda.jcusparse.cusparseMatDescr descrA, jcuda.Pointer csrValA, jcuda.Pointer csrRowPtrA, jcuda.Pointer csrColIndA, jcuda.Pointer x, jcuda.Pointer beta, jcuda.Pointer y)`
    `int` | `cusparsedense2csr(jcuda.jcusparse.cusparseHandle handle, int m, int n, jcuda.jcusparse.cusparseMatDescr descrA, jcuda.Pointer A, int lda, jcuda.Pointer nnzPerRow, jcuda.Pointer csrValA, jcuda.Pointer csrRowPtrA, jcuda.Pointer csrColIndA)`
    `int` | `cusparsennz(jcuda.jcusparse.cusparseHandle handle, int dirA, int m, int n, jcuda.jcusparse.cusparseMatDescr descrA, jcuda.Pointer A, int lda, jcuda.Pointer nnzPerRowCol, jcuda.Pointer nnzTotalDevHostPtr)`
    `void` | `deviceToHost(GPUContext gCtx, jcuda.Pointer src, double[] dest, String instName, boolean isEviction)`
    `void` | `hostToDevice(GPUContext gCtx, double[] src, jcuda.Pointer dest, String instName)`

- - ### Field Detail

    - #### PERFORM_CONVERSION_ON_DEVICE

          static final boolean PERFORM_CONVERSION_ON_DEVICE

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### cusparsecsrgemm

          int cusparsecsrgemm(jcuda.jcusparse.cusparseHandle handle,
                              int transA,
                              int transB,
                              int m,
                              int n,
                              int k,
                              jcuda.jcusparse.cusparseMatDescr descrA,
                              int nnzA,
                              jcuda.Pointer csrValA,
                              jcuda.Pointer csrRowPtrA,
                              jcuda.Pointer csrColIndA,
                              jcuda.jcusparse.cusparseMatDescr descrB,
                              int nnzB,
                              jcuda.Pointer csrValB,
                              jcuda.Pointer csrRowPtrB,
                              jcuda.Pointer csrColIndB,
                              jcuda.jcusparse.cusparseMatDescr descrC,
                              jcuda.Pointer csrValC,
                              jcuda.Pointer csrRowPtrC,
                              jcuda.Pointer csrColIndC)

    - #### cublasgeam

          int cublasgeam(jcuda.jcublas.cublasHandle handle,
                         int transa,
                         int transb,
                         int m,
                         int n,
                         jcuda.Pointer alpha,
                         jcuda.Pointer A,
                         int lda,
                         jcuda.Pointer beta,
                         jcuda.Pointer B,
                         int ldb,
                         jcuda.Pointer C,
                         int ldc)

    - #### cusparsecsrmv

          int cusparsecsrmv(jcuda.jcusparse.cusparseHandle handle,
                            int transA,
                            int m,
                            int n,
                            int nnz,
                            jcuda.Pointer alpha,
                            jcuda.jcusparse.cusparseMatDescr descrA,
                            jcuda.Pointer csrValA,
                            jcuda.Pointer csrRowPtrA,
                            jcuda.Pointer csrColIndA,
                            jcuda.Pointer x,
                            jcuda.Pointer beta,
                            jcuda.Pointer y)

    - #### cusparsecsrmm2

          int cusparsecsrmm2(jcuda.jcusparse.cusparseHandle handle,
                             int transa,
                             int transb,
                             int m,
                             int n,
                             int k,
                             int nnz,
                             jcuda.Pointer alpha,
                             jcuda.jcusparse.cusparseMatDescr descrA,
                             jcuda.Pointer csrValA,
                             jcuda.Pointer csrRowPtrA,
                             jcuda.Pointer csrColIndA,
                             jcuda.Pointer B,
                             int ldb,
                             jcuda.Pointer beta,
                             jcuda.Pointer C,
                             int ldc)

    - #### cublasdot

          int cublasdot(jcuda.jcublas.cublasHandle handle,
                        int n,
                        jcuda.Pointer x,
                        int incx,
                        jcuda.Pointer y,
                        int incy,
                        jcuda.Pointer result)

    - #### cublasgemv

          int cublasgemv(jcuda.jcublas.cublasHandle handle,
                         int trans,
                         int m,
                         int n,
                         jcuda.Pointer alpha,
                         jcuda.Pointer A,
                         int lda,
                         jcuda.Pointer x,
                         int incx,
                         jcuda.Pointer beta,
                         jcuda.Pointer y,
                         int incy)

    - #### cublasgemm

          int cublasgemm(jcuda.jcublas.cublasHandle handle,
                         int transa,
                         int transb,
                         int m,
                         int n,
                         int k,
                         jcuda.Pointer alpha,
                         jcuda.Pointer A,
                         int lda,
                         jcuda.Pointer B,
                         int ldb,
                         jcuda.Pointer beta,
                         jcuda.Pointer C,
                         int ldc)

    - #### cusparsecsr2csc

          int cusparsecsr2csc(jcuda.jcusparse.cusparseHandle handle,
                              int m,
                              int n,
                              int nnz,
                              jcuda.Pointer csrVal,
                              jcuda.Pointer csrRowPtr,
                              jcuda.Pointer csrColInd,
                              jcuda.Pointer cscVal,
                              jcuda.Pointer cscRowInd,
                              jcuda.Pointer cscColPtr,
                              int copyValues,
                              int idxBase)

    - #### cublassyrk

          int cublassyrk(jcuda.jcublas.cublasHandle handle,
                         int uplo,
                         int trans,
                         int n,
                         int k,
                         jcuda.Pointer alpha,
                         jcuda.Pointer A,
                         int lda,
                         jcuda.Pointer beta,
                         jcuda.Pointer C,
                         int ldc)

    - #### cublasaxpy

          int cublasaxpy(jcuda.jcublas.cublasHandle handle,
                         int n,
                         jcuda.Pointer alpha,
                         jcuda.Pointer x,
                         int incx,
                         jcuda.Pointer y,
                         int incy)

    - #### cublastrsm

          int cublastrsm(jcuda.jcublas.cublasHandle handle,
                         int side,
                         int uplo,
                         int trans,
                         int diag,
                         int m,
                         int n,
                         jcuda.Pointer alpha,
                         jcuda.Pointer A,
                         int lda,
                         jcuda.Pointer B,
                         int ldb)

    - #### cusolverDngeqrf_bufferSize

          int cusolverDngeqrf_bufferSize(jcuda.jcusolver.cusolverDnHandle handle,
                                         int m,
                                         int n,
                                         jcuda.Pointer A,
                                         int lda,
                                         int[] Lwork)

    - #### cusolverDngeqrf

          int cusolverDngeqrf(jcuda.jcusolver.cusolverDnHandle handle,
                              int m,
                              int n,
                              jcuda.Pointer A,
                              int lda,
                              jcuda.Pointer TAU,
                              jcuda.Pointer Workspace,
                              int Lwork,
                              jcuda.Pointer devInfo)

    - #### cusolverDnormqr

          int cusolverDnormqr(jcuda.jcusolver.cusolverDnHandle handle,
                              int side,
                              int trans,
                              int m,
                              int n,
                              int k,
                              jcuda.Pointer A,
                              int lda,
                              jcuda.Pointer tau,
                              jcuda.Pointer C,
                              int ldc,
                              jcuda.Pointer work,
                              int lwork,
                              jcuda.Pointer devInfo)

    - #### cusparsecsrgeam

          int cusparsecsrgeam(jcuda.jcusparse.cusparseHandle handle,
                              int m,
                              int n,
                              jcuda.Pointer alpha,
                              jcuda.jcusparse.cusparseMatDescr descrA,
                              int nnzA,
                              jcuda.Pointer csrValA,
                              jcuda.Pointer csrRowPtrA,
                              jcuda.Pointer csrColIndA,
                              jcuda.Pointer beta,
                              jcuda.jcusparse.cusparseMatDescr descrB,
                              int nnzB,
                              jcuda.Pointer csrValB,
                              jcuda.Pointer csrRowPtrB,
                              jcuda.Pointer csrColIndB,
                              jcuda.jcusparse.cusparseMatDescr descrC,
                              jcuda.Pointer csrValC,
                              jcuda.Pointer csrRowPtrC,
                              jcuda.Pointer csrColIndC)

    - #### cusparsecsr2dense

          int cusparsecsr2dense(jcuda.jcusparse.cusparseHandle handle,
                                int m,
                                int n,
                                jcuda.jcusparse.cusparseMatDescr descrA,
                                jcuda.Pointer csrValA,
                                jcuda.Pointer csrRowPtrA,
                                jcuda.Pointer csrColIndA,
                                jcuda.Pointer A,
                                int lda)

    - #### cusparsedense2csr

          int cusparsedense2csr(jcuda.jcusparse.cusparseHandle handle,
                                int m,
                                int n,
                                jcuda.jcusparse.cusparseMatDescr descrA,
                                jcuda.Pointer A,
                                int lda,
                                jcuda.Pointer nnzPerRow,
                                jcuda.Pointer csrValA,
                                jcuda.Pointer csrRowPtrA,
                                jcuda.Pointer csrColIndA)

    - #### cusparsennz

          int cusparsennz(jcuda.jcusparse.cusparseHandle handle,
                          int dirA,
                          int m,
                          int n,
                          jcuda.jcusparse.cusparseMatDescr descrA,
                          jcuda.Pointer A,
                          int lda,
                          jcuda.Pointer nnzPerRowCol,
                          jcuda.Pointer nnzTotalDevHostPtr)

    - #### deviceToHost

          void deviceToHost(GPUContext gCtx,
                            jcuda.Pointer src,
                            double[] dest,
                            String instName,
                            boolean isEviction)

    - #### hostToDevice

          void hostToDevice(GPUContext gCtx,
                            double[] src,
                            jcuda.Pointer dest,
                            String instName)

Copyright © 2020 The Apache Software Foundation. All rights reserved.