Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,30 @@ public void processInstruction( ExecutionContext ec ) {
DataCharacteristics vdc = vin.getDataCharacteristics();

if(min != vin && mdc.getRows() > 0 && mdc.getCols() > 0 && vdc.getCols() > 0 &&
mdc.getCols() == vdc.getRows() && vdc.getNumColBlocks() == 1) {
OOCStream<IndexedMatrixValue> partials = createWritableStream();
mdc.getCols() == vdc.getRows() && mdc.getBlocksize() == vdc.getBlocksize()) {
OOCStream<IndexedMatrixValue> out = createWritableStream();
partials.setData(min);
ec.getMatrixObject(output).setStreamHandle(out);
OOCInstructionUtils.indexedBroadcastMap(min.getStreamable(), vin.getStreamable(), partials,
left -> Math.toIntExact(left.getIndexes().getColumnIndex() - 1),
() -> new CountingLiveness(Math.toIntExact(vin.getDataCharacteristics().getNumRowBlocks()),
Math.toIntExact(min.getDataCharacteristics().getNumRowBlocks())),
(left, right) -> {
MatrixBlock leftBlock = (MatrixBlock) left.getValue();
MatrixBlock rightBlock = (MatrixBlock) right.getValue();
MatrixBlock partial = leftBlock.aggregateBinaryOperations(leftBlock, rightBlock, new MatrixBlock(),
(AggregateBinaryOperator) _optr);
MatrixIndexes indexes = left.getIndexes();
return new IndexedMatrixValue(new MatrixIndexes(indexes.getRowIndex(), indexes.getColumnIndex()),
partial);
}, getContext());
BinaryOperator plus = InstructionUtils.parseBinaryOperator(Opcodes.PLUS.toString());
OOCInstructionUtils.rowGroupedReduce(partials, out,
(left, right) -> left.binaryOperations(plus, right, new MatrixBlock()), getContext());
if(vin.getDataCharacteristics().getNumColBlocks() == 1) {
OOCStream<IndexedMatrixValue> partials = createWritableStream();
partials.setData(min);
OOCInstructionUtils.indexedBroadcastMap(min.getStreamable(), vin.getStreamable(), partials,
left -> Math.toIntExact(left.getIndexes().getColumnIndex() - 1),
() -> new CountingLiveness(Math.toIntExact(vin.getDataCharacteristics().getNumRowBlocks()),
Math.toIntExact(min.getDataCharacteristics().getNumRowBlocks())),
(left, right) -> {
MatrixBlock leftBlock = (MatrixBlock) left.getValue();
MatrixBlock rightBlock = (MatrixBlock) right.getValue();
MatrixBlock partial = leftBlock.aggregateBinaryOperations(leftBlock, rightBlock,
new MatrixBlock(), (AggregateBinaryOperator) _optr);
return new IndexedMatrixValue(left.getIndexes(), partial);
}, getContext());
OOCInstructionUtils.rowGroupedReduce(partials, out,
(left, right) -> left.binaryOperations(plus, right, new MatrixBlock()), getContext());
}
else
OOCInstructionUtils.matrixMultiply(min.getStreamable(), vin.getStreamable(), out,
(AggregateBinaryOperator) _optr, plus, getContext());
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public static <T> OOCFuture<T> failed(Throwable error) {
return future;
}

public static <T> OOCFuture<List<T>> allOf(List<? extends OOCFuture<? extends T>> futures) {
return allOf(futures, ignored -> {
});
}

public static <T> OOCFuture<List<T>> allOf(List<? extends OOCFuture<? extends T>> futures,
Consumer<? super T> failureCleanup) {
Objects.requireNonNull(futures);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
import org.apache.sysds.runtime.meta.DataCharacteristics;

public enum OOCStoreLayout {
ROW_MAJOR;
ROW_MAJOR, COL_MAJOR;

public int linearize(MatrixIndexes indexes, DataCharacteristics characteristics) {
if(characteristics == null || !characteristics.dimsKnown() || characteristics.getBlocksize() <= 0)
throw new IllegalArgumentException("Materialized store layout requires known dimensions and block size.");
long columns = characteristics.getNumColBlocks();
long index = Math.addExact(Math.multiplyExact(indexes.getRowIndex() - 1, columns),
indexes.getColumnIndex() - 1);
long index = this == ROW_MAJOR ? (indexes.getRowIndex() - 1) * characteristics.getNumColBlocks() +
indexes.getColumnIndex() -
1 : (indexes.getColumnIndex() - 1) * characteristics.getNumRowBlocks() + indexes.getRowIndex() - 1;
return Math.toIntExact(index);
}
}
Loading
Loading