Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimbelan authored Jun 11, 2024
1 parent 7dacd78 commit fe90b10
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions tasks/tbb/belan_vadim_mat_fox_tbb/src/ops_tbb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,17 @@ bool FoxBlockedParallel::pre_processing() {
bool FoxBlockedParallel::run() {
internal_order_test();

tbb::parallel_for(tbb::blocked_range<int>(0, static_cast<int>(A.size()), block_size),
[this](const tbb::blocked_range<int>& range) {
for (int ii = range.begin(); ii < range.end(); ii += block_size) {
for (std::vector<double>::size_type jj = 0; jj < B[0].size(); jj += block_size) {
for (std::vector<double>::size_type k = 0; k < A[0].size(); ++k) {
for (int i = ii; i < std::min(ii + block_size, static_cast<int>(A.size())); ++i) {
for (std::vector<double>::size_type j = jj;
j < std::min(jj + block_size, B[0].size()); ++j) {
C[i][j] += A[i][k] * B[k][j];
}
}
tbb::parallel_for(
tbb::blocked_range2d<std::vector<double>::size_type>(0, A.size(), block_size, 0, B[0].size(), block_size),
[&](const tbb::blocked_range2d<std::vector<double>::size_type>& r) {
for (std::vector<double>::size_type k = 0; k < A[0].size(); ++k) {
for (std::vector<double>::size_type i = r.rows().begin(); i < r.rows().end(); ++i) {
for (std::vector<double>::size_type j = r.cols().begin(); j < r.cols().end(); ++j) {
C[i][j] += A[i][k] * B[k][j];
}
}
}
}
);
});

return true;
}
Expand Down

0 comments on commit fe90b10

Please sign in to comment.