use of org.apache.sysml.runtime.instructions.cp.FunctionCallCPInstruction in project incubator-systemml by apache.
the class EvalFunction method execute.
@Override
public void execute(ExecutionContext ec) {
String fname = ((Scalar) getFunctionInput(0)).getValue();
MatrixObject in = ((Matrix) getFunctionInput(1)).getMatrixObject();
ArrayList<String> inputs = new ArrayList<>();
inputs.add("A");
ArrayList<String> outputs = new ArrayList<>();
outputs.add("B");
ExecutionContext ec2 = ExecutionContextFactory.createContext(ec.getProgram());
CPOperand inName = new CPOperand("TMP", org.apache.sysml.parser.Expression.ValueType.DOUBLE, DataType.MATRIX);
ec2.setVariable("TMP", in);
FunctionCallCPInstruction fcpi = new FunctionCallCPInstruction(null, fname, new CPOperand[] { inName }, inputs, outputs, "eval func");
fcpi.processInstruction(ec2);
MatrixObject out = (MatrixObject) ec2.getVariable("B");
_ret = new Matrix(out, ValueType.Double);
}
use of org.apache.sysml.runtime.instructions.cp.FunctionCallCPInstruction in project incubator-systemml by apache.
the class Statistics method getCPHeavyHitterCode.
public static String getCPHeavyHitterCode(Instruction inst) {
String opcode = null;
if (inst instanceof MRJobInstruction) {
MRJobInstruction mrinst = (MRJobInstruction) inst;
opcode = "MR-Job_" + mrinst.getJobType();
} else if (inst instanceof SPInstruction) {
opcode = "SP_" + InstructionUtils.getOpCode(inst.toString());
if (inst instanceof FunctionCallCPInstruction) {
FunctionCallCPInstruction extfunct = (FunctionCallCPInstruction) inst;
opcode = extfunct.getFunctionName();
}
} else // CPInstructions
{
opcode = InstructionUtils.getOpCode(inst.toString());
if (inst instanceof FunctionCallCPInstruction) {
FunctionCallCPInstruction extfunct = (FunctionCallCPInstruction) inst;
opcode = extfunct.getFunctionName();
}
}
return opcode;
}
Aggregations