use of org.apache.sysml.lops.LopProperties.ExecType in project incubator-systemml by apache.
the class DataGen method getCPInstruction_Seq.
/**
* Private method that generates CP Instruction for Seq.
*
* @param output output operand
* @return cp instruction for seq
* @throws LopsException if LopsException occurs
*/
private String getCPInstruction_Seq(String output) throws LopsException {
if (method != DataGenMethod.SEQ)
throw new LopsException("Invalid instruction generation for data generation method " + method);
StringBuilder sb = new StringBuilder();
ExecType et = getExecType();
sb.append(et);
sb.append(Lop.OPERAND_DELIMITOR);
Lop iLop = null;
iLop = _inputParams.get(Statement.SEQ_FROM.toString());
String fromString = iLop.prepScalarLabel();
iLop = _inputParams.get(Statement.SEQ_TO.toString());
String toString = iLop.prepScalarLabel();
iLop = _inputParams.get(Statement.SEQ_INCR.toString());
String incrString = iLop.prepScalarLabel();
String rowsString = String.valueOf(this.getOutputParameters().getNumRows());
String colsString = String.valueOf(this.getOutputParameters().getNumCols());
String rowsInBlockString = String.valueOf(this.getOutputParameters().getRowsInBlock());
String colsInBlockString = String.valueOf(this.getOutputParameters().getColsInBlock());
sb.append(DataGen.SEQ_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(fromString);
sb.append(OPERAND_DELIMITOR);
sb.append(toString);
sb.append(OPERAND_DELIMITOR);
sb.append(incrString);
sb.append(OPERAND_DELIMITOR);
if (et == ExecType.MR) {
sb.append(baseDir);
sb.append(OPERAND_DELIMITOR);
}
sb.append(this.prepOutputOperand(output));
return sb.toString();
}
use of org.apache.sysml.lops.LopProperties.ExecType in project incubator-systemml by apache.
the class Plan method checkValidFormatInMR.
/**
* If operation is executed in MR, only certain operations allow
* all formats. In general, unary operations also allow for cell inputs.
* TODO: check and test current format assumptions
*
* @return true if valid format in MR
*/
public boolean checkValidFormatInMR() {
boolean ret = true;
ExecType CLUSTER = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
if (_conf.getExecType() == CLUSTER) {
if (_childs != null)
for (Plan c : _childs) ret &= _node.isValidInputFormatForOperation(c._conf.getFormat());
}
return ret;
}
use of org.apache.sysml.lops.LopProperties.ExecType in project incubator-systemml by apache.
the class GDFEnumOptimizer method rSetRuntimePlanConfig.
private static void rSetRuntimePlanConfig(Plan p, HashMap<Long, Plan> memo) {
ExecType CLUSTER = OptimizerUtils.isSparkExecutionMode() ? ExecType.SPARK : ExecType.MR;
//basic memoization including containment check
if (memo.containsKey(p.getNode().getID())) {
Plan pmemo = memo.get(p.getNode().getID());
if (!p.getInterestingProperties().equals(pmemo.getInterestingProperties())) {
//TODO this would require additional cleanup in special cases
if (_resolve.resolveMismatch(pmemo.getRewriteConfig(), p.getRewriteConfig()))
memo.put(p.getNode().getID(), p);
//logging of encounter plan mismatch
LOG.warn("Configuration mismatch on shared node (" + p.getNode().getHop().getHopID() + "). Falling back to heuristic '" + _resolve.getName() + "'.");
LOG.warn(p.getInterestingProperties().toString());
LOG.warn(memo.get(p.getNode().getID()).getInterestingProperties());
_planMismatches++;
return;
}
}
//set plan configuration
Hop hop = p.getNode().getHop();
if (hop != null) {
RewriteConfig rc = p.getRewriteConfig();
//set exec type
hop.setForcedExecType(rc.getExecType());
//set blocksizes and reblock
hop.setRowsInBlock(rc.getBlockSize());
hop.setColsInBlock(rc.getBlockSize());
if (//after blocksize update
rc.getExecType() == CLUSTER) {
//TODO double check dataop condition - side effect from plan validity
boolean reblock = HopRewriteUtils.alwaysRequiresReblock(hop) || (hop.hasMatrixInputWithDifferentBlocksizes() && !(hop instanceof DataOp));
hop.setRequiresReblock(reblock);
} else
hop.setRequiresReblock(false);
}
//process childs
if (p.getChilds() != null)
for (Plan c : p.getChilds()) rSetRuntimePlanConfig(c, memo);
//memoization (mark as processed)
memo.put(p.getNode().getID(), p);
}
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