Search in sources :

Example 1 with DataGen

use of org.apache.sysml.lops.DataGen in project incubator-systemml by apache.

the class DataGenOp method constructLops.

@Override
public Lop constructLops() {
    // return already created lops
    if (getLops() != null)
        return getLops();
    ExecType et = optFindExecType();
    HashMap<String, Lop> inputLops = new HashMap<>();
    for (Entry<String, Integer> cur : _paramIndexMap.entrySet()) {
        if (cur.getKey().equals(DataExpression.RAND_ROWS) && rowsKnown())
            inputLops.put(cur.getKey(), new LiteralOp(_dim1).constructLops());
        else if (cur.getKey().equals(DataExpression.RAND_COLS) && colsKnown())
            inputLops.put(cur.getKey(), new LiteralOp(_dim2).constructLops());
        else
            inputLops.put(cur.getKey(), getInput().get(cur.getValue()).constructLops());
    }
    DataGen rnd = new DataGen(_op, _id, inputLops, _baseDir, getDataType(), getValueType(), et);
    int k = OptimizerUtils.getConstrainedNumThreads(_maxNumThreads);
    rnd.setNumThreads(k);
    rnd.getOutputParameters().setDimensions(getDim1(), getDim2(), // robust handling for blocksize (important for -exec singlenode; otherwise incorrect results)
    (getRowsInBlock() > 0) ? getRowsInBlock() : ConfigurationManager.getBlocksize(), (getColsInBlock() > 0) ? getColsInBlock() : ConfigurationManager.getBlocksize(), // actual rand nnz might differ (in cp/mr they are corrected after execution)
    (_op == DataGenMethod.RAND && et == ExecType.SPARK && getNnz() != 0) ? -1 : getNnz(), getUpdateType());
    setLineNumbers(rnd);
    setLops(rnd);
    // add reblock/checkpoint lops if necessary
    constructAndSetLopsDataFlowProperties();
    return getLops();
}
Also used : HashMap(java.util.HashMap) ExecType(org.apache.sysml.lops.LopProperties.ExecType) DataGen(org.apache.sysml.lops.DataGen) Lop(org.apache.sysml.lops.Lop)

Example 2 with DataGen

use of org.apache.sysml.lops.DataGen in project systemml by apache.

the class DataGenOp method constructLops.

@Override
public Lop constructLops() {
    // return already created lops
    if (getLops() != null)
        return getLops();
    ExecType et = optFindExecType();
    HashMap<String, Lop> inputLops = new HashMap<>();
    for (Entry<String, Integer> cur : _paramIndexMap.entrySet()) {
        if (cur.getKey().equals(DataExpression.RAND_ROWS) && rowsKnown())
            inputLops.put(cur.getKey(), new LiteralOp(_dim1).constructLops());
        else if (cur.getKey().equals(DataExpression.RAND_COLS) && colsKnown())
            inputLops.put(cur.getKey(), new LiteralOp(_dim2).constructLops());
        else
            inputLops.put(cur.getKey(), getInput().get(cur.getValue()).constructLops());
    }
    DataGen rnd = new DataGen(_op, _id, inputLops, _baseDir, getDataType(), getValueType(), et);
    int k = OptimizerUtils.getConstrainedNumThreads(_maxNumThreads);
    rnd.setNumThreads(k);
    rnd.getOutputParameters().setDimensions(getDim1(), getDim2(), // robust handling for blocksize (important for -exec singlenode; otherwise incorrect results)
    (getRowsInBlock() > 0) ? getRowsInBlock() : ConfigurationManager.getBlocksize(), (getColsInBlock() > 0) ? getColsInBlock() : ConfigurationManager.getBlocksize(), // actual rand nnz might differ (in cp/mr they are corrected after execution)
    (_op == DataGenMethod.RAND && et == ExecType.SPARK && getNnz() != 0) ? -1 : getNnz(), getUpdateType());
    setLineNumbers(rnd);
    setLops(rnd);
    // add reblock/checkpoint lops if necessary
    constructAndSetLopsDataFlowProperties();
    return getLops();
}
Also used : HashMap(java.util.HashMap) ExecType(org.apache.sysml.lops.LopProperties.ExecType) DataGen(org.apache.sysml.lops.DataGen) Lop(org.apache.sysml.lops.Lop)

Aggregations

HashMap (java.util.HashMap)2 DataGen (org.apache.sysml.lops.DataGen)2 Lop (org.apache.sysml.lops.Lop)2 ExecType (org.apache.sysml.lops.LopProperties.ExecType)2