use of org.apache.sysml.udf.PackageFunction in project systemml by apache.
the class ExternalFunctionProgramBlock method createInstructions.
/**
* method to create instructions
*/
protected void createInstructions() {
_inst = new ArrayList<>();
// unblock all input matrices
block2CellInst = getBlock2CellInstructions(getInputParams(), _unblockedFileNames);
// assemble information provided through keyvalue pairs
String className = _otherParams.get(ExternalFunctionStatement.CLASS_NAME);
String configFile = _otherParams.get(ExternalFunctionStatement.CONFIG_FILE);
// class name cannot be null, however, configFile and execLocation can be null
if (className == null)
throw new RuntimeException(this.printBlockErrorLocation() + ExternalFunctionStatement.CLASS_NAME + " not provided!");
// assemble input and output operands
CPOperand[] inputs = getOperands(getInputParams());
CPOperand[] outputs = getOperands(getOutputParams());
// generate instruction
PackageFunction fun = createFunctionObject(className, configFile);
ExternalFunctionInvocationInstruction einst = new ExternalFunctionInvocationInstruction(inputs, outputs, fun, _baseDir, InputInfo.TextCellInputInfo);
verifyFunctionInputsOutputs(fun, inputs, outputs);
if (getInputParams().size() > 0)
einst.setLocation(getInputParams().get(0));
else if (getOutputParams().size() > 0)
einst.setLocation(getOutputParams().get(0));
else
einst.setLocation(getFilename(), _beginLine, _endLine, _beginColumn, _endColumn);
_inst.add(einst);
// block output matrices
cell2BlockInst = getCell2BlockInstructions(getOutputParams(), _blockedFileNames);
}
use of org.apache.sysml.udf.PackageFunction in project systemml by apache.
the class ExternalFunctionProgramBlockCP method createInstructions.
@Override
protected void createInstructions() {
_inst = new ArrayList<>();
// assemble information provided through keyvalue pairs
String className = _otherParams.get(ExternalFunctionStatement.CLASS_NAME);
String configFile = _otherParams.get(ExternalFunctionStatement.CONFIG_FILE);
// class name cannot be null, however, configFile and execLocation can be null
if (className == null)
throw new RuntimeException(this.printBlockErrorLocation() + ExternalFunctionStatement.CLASS_NAME + " not provided!");
// assemble input and output param strings
CPOperand[] inputs = getOperands(getInputParams());
CPOperand[] outputs = getOperands(getOutputParams());
// generate instruction
PackageFunction fun = createFunctionObject(className, configFile);
ExternalFunctionInvocationInstruction einst = new ExternalFunctionInvocationInstruction(inputs, outputs, fun, _baseDir, InputInfo.BinaryBlockInputInfo);
verifyFunctionInputsOutputs(fun, inputs, outputs);
_inst.add(einst);
}
Aggregations