use of org.apache.sysml.runtime.instructions.cp.CPOperand in project incubator-systemml by apache.
the class BinUaggChainSPInstruction method parseInstruction.
public static BinUaggChainSPInstruction parseInstruction(String str) {
// parse instruction parts (without exec type)
String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);
InstructionUtils.checkNumFields(parts, 4);
String opcode = parts[0];
BinaryOperator bop = InstructionUtils.parseBinaryOperator(parts[1]);
AggregateUnaryOperator uaggop = InstructionUtils.parseBasicAggregateUnaryOperator(parts[2]);
CPOperand in = new CPOperand(parts[3]);
CPOperand out = new CPOperand(parts[4]);
return new BinUaggChainSPInstruction(in, out, bop, uaggop, opcode, str);
}
use of org.apache.sysml.runtime.instructions.cp.CPOperand in project incubator-systemml by apache.
the class BinarySPInstruction method processMatrixScalarBinaryInstruction.
protected void processMatrixScalarBinaryInstruction(ExecutionContext ec) {
SparkExecutionContext sec = (SparkExecutionContext) ec;
// get input RDD
String rddVar = (input1.getDataType() == DataType.MATRIX) ? input1.getName() : input2.getName();
JavaPairRDD<MatrixIndexes, MatrixBlock> in1 = sec.getBinaryBlockRDDHandleForVariable(rddVar);
// get operator and scalar
CPOperand scalar = (input1.getDataType() == DataType.MATRIX) ? input2 : input1;
ScalarObject constant = (ScalarObject) ec.getScalarInput(scalar.getName(), scalar.getValueType(), scalar.isLiteral());
ScalarOperator sc_op = (ScalarOperator) _optr;
sc_op = sc_op.setConstant(constant.getDoubleValue());
// execute scalar matrix arithmetic instruction
JavaPairRDD<MatrixIndexes, MatrixBlock> out = in1.mapValues(new MatrixScalarUnaryFunction(sc_op));
// put output RDD handle into symbol table
updateUnaryOutputMatrixCharacteristics(sec, rddVar, output.getName());
sec.setRDDHandleForVariable(output.getName(), out);
sec.addLineageRDD(output.getName(), rddVar);
}
use of org.apache.sysml.runtime.instructions.cp.CPOperand in project incubator-systemml by apache.
the class BuiltinNarySPInstruction method parseInstruction.
public static BuiltinNarySPInstruction parseInstruction(String str) {
String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);
String opcode = parts[0];
CPOperand output = new CPOperand(parts[parts.length - 1]);
CPOperand[] inputs = null;
inputs = new CPOperand[parts.length - 2];
for (int i = 1; i < parts.length - 1; i++) inputs[i - 1] = new CPOperand(parts[i]);
return new BuiltinNarySPInstruction(inputs, output, opcode, str);
}
use of org.apache.sysml.runtime.instructions.cp.CPOperand in project incubator-systemml by apache.
the class CSVReblockSPInstruction method parseInstruction.
public static CSVReblockSPInstruction parseInstruction(String str) {
String opcode = InstructionUtils.getOpCode(str);
if (!opcode.equals("csvrblk"))
throw new DMLRuntimeException("Incorrect opcode for CSVReblockSPInstruction:" + opcode);
// Example parts of CSVReblockSPInstruction:
// [csvrblk, pREADmissing_val_maps·MATRIX·DOUBLE, _mVar37·MATRIX·DOUBLE,
// 1000, 1000, false, ,, true, 0.0]
String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);
CPOperand in = new CPOperand(parts[1]);
CPOperand out = new CPOperand(parts[2]);
int brlen = Integer.parseInt(parts[3]);
int bclen = Integer.parseInt(parts[4]);
boolean hasHeader = Boolean.parseBoolean(parts[5]);
String delim = parts[6];
boolean fill = Boolean.parseBoolean(parts[7]);
double fillValue = Double.parseDouble(parts[8]);
return new CSVReblockSPInstruction(null, in, out, brlen, bclen, hasHeader, delim, fill, fillValue, opcode, str);
}
use of org.apache.sysml.runtime.instructions.cp.CPOperand in project incubator-systemml by apache.
the class CastSPInstruction method parseInstruction.
public static CastSPInstruction parseInstruction(String str) {
String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);
InstructionUtils.checkNumFields(parts, 2);
String opcode = parts[0];
CPOperand in = new CPOperand(parts[1]);
CPOperand out = new CPOperand(parts[2]);
return new CastSPInstruction(null, in, out, opcode, str);
}
Aggregations