Skip to content

Commit

Permalink
Add parallel for
Browse files Browse the repository at this point in the history
  • Loading branch information
apertovs committed Apr 26, 2021
1 parent bfcd18e commit 2f7d0c5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions inference-engine/src/mkldnn_plugin/nodes/roll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ class RollImpl: public ExtLayerBase {
const size_t rightBlockSize = blockSize - leftBlockSize;
const size_t elementSize = sizeof(DataType);

size_t start = 0;
while (start < totalElements) {
size_t nIterations = totalElements / blockSize;
parallel_for(nIterations, [&](size_t iter) {
size_t start = iter * blockSize;
size_t leftBlockStartOffset = start;
size_t rightBlockStartOffset = start + leftBlockSize;

Expand All @@ -210,9 +211,7 @@ class RollImpl: public ExtLayerBase {
cpu_memcpy(output + rightBlockStartOffset,
input + (start + leftBlockSize),
rightBlockSize * elementSize);

start += blockSize;
}
});
}

const size_t DATA_INDEX = 0ul;
Expand Down

0 comments on commit 2f7d0c5

Please sign in to comment.