Skip to content

Commit a8a7c4e

Browse files
committed
fix perf
1 parent 442ac45 commit a8a7c4e

File tree

6 files changed

+18
-19
lines changed

6 files changed

+18
-19
lines changed

scripts/generate_perf_results.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
mkdir build/perf_stat_dir
2-
source scripts/run_perf_collector.sh &> build/perf_stat_dir/perf_log.txt
2+
source scripts/run_perf_collector.sh | tee build/perf_stat_dir/perf_log.txt
33
python3 scripts/create_perf_table.py --input build/perf_stat_dir/perf_log.txt --output build/perf_stat_dir

tasks/all/example/perf_tests/perf_all.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "core/perf/include/perf.hpp"
77

88
TEST(nesterov_a_test_task_all, test_pipeline_run) {
9-
constexpr int kCount = 900;
9+
constexpr int kCount = 400;
1010

1111
// Create data
1212
std::vector<int> in(kCount * kCount, 0);
@@ -51,7 +51,7 @@ TEST(nesterov_a_test_task_all, test_pipeline_run) {
5151
}
5252

5353
TEST(nesterov_a_test_task_all, test_task_run) {
54-
constexpr int kCount = 900;
54+
constexpr int kCount = 400;
5555

5656
// Create data
5757
std::vector<int> in(kCount * kCount, 0);

tasks/all/example/src/ops_all.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,7 @@ bool nesterov_a_test_task_all::TestTaskALL::RunImpl() {
4343
#pragma omp critical
4444
{ MatMul(input_, rc_size_, output_); }
4545
}
46-
} else if (world_.rank() == 1) {
47-
const int num_threads = ppc::util::GetPPCNumThreads();
48-
std::vector<std::thread> threads(num_threads);
49-
for (int i = 0; i < num_threads; i++) {
50-
threads[i] = std::thread(MatMul, std::cref(input_), rc_size_, std::ref(output_));
51-
threads[i].join();
52-
}
53-
} else if (world_.rank() == 2) {
46+
} else {
5447
oneapi::tbb::task_arena arena(1);
5548
arena.execute([&] {
5649
tbb::task_group tg;
@@ -59,9 +52,15 @@ bool nesterov_a_test_task_all::TestTaskALL::RunImpl() {
5952
}
6053
tg.wait();
6154
});
62-
} else {
63-
MatMul(input_, rc_size_, output_);
6455
}
56+
57+
const int num_threads = ppc::util::GetPPCNumThreads();
58+
std::vector<std::thread> threads(num_threads);
59+
for (int i = 0; i < num_threads; i++) {
60+
threads[i] = std::thread(MatMul, std::cref(input_), rc_size_, std::ref(output_));
61+
threads[i].join();
62+
}
63+
6564
world_.barrier();
6665
return true;
6766
}

tasks/omp/example/perf_tests/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "omp/example/include/ops_omp.hpp"
77

88
TEST(nesterov_a_test_task_omp, test_pipeline_run) {
9-
constexpr int kCount = 500;
9+
constexpr int kCount = 300;
1010

1111
// Create data
1212
std::vector<int> in(kCount * kCount, 0);
@@ -47,7 +47,7 @@ TEST(nesterov_a_test_task_omp, test_pipeline_run) {
4747
}
4848

4949
TEST(nesterov_a_test_task_omp, test_task_run) {
50-
constexpr int kCount = 500;
50+
constexpr int kCount = 300;
5151

5252
// Create data
5353
std::vector<int> in(kCount * kCount, 0);

tasks/stl/example/perf_tests/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "stl/example/include/ops_stl.hpp"
77

88
TEST(nesterov_a_test_task_stl, test_pipeline_run) {
9-
constexpr int kCount = 1000;
9+
constexpr int kCount = 700;
1010

1111
// Create data
1212
std::vector<int> in(kCount * kCount, 0);
@@ -47,7 +47,7 @@ TEST(nesterov_a_test_task_stl, test_pipeline_run) {
4747
}
4848

4949
TEST(nesterov_a_test_task_stl, test_task_run) {
50-
constexpr int kCount = 1000;
50+
constexpr int kCount = 700;
5151

5252
// Create data
5353
std::vector<int> in(kCount * kCount, 0);

tasks/tbb/example/perf_tests/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "tbb/example/include/ops_tbb.hpp"
77

88
TEST(nesterov_a_test_task_tbb, test_pipeline_run) {
9-
constexpr int kCount = 500;
9+
constexpr int kCount = 700;
1010

1111
// Create data
1212
std::vector<int> in(kCount * kCount, 0);
@@ -47,7 +47,7 @@ TEST(nesterov_a_test_task_tbb, test_pipeline_run) {
4747
}
4848

4949
TEST(nesterov_a_test_task_tbb, test_task_run) {
50-
constexpr int kCount = 500;
50+
constexpr int kCount = 700;
5151

5252
// Create data
5353
std::vector<int> in(kCount * kCount, 0);

0 commit comments

Comments
 (0)