Skip to content

Commit 987a6a5

Browse files
authored
Revert range-based loops change (#164)
1 parent 4ed6881 commit 987a6a5

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

Diff for: .clang-tidy

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Checks: >
2020
-misc-unused-parameters,
2121
-misc-use-anonymous-namespace,
2222
-modernize-avoid-c-arrays,
23+
-modernize-loop-convert,
2324
-modernize-use-nodiscard,
2425
-modernize-use-trailing-return-type,
2526
-readability-function-cognitive-complexity,

Diff for: modules/core/perf/include/perf.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ struct PerfResults {
2727
class Perf {
2828
public:
2929
// Init performance analysis with initialized task and initialized data
30-
explicit Perf(const std::shared_ptr<Task>& task);
30+
explicit Perf(const std::shared_ptr<Task>& task_ptr);
3131
// Set task with initialized task and initialized data for performance
3232
// analysis c
33-
void SetTask(const std::shared_ptr<Task>& task);
33+
void SetTask(const std::shared_ptr<Task>& task_ptr);
3434
// Check performance of full task's pipeline: pre_processing() ->
3535
// validation() -> run() -> post_processing()
3636
void PipelineRun(const std::shared_ptr<PerfAttr>& perf_attr,

Diff for: modules/core/perf/src/perf.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#include <sstream>
88
#include <utility>
99

10-
ppc::core::Perf::Perf(const std::shared_ptr<Task>& task) { SetTask(task); }
10+
ppc::core::Perf::Perf(const std::shared_ptr<Task>& task_ptr) { SetTask(task_ptr); }
1111

12-
void ppc::core::Perf::SetTask(const std::shared_ptr<Task>& task) {
13-
task->get_data()->state_of_testing = TaskData::StateOfTesting::PERF;
14-
this->task = task;
12+
void ppc::core::Perf::SetTask(const std::shared_ptr<Task>& task_ptr) {
13+
task_ptr->get_data()->state_of_testing = TaskData::StateOfTesting::PERF;
14+
this->task = task_ptr;
1515
}
1616

1717
void ppc::core::Perf::PipelineRun(const std::shared_ptr<PerfAttr>& perf_attr,

Diff for: tasks/omp/example/src/ops_omp.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ bool nesterov_a_test_task_omp::TestOMPTaskParallel::run_impl() {
6363
auto temp_res = res;
6464
if (ops == "+") {
6565
#pragma omp parallel for reduction(+ : temp_res)
66-
for (int i : input_) {
67-
temp_res += i;
66+
for (int i = 0; i < static_cast<int>(input_.size()); i++) {
67+
temp_res += input_[i];
6868
}
6969
} else if (ops == "-") {
7070
#pragma omp parallel for reduction(- : temp_res)
71-
for (int i : input_) {
72-
temp_res -= i;
71+
for (int i = 0; i < static_cast<int>(input_.size()); i++) {
72+
temp_res -= input_[i];
7373
}
7474
} else if (ops == "*") {
7575
#pragma omp parallel for reduction(* : temp_res)
76-
for (int i : input_) {
77-
temp_res *= i;
76+
for (int i = 0; i < static_cast<int>(input_.size()); i++) {
77+
temp_res *= input_[i];
7878
}
7979
}
8080
res = temp_res;

0 commit comments

Comments
 (0)