Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ CheckOptions:
value: lower_case
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 1
# Functions with scores beyond 15 are typically flagged as potentially problematic (empirically)
- key: readability-function-cognitive-complexity.Threshold
value: 25 # default: 25
value: 15 # default: 25
Comment thread
aobolensk marked this conversation as resolved.
- key: misc-include-cleaner.IgnoreHeaders
value: '(opencv2/.*|__chrono/.*)'
23 changes: 10 additions & 13 deletions tasks/mpi/example/src/ops_mpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,22 @@ bool nesterov_a_test_task_mpi::TestTaskMPI::ValidationImpl() {
bool nesterov_a_test_task_mpi::TestTaskMPI::RunImpl() {
int rank = -1;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (rank == 0) {
// Multiply matrices

auto multiply = [this](bool row_major) {
for (int i = 0; i < rc_size_; ++i) {
for (int j = 0; j < rc_size_; ++j) {
int sum = 0;
for (int k = 0; k < rc_size_; ++k) {
output_[(i * rc_size_) + j] += input_[(i * rc_size_) + k] * input_[(k * rc_size_) + j];
}
}
}
} else {
// Multiply matrices
for (int j = 0; j < rc_size_; ++j) {
for (int k = 0; k < rc_size_; ++k) {
for (int i = 0; i < rc_size_; ++i) {
output_[(i * rc_size_) + j] += input_[(i * rc_size_) + k] * input_[(k * rc_size_) + j];
int a = input_[(row_major ? i : k) * rc_size_ + (row_major ? k : i)];
int b = input_[(row_major ? k : j) * rc_size_ + (row_major ? j : k)];
sum += a * b;
}
output_[(i * rc_size_) + j] += sum;
}
}
}
};

multiply(rank == 0);
MPI_Barrier(MPI_COMM_WORLD);
return true;
}
Expand Down
Loading