Skip to content

Commit

Permalink
Change handling of collapse(2) OpenMP loops to support MSVC again.
Browse files Browse the repository at this point in the history
  • Loading branch information
breyerml committed Feb 16, 2025
1 parent 3519e06 commit 411f4cd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/plssvm/matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -899,9 +899,12 @@ matrix<T, layout> &operator+=(matrix<T, layout> &lhs, const matrix<T, layout> &r
PLSSVM_ASSERT(lhs.shape() == rhs.shape(), "Error: shapes missmatch! ({} != {})", lhs.shape(), rhs.shape());
using size_type = typename matrix<T, layout>::size_type;

#pragma omp parallel for collapse(2) default(none) shared(lhs, rhs)
for (size_type row = 0; row < lhs.num_rows(); ++row) {
for (size_type col = 0; col < lhs.num_cols(); ++col) {
const size_type num_rows = lhs.num_rows();
const size_type num_cols = lhs.num_cols();

#pragma omp parallel for collapse(2) default(none) shared(lhs, rhs) firstprivate(num_rows, num_cols)
for (size_type row = 0; row < num_rows; ++row) {
for (size_type col = 0; col < num_cols; ++col) {
lhs(row, col) += rhs(row, col);
}
}
Expand Down

0 comments on commit 411f4cd

Please sign in to comment.