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);
}
}
Aggregations