Search in sources :

Example 11 with RepMat

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

the class QuaternaryOp method constructRightFactorMRLop.

private Lop constructRightFactorMRLop(Hop U, Hop V, boolean cacheV, double m2Size) {
    Lop lV = null;
    if (cacheV) {
        // partitioning of V for read through distributed cache
        boolean needPartV = !V.dimsKnown() || V.getDim1() * V.getDim2() > DistributedCacheInput.PARTITION_SIZE;
        lV = V.constructLops();
        if (needPartV) {
            // requires partitioning
            lV = new DataPartition(lV, DataType.MATRIX, ValueType.DOUBLE, (m2Size > OptimizerUtils.getLocalMemBudget()) ? ExecType.MR : ExecType.CP, PDataPartitionFormat.ROW_BLOCK_WISE_N);
            lV.getOutputParameters().setDimensions(V.getDim1(), V.getDim2(), getRowsInBlock(), getColsInBlock(), V.getNnz());
            setLineNumbers(lV);
        }
    } else {
        // replication of t(V) for shuffle to target block
        Transform ltV = new Transform(V.constructLops(), HopsTransf2Lops.get(ReOrgOp.TRANSPOSE), getDataType(), getValueType(), ExecType.MR);
        ltV.getOutputParameters().setDimensions(V.getDim2(), V.getDim1(), V.getColsInBlock(), V.getRowsInBlock(), V.getNnz());
        setLineNumbers(ltV);
        // nrow of U determines num replicates
        Lop offset = createOffsetLop(U, false);
        lV = new RepMat(ltV, offset, false, V.getDataType(), V.getValueType());
        lV.getOutputParameters().setDimensions(V.getDim2(), V.getDim1(), V.getColsInBlock(), V.getRowsInBlock(), V.getNnz());
        setLineNumbers(lV);
        Group grpV = new Group(lV, Group.OperationTypes.Sort, DataType.MATRIX, ValueType.DOUBLE);
        grpV.getOutputParameters().setDimensions(V.getDim2(), V.getDim1(), V.getColsInBlock(), V.getRowsInBlock(), -1);
        setLineNumbers(grpV);
        lV = grpV;
    }
    return lV;
}
Also used : Group(org.apache.sysml.lops.Group) RepMat(org.apache.sysml.lops.RepMat) Lop(org.apache.sysml.lops.Lop) Transform(org.apache.sysml.lops.Transform) DataPartition(org.apache.sysml.lops.DataPartition)

Aggregations

Group (org.apache.sysml.lops.Group)11 Lop (org.apache.sysml.lops.Lop)11 RepMat (org.apache.sysml.lops.RepMat)11 DataPartition (org.apache.sysml.lops.DataPartition)10 ExecType (org.apache.sysml.lops.LopProperties.ExecType)5 MultiThreadedHop (org.apache.sysml.hops.Hop.MultiThreadedHop)4 Aggregate (org.apache.sysml.lops.Aggregate)4 GroupedAggregate (org.apache.sysml.lops.GroupedAggregate)4 HashMap (java.util.HashMap)2 AppendR (org.apache.sysml.lops.AppendR)2 Binary (org.apache.sysml.lops.Binary)2 BinaryM (org.apache.sysml.lops.BinaryM)2 BinaryScalar (org.apache.sysml.lops.BinaryScalar)2 BinaryUAggChain (org.apache.sysml.lops.BinaryUAggChain)2 CombineBinary (org.apache.sysml.lops.CombineBinary)2 OperationTypes (org.apache.sysml.lops.CombineBinary.OperationTypes)2 CombineUnary (org.apache.sysml.lops.CombineUnary)2 ConvolutionTransform (org.apache.sysml.lops.ConvolutionTransform)2 Data (org.apache.sysml.lops.Data)2 GroupedAggregateM (org.apache.sysml.lops.GroupedAggregateM)2