public class LibMatrixCUDA extends Object
GPUContext
,
GPUObject
Constructor and Description |
---|
LibMatrixCUDA() |
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.
|
public static boolean isInSparseFormat(GPUContext gCtx, org.apache.sysml.runtime.controlprogram.caching.MatrixObject mo)
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
gCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.image
- input image matrix objectbias
- bias matrix objectfilter
- filter matrix objectoutput
- output matrix objectN
- number of input imagesC
- number of channelsH
- height of each imageW
- width of each imageK
- number of output "channels"R
- height of filterS
- width of filterpad_h
- padding heightpad_w
- padding widthstride_h
- stride heightstride_w
- string widthP
- output heightQ
- output widthDMLRuntimeException
- if errorpublic 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
DMLRuntimeException
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
gCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.image
- the input matrix (or image) allocated on the GPUfilter
- the filter allocated on the GPUoutput
- the output matrix allocated on the GPUN
- number of input imagesC
- number of channelsH
- height of each imageW
- width of each imageK
- number of output "channels"R
- height of filterS
- width of filterpad_h
- padding heightpad_w
- padding widthstride_h
- stride heightstride_w
- string widthP
- output heightQ
- output widthDMLRuntimeException
- if errorpublic 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
gCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.input
- input imagedout
- next layer error propogationoutputBlock
- outputDMLRuntimeException
- if DMLRuntimeException occurspublic 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
gCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.input
- input imagebias
- biasoutputBlock
- outputDMLRuntimeException
- if DMLRuntimeException occurspublic 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
gCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.input
- input imagebias
- biasoutputBlock
- outputDMLRuntimeException
- if DMLRuntimeException occurspublic 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
gCtx
- a valid GPUContext
instName
- name of the instructionimage
- input imagescale
- 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 inputepsilon
- epsilon value used in the batch normalization formulaDMLRuntimeException
- if error occurspublic 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
gCtx
- a valid GPUContext
instName
- name of the instructionimage
- input imagescale
- 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 inputretRunningMean
- (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 formulaexponentialAverageFactor
- factor used in the moving average computationDMLRuntimeException
- if error occurspublic 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
gCtx
- a valid GPUContext
instName
- name of the instructionimage
- input imagedout
- input errors of shape C, H, Wscale
- scale (as per CuDNN) and gamma as per original paper: shape [1, C, 1, 1]ret
- (output) backpropagation errors for previous layerretScale
- backpropagation error for scaleretBias
- backpropagation error for biasepsilon
- epsilon value used in the batch normalization formulaDMLRuntimeException
- if error occurspublic 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
gCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.image
- input imagedout
- errors from next layeroutputBlock
- output errorsN
- number of imagesC
- number of channelsH
- heightW
- widthK
- number of filtersR
- filter heightS
- filter widthpad_h
- pad heightpad_w
- pad widthstride_h
- stride heightstride_w
- stride widthP
- output activation heightQ
- output activation widthDMLRuntimeException
- if DMLRuntimeException occurspublic 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
gCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.filter
- filter used in conv2ddout
- errors from next layeroutput
- output errorsN
- number of imagesC
- number of channelsH
- heightW
- widthK
- number of filtersR
- filter heightS
- filter widthpad_h
- pad heightpad_w
- pad widthstride_h
- stride heightstride_w
- stride widthP
- output activation heightQ
- output activation widthDMLRuntimeException
- if DMLRuntimeException occurspublic 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
gCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.image
- image as matrix objectoutputBlock
- output matrixN
- batch sizeC
- number of channelsH
- height of imageW
- width of imageK
- number of filtersR
- height of filterS
- width of filterpad_h
- vertical paddingpad_w
- horizontal paddingstride_h
- horizontal stridestride_w
- vertical strideP
- (H - R + 1 + 2*pad_h)/stride_hQ
- (W - S + 1 + 2*pad_w)/stride_wDMLRuntimeException
- if DMLRuntimeException occurspublic 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
DMLRuntimeException
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
gCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.image
- image as matrix objectdout
- delta matrix, output of previous layeroutputBlock
- output matrixN
- batch sizeC
- number of channelsH
- height of imageW
- width of imageK
- number of filtersR
- height of filterS
- width of filterpad_h
- vertical paddingpad_w
- horizontal paddingstride_h
- horizontal stridestride_w
- vertical strideP
- (H - R + 1 + 2*pad_h)/stride_hQ
- (W - S + 1 + 2*pad_w)/stride_wDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- currently active ExecutionContext
gCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in
- input matrixoutputName
- name of the output matrixDMLRuntimeException
- if an error occurspublic 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
Memory Usage - If dense, input space - rows * cols, no intermediate memory, output - Max(rows*rows, cols*cols) If sparse, calls matmult
ec
- execution contextgCtx
- 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 nameisLeftTransposed
- if true, left transposedDMLRuntimeException
- if DMLRuntimeException occurspublic 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
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)
ec
- Current ExecutionContext
instancegCtx
- a valid GPUContext
instName
- name of the invoking instruction to recordStatistics
.left
- Matrix Aright
- Matrix BoutputName
- Name of the output matrix C (in code generated after LOP layer)isLeftTransposed
- op for A, transposed or notisRightTransposed
- op for B, tranposed or notDMLRuntimeException
- if DMLRuntimeException occurspublic 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
gCtx
- a valid GPUContext
instName
- name of the invoking instruction to recordStatistics
.output
- output allocated on GPU in column major formatleftRows1
- number of rows in AleftCols1
- number of cols in ArightRows1
- number of rows in BrightCols1
- number of cols in BisLeftTransposed1
- op for A, transposed or notisRightTransposed1
- op for B, transposed or notleftPtr
- A allocated on the GPU in row-major formatrightPtr
- B allocated on the GPU in row-major formatDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- Instance of ExecutionContext
, from which the output variable will be allocatedgCtx
- a valid GPUContext
instName
- name of the invoking instruction to recordStatistics
.in1
- input matrixoutput
- output matrix/scalar nameop
- Instance of AggregateUnaryOperator
which encapsulates the direction of reduction/aggregation and the reduction operation.DMLRuntimeException
- if DMLRuntimeException
occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in
- input matrixoutputName
- output matrix nameop
- scalar operatorDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in
- input matrixoutputName
- output matrix nameisInputTransposed
- true if input transposedop
- scalar operatorDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrix 1in2
- input matrix 2outputName
- output matrix nameop
- binary operatorDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrix 1in2
- input matrix 2outputName
- output matrix nameisLeftTransposed
- true if left-transposedisRightTransposed
- true if right-transposedop
- binary operatorDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- current execution contextgCtx
- current gpu contextinstName
- name of the instruction for maintaining statisticsin1
- input matrix objectixrange
- index range (0-based)outputName
- output matrix objectDMLRuntimeException
- if error occurspublic 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
DMLRuntimeException
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
DMLRuntimeException
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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrixoutputName
- output matrix nameDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- execution contextgCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrix 1in2
- input matrix 2outputName
- output matrix nameconstant
- pointer constantDMLRuntimeException
- if DMLRuntimeException occurspublic 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
ec
- a valid ExecutionContext
gCtx
- a valid GPUContext
instName
- the invoking instruction's name for record Statistics
.in1
- input matrix Ain2
- input matrix BoutputName
- name of the output matrixDMLRuntimeException
- if an error occursCopyright © 2017 The Apache Software Foundation. All rights reserved.