Search in sources :

Example 1 with AppendRInstruction

use of org.apache.sysml.runtime.instructions.mr.AppendRInstruction in project incubator-systemml by apache.

the class GMRReducer method processReducerInstructionsInGMR.

protected void processReducerInstructionsInGMR(MatrixIndexes indexes) throws IOException {
    if (mixed_instructions == null)
        return;
    try {
        for (MRInstruction ins : mixed_instructions) {
            if (ins instanceof TernaryInstruction) {
                MatrixCharacteristics dim = dimensions.get(((TernaryInstruction) ins).input1);
                ((TernaryInstruction) ins).processInstruction(valueClass, cachedValues, zeroInput, _buff.getMapBuffer(), _buff.getBlockBuffer(), dim.getRowsPerBlock(), dim.getColsPerBlock());
                if (_buff.getBufferSize() > GMRCtableBuffer.MAX_BUFFER_SIZE)
                    //prevent oom for large/many ctables
                    _buff.flushBuffer(cachedReporter);
            } else if (ins instanceof AppendRInstruction) {
                MatrixCharacteristics dims1 = dimensions.get(((AppendRInstruction) ins).input1);
                MatrixCharacteristics dims2 = dimensions.get(((AppendRInstruction) ins).input2);
                long nbi1 = (long) Math.ceil((double) dims1.getRows() / dims1.getRowsPerBlock());
                long nbi2 = (long) Math.ceil((double) dims2.getRows() / dims2.getRowsPerBlock());
                long nbj1 = (long) Math.ceil((double) dims1.getCols() / dims1.getColsPerBlock());
                long nbj2 = (long) Math.ceil((double) dims2.getCols() / dims2.getColsPerBlock());
                // Execute the instruction only if current indexes fall within the range of input dimensions
                if ((nbi1 < indexes.getRowIndex() && nbi2 < indexes.getRowIndex()) || (nbj1 < indexes.getColumnIndex() && nbj2 < indexes.getColumnIndex()))
                    continue;
                else
                    processOneInstruction(ins, valueClass, cachedValues, tempValue, zeroInput);
            } else
                processOneInstruction(ins, valueClass, cachedValues, tempValue, zeroInput);
        }
    } catch (Exception e) {
        throw new IOException(e);
    }
}
Also used : AppendRInstruction(org.apache.sysml.runtime.instructions.mr.AppendRInstruction) TernaryInstruction(org.apache.sysml.runtime.instructions.mr.TernaryInstruction) MRInstruction(org.apache.sysml.runtime.instructions.mr.MRInstruction) IOException(java.io.IOException) IOException(java.io.IOException) MatrixCharacteristics(org.apache.sysml.runtime.matrix.MatrixCharacteristics)

Aggregations

IOException (java.io.IOException)1 AppendRInstruction (org.apache.sysml.runtime.instructions.mr.AppendRInstruction)1 MRInstruction (org.apache.sysml.runtime.instructions.mr.MRInstruction)1 TernaryInstruction (org.apache.sysml.runtime.instructions.mr.TernaryInstruction)1 MatrixCharacteristics (org.apache.sysml.runtime.matrix.MatrixCharacteristics)1