use of org.apache.sysml.runtime.controlprogram.caching.MatrixObject in project incubator-systemml by apache.
the class ConvolutionGPUInstruction method processBiasInstruction.
public void processBiasInstruction(String instOpcode, ExecutionContext ec) {
GPUStatistics.incrementNoOfExecutedGPUInst();
MatrixObject input = getMatrixInputForGPUInstruction(ec, _input1.getName());
MatrixObject bias = getMatrixInputForGPUInstruction(ec, _input2.getName());
MatrixObject out = getDenseMatrixOutputForGPUInstruction(ec, _output.getName(), input.getNumRows(), input.getNumColumns());
if (instOpcode.equalsIgnoreCase("bias_add"))
LibMatrixCUDA.biasAdd(ec.getGPUContext(0), getExtendedOpcode(), input, bias, out);
else if (instOpcode.equalsIgnoreCase("bias_multiply"))
LibMatrixCUDA.biasMultiply(ec.getGPUContext(0), getExtendedOpcode(), input, bias, out);
// release inputs/outputs
ec.releaseMatrixInputForGPUInstruction(_input1.getName());
ec.releaseMatrixInputForGPUInstruction(_input2.getName());
ec.releaseMatrixOutputForGPUInstruction(_output.getName());
}
use of org.apache.sysml.runtime.controlprogram.caching.MatrixObject in project incubator-systemml by apache.
the class MatrixAppendGPUInstruction method processInstruction.
@Override
public void processInstruction(ExecutionContext ec) {
GPUStatistics.incrementNoOfExecutedGPUInst();
String opcode = getOpcode();
MatrixObject mat1 = getMatrixInputForGPUInstruction(ec, input1.getName());
MatrixObject mat2 = getMatrixInputForGPUInstruction(ec, input2.getName());
if (atype == AppendCPInstruction.AppendType.CBIND)
LibMatrixCUDA.cbind(ec, ec.getGPUContext(0), getExtendedOpcode(), mat1, mat2, output.getName());
else if (atype == AppendCPInstruction.AppendType.RBIND)
LibMatrixCUDA.rbind(ec, ec.getGPUContext(0), getExtendedOpcode(), mat1, mat2, output.getName());
else
throw new DMLRuntimeException("Unsupported GPU operator:" + opcode);
ec.releaseMatrixInputForGPUInstruction(input1.getName());
ec.releaseMatrixInputForGPUInstruction(input2.getName());
ec.releaseMatrixOutputForGPUInstruction(output.getName());
}
use of org.apache.sysml.runtime.controlprogram.caching.MatrixObject in project incubator-systemml by apache.
the class MatrixBuiltinGPUInstruction method processInstruction.
@Override
public void processInstruction(ExecutionContext ec) {
GPUStatistics.incrementNoOfExecutedGPUInst();
String opcode = getOpcode();
MatrixObject mat = getMatrixInputForGPUInstruction(ec, _input.getName());
ec.setMetaData(_output.getName(), mat.getNumRows(), mat.getNumColumns());
switch(opcode) {
case "exp":
LibMatrixCUDA.exp(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "sqrt":
LibMatrixCUDA.sqrt(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "log":
LibMatrixCUDA.log(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "round":
LibMatrixCUDA.round(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "floor":
LibMatrixCUDA.floor(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "ceil":
LibMatrixCUDA.ceil(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "abs":
LibMatrixCUDA.abs(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "sin":
LibMatrixCUDA.sin(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "cos":
LibMatrixCUDA.cos(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "tan":
LibMatrixCUDA.tan(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "sinh":
LibMatrixCUDA.sinh(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "cosh":
LibMatrixCUDA.cosh(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "tanh":
LibMatrixCUDA.tanh(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "asin":
LibMatrixCUDA.asin(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "acos":
LibMatrixCUDA.acos(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "atan":
LibMatrixCUDA.atan(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "sign":
LibMatrixCUDA.sign(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "sigmoid":
LibMatrixCUDA.sigmoid(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
case "softmax":
LibMatrixCuDNN.softmax(ec, ec.getGPUContext(0), getExtendedOpcode(), mat, _output.getName());
break;
default:
throw new DMLRuntimeException("Unsupported GPU operator:" + opcode);
}
ec.releaseMatrixInputForGPUInstruction(_input.getName());
ec.releaseMatrixOutputForGPUInstruction(_output.getName());
}
use of org.apache.sysml.runtime.controlprogram.caching.MatrixObject in project incubator-systemml by apache.
the class MatrixMatrixAxpyGPUInstruction method processInstruction.
@Override
public void processInstruction(ExecutionContext ec) {
GPUStatistics.incrementNoOfExecutedGPUInst();
MatrixObject in1 = getMatrixInputForGPUInstruction(ec, _input1.getName());
MatrixObject in2 = getMatrixInputForGPUInstruction(ec, _input2.getName());
ScalarObject scalar = ec.getScalarInput(constant.getName(), constant.getValueType(), constant.isLiteral());
long rlen1 = in1.getNumRows();
long clen1 = in1.getNumColumns();
long rlen2 = in2.getNumRows();
long clen2 = in2.getNumColumns();
if (isValidMMOperation(rlen1, rlen2, clen1, clen2) || isValidMVOperation(rlen1, rlen2, clen1, clen2)) {
ec.setMetaData(_output.getName(), (int) rlen1, (int) clen1);
} else {
throw new DMLRuntimeException("Incorrect dimensions of inputs in GPU axpy operation. input1:" + rlen1 + " X " + clen1 + " and input2:" + rlen2 + " X " + clen2);
}
LibMatrixCUDA.axpy(ec, ec.getGPUContext(0), getExtendedOpcode(), in1, in2, _output.getName(), multiplier * scalar.getDoubleValue());
ec.releaseMatrixInputForGPUInstruction(_input1.getName());
ec.releaseMatrixInputForGPUInstruction(_input2.getName());
ec.releaseMatrixOutputForGPUInstruction(_output.getName());
}
use of org.apache.sysml.runtime.controlprogram.caching.MatrixObject in project incubator-systemml by apache.
the class MatrixMatrixBuiltinGPUInstruction method processInstruction.
@Override
public void processInstruction(ExecutionContext ec) {
GPUStatistics.incrementNoOfExecutedGPUInst();
String opcode = getOpcode();
MatrixObject mat1 = getMatrixInputForGPUInstruction(ec, input1.getName());
MatrixObject mat2 = getMatrixInputForGPUInstruction(ec, input2.getName());
if (opcode.equals("solve")) {
ec.setMetaData(output.getName(), mat1.getNumColumns(), 1);
LibMatrixCUDA.solve(ec, ec.getGPUContext(0), getExtendedOpcode(), mat1, mat2, output.getName());
} else {
throw new DMLRuntimeException("Unsupported GPU operator:" + opcode);
}
ec.releaseMatrixInputForGPUInstruction(input1.getName());
ec.releaseMatrixInputForGPUInstruction(input2.getName());
ec.releaseMatrixOutputForGPUInstruction(output.getName());
}
Aggregations