use of org.apache.sysml.lops.LopProperties.ExecType in project incubator-systemml by apache.
the class DataGenOp method optFindExecType.
@Override
protected ExecType optFindExecType() throws HopsException {
checkAndSetForcedPlatform();
ExecType REMOTE = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
if (_etypeForced != null)
_etype = _etypeForced;
else {
if (OptimizerUtils.isMemoryBasedOptLevel()) {
_etype = findExecTypeByMemEstimate();
} else if (this.areDimsBelowThreshold() || this.isVector())
_etype = ExecType.CP;
else
_etype = REMOTE;
//check for valid CP dimensions and matrix size
checkAndSetInvalidCPDimsAndSize();
}
//mark for recompile (forever)
if (ConfigurationManager.isDynamicRecompilation() && !dimsKnown(true) && _etype == REMOTE)
setRequiresRecompile();
//similarly, sample is currently not supported in MR either
if (_op == DataGenMethod.SINIT)
_etype = ExecType.CP;
//workaround until sample supported in MR
if (_op == DataGenMethod.SAMPLE && _etype == ExecType.MR)
_etype = ExecType.CP;
return _etype;
}
use of org.apache.sysml.lops.LopProperties.ExecType in project incubator-systemml by apache.
the class IndexingOp method optFindExecType.
@Override
protected ExecType optFindExecType() throws HopsException {
checkAndSetForcedPlatform();
ExecType REMOTE = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
if (_etypeForced != null) {
_etype = _etypeForced;
} else {
if (OptimizerUtils.isMemoryBasedOptLevel()) {
_etype = findExecTypeByMemEstimate();
} else if (getInput().get(0).areDimsBelowThreshold()) {
_etype = ExecType.CP;
} else {
_etype = REMOTE;
}
//check for valid CP dimensions and matrix size
checkAndSetInvalidCPDimsAndSize();
}
//mark for recompile (forever)
if (ConfigurationManager.isDynamicRecompilation() && !dimsKnown(true) && _etype == REMOTE)
setRequiresRecompile();
return _etype;
}
use of org.apache.sysml.lops.LopProperties.ExecType in project incubator-systemml by apache.
the class DataGen method getCPInstruction_SInit.
private String getCPInstruction_SInit(String output) throws LopsException {
if (method != DataGenMethod.SINIT)
throw new LopsException("Invalid instruction generation for data generation method " + method);
//prepare instruction parameters
Lop iLop = _inputParams.get(DataExpression.RAND_ROWS.toString());
String rowsString = iLop.prepScalarLabel();
iLop = _inputParams.get(DataExpression.RAND_COLS.toString());
String colsString = iLop.prepScalarLabel();
String rowsInBlockString = String.valueOf(this.getOutputParameters().getRowsInBlock());
String colsInBlockString = String.valueOf(this.getOutputParameters().getColsInBlock());
iLop = _inputParams.get(DataExpression.RAND_MIN.toString());
String minString = iLop.getOutputParameters().getLabel();
if (iLop.isVariable())
throw new LopsException(this.printErrorLocation() + "Parameter " + DataExpression.RAND_MIN + " must be a literal for a Rand operation.");
//generate instruction
StringBuilder sb = new StringBuilder();
ExecType et = getExecType();
sb.append(et);
sb.append(Lop.OPERAND_DELIMITOR);
sb.append(SINIT_OPCODE);
sb.append(OPERAND_DELIMITOR);
sb.append(rowsString);
sb.append(OPERAND_DELIMITOR);
sb.append(colsString);
sb.append(OPERAND_DELIMITOR);
sb.append(rowsInBlockString);
sb.append(OPERAND_DELIMITOR);
sb.append(colsInBlockString);
sb.append(OPERAND_DELIMITOR);
sb.append(minString);
sb.append(OPERAND_DELIMITOR);
sb.append(this.prepOutputOperand(output));
return sb.toString();
}
Aggregations