Search in sources :

Example 61 with ExecType

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();
}
Also used : ExecType(org.apache.sysml.lops.LopProperties.ExecType)

Example 62 with ExecType

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;
}
Also used : ExecType(org.apache.sysml.lops.LopProperties.ExecType)

Example 63 with ExecType

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);
}
Also used : Hop(org.apache.sysml.hops.Hop) ExecType(org.apache.sysml.lops.LopProperties.ExecType) DataOp(org.apache.sysml.hops.DataOp)

Example 64 with ExecType

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();
}
Also used : ExecType(org.apache.sysml.lops.LopProperties.ExecType)

Aggregations

ExecType (org.apache.sysml.lops.LopProperties.ExecType)64 Lop (org.apache.sysml.lops.Lop)26 MultiThreadedHop (org.apache.sysml.hops.Hop.MultiThreadedHop)13 Group (org.apache.sysml.lops.Group)13 Aggregate (org.apache.sysml.lops.Aggregate)10 UnaryCP (org.apache.sysml.lops.UnaryCP)7 DataPartition (org.apache.sysml.lops.DataPartition)6 SortKeys (org.apache.sysml.lops.SortKeys)6 CombineUnary (org.apache.sysml.lops.CombineUnary)5 PickByCount (org.apache.sysml.lops.PickByCount)5 ArrayList (java.util.ArrayList)4 CombineBinary (org.apache.sysml.lops.CombineBinary)4 LopsException (org.apache.sysml.lops.LopsException)4 HashMap (java.util.HashMap)3 Data (org.apache.sysml.lops.Data)3 PartialAggregate (org.apache.sysml.lops.PartialAggregate)3 SparkAggType (org.apache.sysml.hops.AggBinaryOp.SparkAggType)2 DataOp (org.apache.sysml.hops.DataOp)2 Hop (org.apache.sysml.hops.Hop)2 OperationTypes (org.apache.sysml.lops.Aggregate.OperationTypes)2