org.apache.sysml.runtime.matrix.data

Class LibMatrixCUDA



  • public class LibMatrixCUDA
    extends Object
    All CUDA kernels and library calls are redirected through this class
    See Also:
    GPUContext, GPUObject
    • Constructor Summary

      Constructors 
      Constructor and Description
      LibMatrixCUDA() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void abs(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "abs" operation on a matrix on the GPU
      static void acos(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "acos" operation on a matrix on the GPU
      static void asin(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "asin" operation on a matrix on the GPU
      static void atan(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "atan" operation on a matrix on the GPU
      static void axpy(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2, String outputName, double constant)
      Performs daxpy operation
      static void batchNormalizationBackward(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject image, org.apache.sysml.runtime.controlprogram.caching.MatrixObject dout, org.apache.sysml.runtime.controlprogram.caching.MatrixObject scale, org.apache.sysml.runtime.controlprogram.caching.MatrixObject ret, org.apache.sysml.runtime.controlprogram.caching.MatrixObject retScale, org.apache.sysml.runtime.controlprogram.caching.MatrixObject retBias, double epsilon)
      This method computes the backpropagation errors for image, scale and bias of batch normalization layer
      static void batchNormalizationForwardInference(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject image, org.apache.sysml.runtime.controlprogram.caching.MatrixObject scale, org.apache.sysml.runtime.controlprogram.caching.MatrixObject bias, org.apache.sysml.runtime.controlprogram.caching.MatrixObject runningMean, org.apache.sysml.runtime.controlprogram.caching.MatrixObject runningVar, org.apache.sysml.runtime.controlprogram.caching.MatrixObject ret, double epsilon)
      Performs the forward BatchNormalization layer computation for inference
      static void batchNormalizationForwardTraining(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject image, org.apache.sysml.runtime.controlprogram.caching.MatrixObject scale, org.apache.sysml.runtime.controlprogram.caching.MatrixObject bias, org.apache.sysml.runtime.controlprogram.caching.MatrixObject runningMean, org.apache.sysml.runtime.controlprogram.caching.MatrixObject runningVar, org.apache.sysml.runtime.controlprogram.caching.MatrixObject ret, org.apache.sysml.runtime.controlprogram.caching.MatrixObject retRunningMean, org.apache.sysml.runtime.controlprogram.caching.MatrixObject retRunningVar, double epsilon, double exponentialAverageFactor)
      Performs the forward BatchNormalization layer computation for training
      static void biasAdd(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject input, org.apache.sysml.runtime.controlprogram.caching.MatrixObject bias, org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock)
      Performs the operation corresponding to the DML script: ones = matrix(1, rows=1, cols=Hout*Wout) output = input + matrix(bias %*% ones, rows=1, cols=F*Hout*Wout) This operation is often followed by conv2d and hence we have introduced bias_add(input, bias) built-in function
      static void biasMultiply(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject input, org.apache.sysml.runtime.controlprogram.caching.MatrixObject bias, org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock)
      Performs the operation corresponding to the DML script: ones = matrix(1, rows=1, cols=Hout*Wout) output = input * matrix(bias %*% ones, rows=1, cols=F*Hout*Wout) This operation is often followed by conv2d and hence we have introduced bias_add(input, bias) built-in function
      static void cbind(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2, String outputName) 
      static void ceil(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "ceil" operation on a matrix on the GPU
      static void conv2d(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject image, org.apache.sysml.runtime.controlprogram.caching.MatrixObject filter, org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock, int N, int C, int H, int W, int K, int R, int S, int pad_h, int pad_w, int stride_h, int stride_w, int P, int Q) 
      static void conv2d(GPUContext gCtx, String instName, jcuda.Pointer image, jcuda.Pointer filter, jcuda.Pointer output, int N, int C, int H, int W, int K, int R, int S, int pad_h, int pad_w, int stride_h, int stride_w, int P, int Q)
      Performs 2D convolution Takes up an insignificant amount of intermediate space when CONVOLUTION_PREFERENCE is set to CUDNN_CONVOLUTION_FWD_NO_WORKSPACE Intermediate space is required by the filter descriptor and convolution descriptor which are metadata structures and don't scale with the size of the input
      static void conv2dBackwardData(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject filter, org.apache.sysml.runtime.controlprogram.caching.MatrixObject dout, org.apache.sysml.runtime.controlprogram.caching.MatrixObject output, int N, int C, int H, int W, int K, int R, int S, int pad_h, int pad_w, int stride_h, int stride_w, int P, int Q)
      This method computes the backpropogation errors for previous layer of convolution operation
      static void conv2dBackwardFilter(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject image, org.apache.sysml.runtime.controlprogram.caching.MatrixObject dout, org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock, int N, int C, int H, int W, int K, int R, int S, int pad_h, int pad_w, int stride_h, int stride_w, int P, int Q)
      This method computes the backpropogation errors for filter of convolution operation
      static void conv2dBiasAdd(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject image, org.apache.sysml.runtime.controlprogram.caching.MatrixObject bias, org.apache.sysml.runtime.controlprogram.caching.MatrixObject filter, org.apache.sysml.runtime.controlprogram.caching.MatrixObject output, int N, int C, int H, int W, int K, int R, int S, int pad_h, int pad_w, int stride_h, int stride_w, int P, int Q)
      Does a 2D convolution followed by a bias_add
      static void cos(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "cos" operation on a matrix on the GPU
      static void denseDenseMatmult(GPUContext gCtx, String instName, jcuda.Pointer output, int leftRows1, int leftCols1, int rightRows1, int rightCols1, boolean isLeftTransposed1, boolean isRightTransposed1, jcuda.Pointer leftPtr, jcuda.Pointer rightPtr)
      Dense-dense matrix multiply C = op(A) * op(B), A and B are dense matrices On the host, the matrices are in row-major format; cuBLAS expects them in column-major format.
      static void exp(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "exp" operation on a matrix on the GPU
      static void floor(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "floor" operation on a matrix on the GPU
      static boolean isInSparseFormat(GPUContext gCtx, org.apache.sysml.runtime.controlprogram.caching.MatrixObject mo) 
      static void log(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "log" operation on a matrix on the GPU
      static org.apache.sysml.runtime.controlprogram.caching.MatrixObject matmult(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject left, org.apache.sysml.runtime.controlprogram.caching.MatrixObject right, String outputName, boolean isLeftTransposed, boolean isRightTransposed)
      Matrix multiply on GPU Examines sparsity and shapes and routes call to appropriate method from cuBLAS or cuSparse C = op(A) x op(B)
      static void matmultTSMM(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject left, String outputName, boolean isLeftTransposed)
      Performs tsmm, A %*% A' or A' %*% A, on GPU by exploiting cublasDsyrk(...)
      static void matrixMatrixArithmetic(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2, String outputName, boolean isLeftTransposed, boolean isRightTransposed, org.apache.sysml.runtime.matrix.operators.BinaryOperator op)
      Performs elementwise arithmetic operation specified by op of two input matrices in1 and in2
      static void matrixMatrixRelational(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2, String outputName, org.apache.sysml.runtime.matrix.operators.BinaryOperator op)
      Performs elementwise operation relational specified by op of two input matrices in1 and in2
      static void matrixScalarArithmetic(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in, String outputName, boolean isInputTransposed, org.apache.sysml.runtime.matrix.operators.ScalarOperator op)
      Entry point to perform elementwise matrix-scalar arithmetic operation specified by op
      static void matrixScalarRelational(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in, String outputName, org.apache.sysml.runtime.matrix.operators.ScalarOperator op)
      Entry point to perform elementwise matrix-scalar relational operation specified by op
      static void maxpooling(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject image, org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock, int N, int C, int H, int W, int K, int R, int S, int pad_h, int pad_w, int stride_h, int stride_w, int P, int Q)
      performs maxpooling on GPU by exploiting cudnnPoolingForward(...)
      static void maxpoolingBackward(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject image, org.apache.sysml.runtime.controlprogram.caching.MatrixObject dout, org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock, int N, int C, int H, int W, int K, int R, int S, int pad_h, int pad_w, int stride_h, int stride_w, int P, int Q)
      Performs maxpoolingBackward on GPU by exploiting cudnnPoolingBackward(...) This method computes the backpropogation errors for previous layer of maxpooling operation
      static void performMaxpooling(GPUContext gCtx, String instName, jcuda.Pointer x, jcuda.jcudnn.cudnnTensorDescriptor xDesc, org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock, int N, int C, int H, int W, int K, int R, int S, int pad_h, int pad_w, int stride_h, int stride_w, int P, int Q) 
      static void rbind(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2, String outputName) 
      static void relu(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in, String outputName)
      Performs the relu operation on the GPU.
      static void reluBackward(GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject input, org.apache.sysml.runtime.controlprogram.caching.MatrixObject dout, org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock)
      This method computes the backpropagation errors for previous layer of relu operation
      static void round(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "round" operation on a matrix on the GPU
      static void sign(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "sign" operation on a matrix on the GPU
      static void sin(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "sin" operation on a matrix on the GPU
      static void sliceOperations(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, org.apache.sysml.runtime.util.IndexRange ixrange, String outputName)
      Method to perform rangeReIndex operation for a given lower and upper bounds in row and column dimensions.
      static void solve(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2, String outputName)
      Implements the "solve" function for systemml Ax = B (A is of size m*n, B is of size m*1, x is of size n*1)
      static void sqrt(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "sqrt" operation on a matrix on the GPU
      static void tan(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String outputName)
      Performs an "tan" operation on a matrix on the GPU
      static void transpose(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in, String outputName)
      Transposes the input matrix using cublasDgeam
      static void unaryAggregate(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec, GPUContext gCtx, String instName, org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1, String output, org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator op)
      Entry point to perform Unary aggregate operations on the GPU.
    • Constructor Detail

      • LibMatrixCUDA

        public LibMatrixCUDA()
    • Method Detail

      • isInSparseFormat

        public static boolean isInSparseFormat(GPUContext gCtx,
                                               org.apache.sysml.runtime.controlprogram.caching.MatrixObject mo)
      • conv2dBiasAdd

        public static void conv2dBiasAdd(GPUContext gCtx,
                                         String instName,
                                         org.apache.sysml.runtime.controlprogram.caching.MatrixObject image,
                                         org.apache.sysml.runtime.controlprogram.caching.MatrixObject bias,
                                         org.apache.sysml.runtime.controlprogram.caching.MatrixObject filter,
                                         org.apache.sysml.runtime.controlprogram.caching.MatrixObject output,
                                         int N,
                                         int C,
                                         int H,
                                         int W,
                                         int K,
                                         int R,
                                         int S,
                                         int pad_h,
                                         int pad_w,
                                         int stride_h,
                                         int stride_w,
                                         int P,
                                         int Q)
                                  throws DMLRuntimeException
        Does a 2D convolution followed by a bias_add
        Parameters:
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        image - input image matrix object
        bias - bias matrix object
        filter - filter matrix object
        output - output matrix object
        N - number of input images
        C - number of channels
        H - height of each image
        W - width of each image
        K - number of output "channels"
        R - height of filter
        S - width of filter
        pad_h - padding height
        pad_w - padding width
        stride_h - stride height
        stride_w - string width
        P - output height
        Q - output width
        Throws:
        DMLRuntimeException - if error
      • conv2d

        public static void conv2d(GPUContext gCtx,
                                  String instName,
                                  org.apache.sysml.runtime.controlprogram.caching.MatrixObject image,
                                  org.apache.sysml.runtime.controlprogram.caching.MatrixObject filter,
                                  org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock,
                                  int N,
                                  int C,
                                  int H,
                                  int W,
                                  int K,
                                  int R,
                                  int S,
                                  int pad_h,
                                  int pad_w,
                                  int stride_h,
                                  int stride_w,
                                  int P,
                                  int Q)
                           throws DMLRuntimeException
        Throws:
        DMLRuntimeException
      • conv2d

        public static void conv2d(GPUContext gCtx,
                                  String instName,
                                  jcuda.Pointer image,
                                  jcuda.Pointer filter,
                                  jcuda.Pointer output,
                                  int N,
                                  int C,
                                  int H,
                                  int W,
                                  int K,
                                  int R,
                                  int S,
                                  int pad_h,
                                  int pad_w,
                                  int stride_h,
                                  int stride_w,
                                  int P,
                                  int Q)
                           throws DMLRuntimeException
        Performs 2D convolution Takes up an insignificant amount of intermediate space when CONVOLUTION_PREFERENCE is set to CUDNN_CONVOLUTION_FWD_NO_WORKSPACE Intermediate space is required by the filter descriptor and convolution descriptor which are metadata structures and don't scale with the size of the input
        Parameters:
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        image - the input matrix (or image) allocated on the GPU
        filter - the filter allocated on the GPU
        output - the output matrix allocated on the GPU
        N - number of input images
        C - number of channels
        H - height of each image
        W - width of each image
        K - number of output "channels"
        R - height of filter
        S - width of filter
        pad_h - padding height
        pad_w - padding width
        stride_h - stride height
        stride_w - string width
        P - output height
        Q - output width
        Throws:
        DMLRuntimeException - if error
      • reluBackward

        public static void reluBackward(GPUContext gCtx,
                                        String instName,
                                        org.apache.sysml.runtime.controlprogram.caching.MatrixObject input,
                                        org.apache.sysml.runtime.controlprogram.caching.MatrixObject dout,
                                        org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock)
                                 throws DMLRuntimeException
        This method computes the backpropagation errors for previous layer of relu operation
        Parameters:
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        input - input image
        dout - next layer error propogation
        outputBlock - output
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • biasMultiply

        public static void biasMultiply(GPUContext gCtx,
                                        String instName,
                                        org.apache.sysml.runtime.controlprogram.caching.MatrixObject input,
                                        org.apache.sysml.runtime.controlprogram.caching.MatrixObject bias,
                                        org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock)
                                 throws DMLRuntimeException
        Performs the operation corresponding to the DML script: ones = matrix(1, rows=1, cols=Hout*Wout) output = input * matrix(bias %*% ones, rows=1, cols=F*Hout*Wout) This operation is often followed by conv2d and hence we have introduced bias_add(input, bias) built-in function
        Parameters:
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        input - input image
        bias - bias
        outputBlock - output
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • biasAdd

        public static void biasAdd(GPUContext gCtx,
                                   String instName,
                                   org.apache.sysml.runtime.controlprogram.caching.MatrixObject input,
                                   org.apache.sysml.runtime.controlprogram.caching.MatrixObject bias,
                                   org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock)
                            throws DMLRuntimeException
        Performs the operation corresponding to the DML script: ones = matrix(1, rows=1, cols=Hout*Wout) output = input + matrix(bias %*% ones, rows=1, cols=F*Hout*Wout) This operation is often followed by conv2d and hence we have introduced bias_add(input, bias) built-in function
        Parameters:
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        input - input image
        bias - bias
        outputBlock - output
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • batchNormalizationForwardInference

        public static void batchNormalizationForwardInference(GPUContext gCtx,
                                                              String instName,
                                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject image,
                                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject scale,
                                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject bias,
                                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject runningMean,
                                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject runningVar,
                                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject ret,
                                                              double epsilon)
                                                       throws DMLRuntimeException
        Performs the forward BatchNormalization layer computation for inference
        Parameters:
        gCtx - a valid GPUContext
        instName - name of the instruction
        image - input image
        scale - scale (as per CuDNN) and gamma as per original paper: shape [1, C, 1, 1]
        bias - bias (as per CuDNN) and beta as per original paper: shape [1, C, 1, 1]
        runningMean - running mean accumulated during training phase: shape [1, C, 1, 1]
        runningVar - running variance accumulated during training phase: shape [1, C, 1, 1]
        ret - normalized input
        epsilon - epsilon value used in the batch normalization formula
        Throws:
        DMLRuntimeException - if error occurs
      • batchNormalizationForwardTraining

        public static void batchNormalizationForwardTraining(GPUContext gCtx,
                                                             String instName,
                                                             org.apache.sysml.runtime.controlprogram.caching.MatrixObject image,
                                                             org.apache.sysml.runtime.controlprogram.caching.MatrixObject scale,
                                                             org.apache.sysml.runtime.controlprogram.caching.MatrixObject bias,
                                                             org.apache.sysml.runtime.controlprogram.caching.MatrixObject runningMean,
                                                             org.apache.sysml.runtime.controlprogram.caching.MatrixObject runningVar,
                                                             org.apache.sysml.runtime.controlprogram.caching.MatrixObject ret,
                                                             org.apache.sysml.runtime.controlprogram.caching.MatrixObject retRunningMean,
                                                             org.apache.sysml.runtime.controlprogram.caching.MatrixObject retRunningVar,
                                                             double epsilon,
                                                             double exponentialAverageFactor)
                                                      throws DMLRuntimeException
        Performs the forward BatchNormalization layer computation for training
        Parameters:
        gCtx - a valid GPUContext
        instName - name of the instruction
        image - input image
        scale - scale (as per CuDNN) and gamma as per original paper: shape [1, C, 1, 1]
        bias - bias (as per CuDNN) and beta as per original paper: shape [1, C, 1, 1]
        runningMean - running mean accumulated during training phase: shape [1, C, 1, 1]
        runningVar - running variance accumulated during training phase: shape [1, C, 1, 1]
        ret - (output) normalized input
        retRunningMean - (output) running mean accumulated during training phase: shape [1, C, 1, 1]
        retRunningVar - (output) running variance accumulated during training phase: shape [1, C, 1, 1]
        epsilon - epsilon value used in the batch normalization formula
        exponentialAverageFactor - factor used in the moving average computation
        Throws:
        DMLRuntimeException - if error occurs
      • batchNormalizationBackward

        public static void batchNormalizationBackward(GPUContext gCtx,
                                                      String instName,
                                                      org.apache.sysml.runtime.controlprogram.caching.MatrixObject image,
                                                      org.apache.sysml.runtime.controlprogram.caching.MatrixObject dout,
                                                      org.apache.sysml.runtime.controlprogram.caching.MatrixObject scale,
                                                      org.apache.sysml.runtime.controlprogram.caching.MatrixObject ret,
                                                      org.apache.sysml.runtime.controlprogram.caching.MatrixObject retScale,
                                                      org.apache.sysml.runtime.controlprogram.caching.MatrixObject retBias,
                                                      double epsilon)
                                               throws DMLRuntimeException
        This method computes the backpropagation errors for image, scale and bias of batch normalization layer
        Parameters:
        gCtx - a valid GPUContext
        instName - name of the instruction
        image - input image
        dout - input errors of shape C, H, W
        scale - scale (as per CuDNN) and gamma as per original paper: shape [1, C, 1, 1]
        ret - (output) backpropagation errors for previous layer
        retScale - backpropagation error for scale
        retBias - backpropagation error for bias
        epsilon - epsilon value used in the batch normalization formula
        Throws:
        DMLRuntimeException - if error occurs
      • conv2dBackwardFilter

        public static void conv2dBackwardFilter(GPUContext gCtx,
                                                String instName,
                                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject image,
                                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject dout,
                                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock,
                                                int N,
                                                int C,
                                                int H,
                                                int W,
                                                int K,
                                                int R,
                                                int S,
                                                int pad_h,
                                                int pad_w,
                                                int stride_h,
                                                int stride_w,
                                                int P,
                                                int Q)
                                         throws DMLRuntimeException
        This method computes the backpropogation errors for filter of convolution operation
        Parameters:
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        image - input image
        dout - errors from next layer
        outputBlock - output errors
        N - number of images
        C - number of channels
        H - height
        W - width
        K - number of filters
        R - filter height
        S - filter width
        pad_h - pad height
        pad_w - pad width
        stride_h - stride height
        stride_w - stride width
        P - output activation height
        Q - output activation width
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • conv2dBackwardData

        public static void conv2dBackwardData(GPUContext gCtx,
                                              String instName,
                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject filter,
                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject dout,
                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject output,
                                              int N,
                                              int C,
                                              int H,
                                              int W,
                                              int K,
                                              int R,
                                              int S,
                                              int pad_h,
                                              int pad_w,
                                              int stride_h,
                                              int stride_w,
                                              int P,
                                              int Q)
                                       throws DMLRuntimeException
        This method computes the backpropogation errors for previous layer of convolution operation
        Parameters:
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        filter - filter used in conv2d
        dout - errors from next layer
        output - output errors
        N - number of images
        C - number of channels
        H - height
        W - width
        K - number of filters
        R - filter height
        S - filter width
        pad_h - pad height
        pad_w - pad width
        stride_h - stride height
        stride_w - stride width
        P - output activation height
        Q - output activation width
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • maxpooling

        public static void maxpooling(GPUContext gCtx,
                                      String instName,
                                      org.apache.sysml.runtime.controlprogram.caching.MatrixObject image,
                                      org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock,
                                      int N,
                                      int C,
                                      int H,
                                      int W,
                                      int K,
                                      int R,
                                      int S,
                                      int pad_h,
                                      int pad_w,
                                      int stride_h,
                                      int stride_w,
                                      int P,
                                      int Q)
                               throws DMLRuntimeException
        performs maxpooling on GPU by exploiting cudnnPoolingForward(...)
        Parameters:
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        image - image as matrix object
        outputBlock - output matrix
        N - batch size
        C - number of channels
        H - height of image
        W - width of image
        K - number of filters
        R - height of filter
        S - width of filter
        pad_h - vertical padding
        pad_w - horizontal padding
        stride_h - horizontal stride
        stride_w - vertical stride
        P - (H - R + 1 + 2*pad_h)/stride_h
        Q - (W - S + 1 + 2*pad_w)/stride_w
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • performMaxpooling

        public static void performMaxpooling(GPUContext gCtx,
                                             String instName,
                                             jcuda.Pointer x,
                                             jcuda.jcudnn.cudnnTensorDescriptor xDesc,
                                             org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock,
                                             int N,
                                             int C,
                                             int H,
                                             int W,
                                             int K,
                                             int R,
                                             int S,
                                             int pad_h,
                                             int pad_w,
                                             int stride_h,
                                             int stride_w,
                                             int P,
                                             int Q)
                                      throws DMLRuntimeException
        Throws:
        DMLRuntimeException
      • maxpoolingBackward

        public static void maxpoolingBackward(GPUContext gCtx,
                                              String instName,
                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject image,
                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject dout,
                                              org.apache.sysml.runtime.controlprogram.caching.MatrixObject outputBlock,
                                              int N,
                                              int C,
                                              int H,
                                              int W,
                                              int K,
                                              int R,
                                              int S,
                                              int pad_h,
                                              int pad_w,
                                              int stride_h,
                                              int stride_w,
                                              int P,
                                              int Q)
                                       throws DMLRuntimeException
        Performs maxpoolingBackward on GPU by exploiting cudnnPoolingBackward(...) This method computes the backpropogation errors for previous layer of maxpooling operation
        Parameters:
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        image - image as matrix object
        dout - delta matrix, output of previous layer
        outputBlock - output matrix
        N - batch size
        C - number of channels
        H - height of image
        W - width of image
        K - number of filters
        R - height of filter
        S - width of filter
        pad_h - vertical padding
        pad_w - horizontal padding
        stride_h - horizontal stride
        stride_w - vertical stride
        P - (H - R + 1 + 2*pad_h)/stride_h
        Q - (W - S + 1 + 2*pad_w)/stride_w
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • relu

        public static void relu(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                GPUContext gCtx,
                                String instName,
                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject in,
                                String outputName)
                         throws DMLRuntimeException
        Performs the relu operation on the GPU.
        Parameters:
        ec - currently active ExecutionContext
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in - input matrix
        outputName - name of the output matrix
        Throws:
        DMLRuntimeException - if an error occurs
      • matmultTSMM

        public static void matmultTSMM(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                       GPUContext gCtx,
                                       String instName,
                                       org.apache.sysml.runtime.controlprogram.caching.MatrixObject left,
                                       String outputName,
                                       boolean isLeftTransposed)
                                throws DMLRuntimeException
        Performs tsmm, A %*% A' or A' %*% A, on GPU by exploiting cublasDsyrk(...)

        Memory Usage - If dense, input space - rows * cols, no intermediate memory, output - Max(rows*rows, cols*cols) If sparse, calls matmult

        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        left - input matrix, as in a tsmm expression like A %*% A' or A' %*% A, we just need to check whether the left one is transposed or not, I named it 'left'
        outputName - output matrix name
        isLeftTransposed - if true, left transposed
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • matmult

        public static org.apache.sysml.runtime.controlprogram.caching.MatrixObject matmult(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                                                                           GPUContext gCtx,
                                                                                           String instName,
                                                                                           org.apache.sysml.runtime.controlprogram.caching.MatrixObject left,
                                                                                           org.apache.sysml.runtime.controlprogram.caching.MatrixObject right,
                                                                                           String outputName,
                                                                                           boolean isLeftTransposed,
                                                                                           boolean isRightTransposed)
                                                                                    throws DMLRuntimeException
        Matrix multiply on GPU Examines sparsity and shapes and routes call to appropriate method from cuBLAS or cuSparse C = op(A) x op(B)

        Memory Requirements - Both dense - inputs, output, no intermediate Both sparse - inputs, output, no intermediate One sparse, one dense - inputs, output, intermediates - (input_dim1 * input_dim2) OR (input_dim1 * input_dim2 + input in sparse format)

        Parameters:
        ec - Current ExecutionContext instance
        gCtx - a valid GPUContext
        instName - name of the invoking instruction to recordStatistics.
        left - Matrix A
        right - Matrix B
        outputName - Name of the output matrix C (in code generated after LOP layer)
        isLeftTransposed - op for A, transposed or not
        isRightTransposed - op for B, tranposed or not
        Returns:
        output of matrix multiply
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • denseDenseMatmult

        public static void denseDenseMatmult(GPUContext gCtx,
                                             String instName,
                                             jcuda.Pointer output,
                                             int leftRows1,
                                             int leftCols1,
                                             int rightRows1,
                                             int rightCols1,
                                             boolean isLeftTransposed1,
                                             boolean isRightTransposed1,
                                             jcuda.Pointer leftPtr,
                                             jcuda.Pointer rightPtr)
                                      throws DMLRuntimeException
        Dense-dense matrix multiply C = op(A) * op(B), A and B are dense matrices On the host, the matrices are in row-major format; cuBLAS expects them in column-major format. What we have as input is t(A) and t(B), t(X) = transpose of X. We do t(B) %*% t(A) to get t(C); If we were to calculate t(t(C), we would get the resultant matrix C, but this would be in column-major format. What we really want is t(C). This we already have as the result of t(B) %*% t(A).
        Parameters:
        gCtx - a valid GPUContext
        instName - name of the invoking instruction to recordStatistics.
        output - output allocated on GPU in column major format
        leftRows1 - number of rows in A
        leftCols1 - number of cols in A
        rightRows1 - number of rows in B
        rightCols1 - number of cols in B
        isLeftTransposed1 - op for A, transposed or not
        isRightTransposed1 - op for B, transposed or not
        leftPtr - A allocated on the GPU in row-major format
        rightPtr - B allocated on the GPU in row-major format
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • unaryAggregate

        public static void unaryAggregate(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                          GPUContext gCtx,
                                          String instName,
                                          org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                          String output,
                                          org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator op)
                                   throws DMLRuntimeException
        Entry point to perform Unary aggregate operations on the GPU. The execution context object is used to allocate memory for the GPU.
        Parameters:
        ec - Instance of ExecutionContext, from which the output variable will be allocated
        gCtx - a valid GPUContext
        instName - name of the invoking instruction to recordStatistics.
        in1 - input matrix
        output - output matrix/scalar name
        op - Instance of AggregateUnaryOperator which encapsulates the direction of reduction/aggregation and the reduction operation.
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • matrixScalarRelational

        public static void matrixScalarRelational(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                                  GPUContext gCtx,
                                                  String instName,
                                                  org.apache.sysml.runtime.controlprogram.caching.MatrixObject in,
                                                  String outputName,
                                                  org.apache.sysml.runtime.matrix.operators.ScalarOperator op)
                                           throws DMLRuntimeException
        Entry point to perform elementwise matrix-scalar relational operation specified by op
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in - input matrix
        outputName - output matrix name
        op - scalar operator
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • matrixScalarArithmetic

        public static void matrixScalarArithmetic(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                                  GPUContext gCtx,
                                                  String instName,
                                                  org.apache.sysml.runtime.controlprogram.caching.MatrixObject in,
                                                  String outputName,
                                                  boolean isInputTransposed,
                                                  org.apache.sysml.runtime.matrix.operators.ScalarOperator op)
                                           throws DMLRuntimeException
        Entry point to perform elementwise matrix-scalar arithmetic operation specified by op
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in - input matrix
        outputName - output matrix name
        isInputTransposed - true if input transposed
        op - scalar operator
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • matrixMatrixRelational

        public static void matrixMatrixRelational(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                                  GPUContext gCtx,
                                                  String instName,
                                                  org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                                  org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2,
                                                  String outputName,
                                                  org.apache.sysml.runtime.matrix.operators.BinaryOperator op)
                                           throws DMLRuntimeException
        Performs elementwise operation relational specified by op of two input matrices in1 and in2
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix 1
        in2 - input matrix 2
        outputName - output matrix name
        op - binary operator
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • matrixMatrixArithmetic

        public static void matrixMatrixArithmetic(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                                  GPUContext gCtx,
                                                  String instName,
                                                  org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                                  org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2,
                                                  String outputName,
                                                  boolean isLeftTransposed,
                                                  boolean isRightTransposed,
                                                  org.apache.sysml.runtime.matrix.operators.BinaryOperator op)
                                           throws DMLRuntimeException
        Performs elementwise arithmetic operation specified by op of two input matrices in1 and in2
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix 1
        in2 - input matrix 2
        outputName - output matrix name
        isLeftTransposed - true if left-transposed
        isRightTransposed - true if right-transposed
        op - binary operator
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • transpose

        public static void transpose(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                     GPUContext gCtx,
                                     String instName,
                                     org.apache.sysml.runtime.controlprogram.caching.MatrixObject in,
                                     String outputName)
                              throws DMLRuntimeException
        Transposes the input matrix using cublasDgeam
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • sliceOperations

        public static void sliceOperations(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                           GPUContext gCtx,
                                           String instName,
                                           org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                           org.apache.sysml.runtime.util.IndexRange ixrange,
                                           String outputName)
                                    throws DMLRuntimeException
        Method to perform rangeReIndex operation for a given lower and upper bounds in row and column dimensions.
        Parameters:
        ec - current execution context
        gCtx - current gpu context
        instName - name of the instruction for maintaining statistics
        in1 - input matrix object
        ixrange - index range (0-based)
        outputName - output matrix object
        Throws:
        DMLRuntimeException - if error occurs
      • cbind

        public static void cbind(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                 GPUContext gCtx,
                                 String instName,
                                 org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                 org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2,
                                 String outputName)
                          throws DMLRuntimeException
        Throws:
        DMLRuntimeException
      • rbind

        public static void rbind(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                 GPUContext gCtx,
                                 String instName,
                                 org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                 org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2,
                                 String outputName)
                          throws DMLRuntimeException
        Throws:
        DMLRuntimeException
      • exp

        public static void exp(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                               GPUContext gCtx,
                               String instName,
                               org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                               String outputName)
                        throws DMLRuntimeException
        Performs an "exp" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • sqrt

        public static void sqrt(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                GPUContext gCtx,
                                String instName,
                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                String outputName)
                         throws DMLRuntimeException
        Performs an "sqrt" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • round

        public static void round(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                 GPUContext gCtx,
                                 String instName,
                                 org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                 String outputName)
                          throws DMLRuntimeException
        Performs an "round" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • abs

        public static void abs(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                               GPUContext gCtx,
                               String instName,
                               org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                               String outputName)
                        throws DMLRuntimeException
        Performs an "abs" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • log

        public static void log(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                               GPUContext gCtx,
                               String instName,
                               org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                               String outputName)
                        throws DMLRuntimeException
        Performs an "log" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • floor

        public static void floor(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                 GPUContext gCtx,
                                 String instName,
                                 org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                 String outputName)
                          throws DMLRuntimeException
        Performs an "floor" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • ceil

        public static void ceil(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                GPUContext gCtx,
                                String instName,
                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                String outputName)
                         throws DMLRuntimeException
        Performs an "ceil" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • sin

        public static void sin(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                               GPUContext gCtx,
                               String instName,
                               org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                               String outputName)
                        throws DMLRuntimeException
        Performs an "sin" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • cos

        public static void cos(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                               GPUContext gCtx,
                               String instName,
                               org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                               String outputName)
                        throws DMLRuntimeException
        Performs an "cos" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • tan

        public static void tan(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                               GPUContext gCtx,
                               String instName,
                               org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                               String outputName)
                        throws DMLRuntimeException
        Performs an "tan" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • asin

        public static void asin(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                GPUContext gCtx,
                                String instName,
                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                String outputName)
                         throws DMLRuntimeException
        Performs an "asin" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • acos

        public static void acos(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                GPUContext gCtx,
                                String instName,
                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                String outputName)
                         throws DMLRuntimeException
        Performs an "acos" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • atan

        public static void atan(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                GPUContext gCtx,
                                String instName,
                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                String outputName)
                         throws DMLRuntimeException
        Performs an "atan" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • sign

        public static void sign(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                GPUContext gCtx,
                                String instName,
                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                String outputName)
                         throws DMLRuntimeException
        Performs an "sign" operation on a matrix on the GPU
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix
        outputName - output matrix name
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • axpy

        public static void axpy(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                GPUContext gCtx,
                                String instName,
                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2,
                                String outputName,
                                double constant)
                         throws DMLRuntimeException
        Performs daxpy operation
        Parameters:
        ec - execution context
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix 1
        in2 - input matrix 2
        outputName - output matrix name
        constant - pointer constant
        Throws:
        DMLRuntimeException - if DMLRuntimeException occurs
      • solve

        public static void solve(org.apache.sysml.runtime.controlprogram.context.ExecutionContext ec,
                                 GPUContext gCtx,
                                 String instName,
                                 org.apache.sysml.runtime.controlprogram.caching.MatrixObject in1,
                                 org.apache.sysml.runtime.controlprogram.caching.MatrixObject in2,
                                 String outputName)
                          throws DMLRuntimeException
        Implements the "solve" function for systemml Ax = B (A is of size m*n, B is of size m*1, x is of size n*1)
        Parameters:
        ec - a valid ExecutionContext
        gCtx - a valid GPUContext
        instName - the invoking instruction's name for record Statistics.
        in1 - input matrix A
        in2 - input matrix B
        outputName - name of the output matrix
        Throws:
        DMLRuntimeException - if an error occurs

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