Search in sources :

Example 1 with MMCJ

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

the class AggBinaryOp method constructMRLopsCPMM.

private void constructMRLopsCPMM() {
    if (isLeftTransposeRewriteApplicable(false, false)) {
        setLops(constructMRLopsCPMMWithLeftTransposeRewrite());
    } else // general case
    {
        Hop X = getInput().get(0);
        Hop Y = getInput().get(1);
        MMCJType type = getMMCJAggregationType(X, Y);
        MMCJ mmcj = new MMCJ(X.constructLops(), Y.constructLops(), getDataType(), getValueType(), type, ExecType.MR);
        setOutputDimensions(mmcj);
        setLineNumbers(mmcj);
        Group grp = new Group(mmcj, Group.OperationTypes.Sort, getDataType(), getValueType());
        setOutputDimensions(grp);
        setLineNumbers(grp);
        Aggregate agg1 = new Aggregate(grp, HopsAgg2Lops.get(outerOp), getDataType(), getValueType(), ExecType.MR);
        setOutputDimensions(agg1);
        setLineNumbers(agg1);
        // aggregation uses kahanSum but the inputs do not have correction values
        agg1.setupCorrectionLocation(CorrectionLocationType.NONE);
        setLops(agg1);
    }
}
Also used : Group(org.apache.sysml.lops.Group) MMCJ(org.apache.sysml.lops.MMCJ) MultiThreadedHop(org.apache.sysml.hops.Hop.MultiThreadedHop) MMCJType(org.apache.sysml.lops.MMCJ.MMCJType) Aggregate(org.apache.sysml.lops.Aggregate)

Example 2 with MMCJ

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

the class AggBinaryOp method constructSparkLopsCPMMWithLeftTransposeRewrite.

private Lop constructSparkLopsCPMMWithLeftTransposeRewrite() {
    SparkAggType aggtype = getSparkMMAggregationType(true);
    // guaranteed to exists
    Hop X = getInput().get(0).getInput().get(0);
    Hop Y = getInput().get(1);
    // right vector transpose CP
    Lop tY = new Transform(Y.constructLops(), OperationTypes.Transpose, getDataType(), getValueType(), ExecType.CP);
    tY.getOutputParameters().setDimensions(Y.getDim2(), Y.getDim1(), getRowsInBlock(), getColsInBlock(), Y.getNnz());
    setLineNumbers(tY);
    // matrix multiply
    _outputEmptyBlocks = !OptimizerUtils.allowsToFilterEmptyBlockOutputs(this);
    MMCJ mmcj = new MMCJ(tY, X.constructLops(), getDataType(), getValueType(), _outputEmptyBlocks, aggtype, ExecType.SPARK);
    mmcj.getOutputParameters().setDimensions(getDim1(), getDim2(), getRowsInBlock(), getColsInBlock(), getNnz());
    setLineNumbers(mmcj);
    // result transpose CP
    Lop out = new Transform(mmcj, OperationTypes.Transpose, getDataType(), getValueType(), ExecType.CP);
    out.getOutputParameters().setDimensions(X.getDim2(), Y.getDim2(), getRowsInBlock(), getColsInBlock(), getNnz());
    return out;
}
Also used : MMCJ(org.apache.sysml.lops.MMCJ) MultiThreadedHop(org.apache.sysml.hops.Hop.MultiThreadedHop) Lop(org.apache.sysml.lops.Lop) Transform(org.apache.sysml.lops.Transform)

Example 3 with MMCJ

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

the class AggBinaryOp method constructMRLopsCPMMWithLeftTransposeRewrite.

private Lop constructMRLopsCPMMWithLeftTransposeRewrite() {
    // guaranteed to exists
    Hop X = getInput().get(0).getInput().get(0);
    Hop Y = getInput().get(1);
    // right vector transpose CP
    Lop tY = new Transform(Y.constructLops(), OperationTypes.Transpose, getDataType(), getValueType(), ExecType.CP);
    tY.getOutputParameters().setDimensions(Y.getDim2(), Y.getDim1(), getRowsInBlock(), getColsInBlock(), Y.getNnz());
    setLineNumbers(tY);
    // matrix multiply
    MMCJType type = getMMCJAggregationType(X, Y);
    MMCJ mmcj = new MMCJ(tY, X.constructLops(), getDataType(), getValueType(), type, ExecType.MR);
    setOutputDimensions(mmcj);
    setLineNumbers(mmcj);
    Group grp = new Group(mmcj, Group.OperationTypes.Sort, getDataType(), getValueType());
    setOutputDimensions(grp);
    setLineNumbers(grp);
    Aggregate agg1 = new Aggregate(grp, HopsAgg2Lops.get(outerOp), getDataType(), getValueType(), ExecType.MR);
    setOutputDimensions(agg1);
    setLineNumbers(agg1);
    // aggregation uses kahanSum but the inputs do not have correction values
    agg1.setupCorrectionLocation(CorrectionLocationType.NONE);
    // result transpose CP
    Lop out = new Transform(agg1, OperationTypes.Transpose, getDataType(), getValueType(), ExecType.CP);
    out.getOutputParameters().setDimensions(X.getDim2(), Y.getDim2(), getRowsInBlock(), getColsInBlock(), getNnz());
    return out;
}
Also used : Group(org.apache.sysml.lops.Group) MMCJ(org.apache.sysml.lops.MMCJ) MultiThreadedHop(org.apache.sysml.hops.Hop.MultiThreadedHop) MMCJType(org.apache.sysml.lops.MMCJ.MMCJType) Lop(org.apache.sysml.lops.Lop) Transform(org.apache.sysml.lops.Transform) Aggregate(org.apache.sysml.lops.Aggregate)

Example 4 with MMCJ

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

the class AggBinaryOp method constructSparkLopsCPMMWithLeftTransposeRewrite.

private Lop constructSparkLopsCPMMWithLeftTransposeRewrite() {
    SparkAggType aggtype = getSparkMMAggregationType(true);
    // guaranteed to exists
    Hop X = getInput().get(0).getInput().get(0);
    Hop Y = getInput().get(1);
    // right vector transpose CP
    Lop tY = new Transform(Y.constructLops(), OperationTypes.Transpose, getDataType(), getValueType(), ExecType.CP);
    tY.getOutputParameters().setDimensions(Y.getDim2(), Y.getDim1(), getRowsInBlock(), getColsInBlock(), Y.getNnz());
    setLineNumbers(tY);
    // matrix multiply
    MMCJ mmcj = new MMCJ(tY, X.constructLops(), getDataType(), getValueType(), aggtype, ExecType.SPARK);
    mmcj.getOutputParameters().setDimensions(getDim1(), getDim2(), getRowsInBlock(), getColsInBlock(), getNnz());
    setLineNumbers(mmcj);
    // result transpose CP
    Lop out = new Transform(mmcj, OperationTypes.Transpose, getDataType(), getValueType(), ExecType.CP);
    out.getOutputParameters().setDimensions(X.getDim2(), Y.getDim2(), getRowsInBlock(), getColsInBlock(), getNnz());
    return out;
}
Also used : MMCJ(org.apache.sysml.lops.MMCJ) MultiThreadedHop(org.apache.sysml.hops.Hop.MultiThreadedHop) Lop(org.apache.sysml.lops.Lop) Transform(org.apache.sysml.lops.Transform)

Example 5 with MMCJ

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

the class AggBinaryOp method constructSparkLopsCPMM.

private void constructSparkLopsCPMM() {
    if (isLeftTransposeRewriteApplicable(false, false)) {
        setLops(constructSparkLopsCPMMWithLeftTransposeRewrite());
    } else {
        SparkAggType aggtype = getSparkMMAggregationType(true);
        Lop cpmm = new MMCJ(getInput().get(0).constructLops(), getInput().get(1).constructLops(), getDataType(), getValueType(), aggtype, ExecType.SPARK);
        setOutputDimensions(cpmm);
        setLineNumbers(cpmm);
        setLops(cpmm);
    }
}
Also used : MMCJ(org.apache.sysml.lops.MMCJ) Lop(org.apache.sysml.lops.Lop)

Aggregations

MMCJ (org.apache.sysml.lops.MMCJ)8 MultiThreadedHop (org.apache.sysml.hops.Hop.MultiThreadedHop)6 Lop (org.apache.sysml.lops.Lop)6 Aggregate (org.apache.sysml.lops.Aggregate)4 Group (org.apache.sysml.lops.Group)4 MMCJType (org.apache.sysml.lops.MMCJ.MMCJType)4 Transform (org.apache.sysml.lops.Transform)4