Skip to content

Commit

Permalink
fix perf
Browse files Browse the repository at this point in the history
  • Loading branch information
allnes committed Jan 19, 2025
1 parent 442ac45 commit 7854864
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion scripts/generate_perf_results.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mkdir build/perf_stat_dir
source scripts/run_perf_collector.sh &> build/perf_stat_dir/perf_log.txt
source scripts/run_perf_collector.sh | tee build/perf_stat_dir/perf_log.txt
python3 scripts/create_perf_table.py --input build/perf_stat_dir/perf_log.txt --output build/perf_stat_dir
4 changes: 2 additions & 2 deletions tasks/all/example/perf_tests/perf_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "core/perf/include/perf.hpp"

TEST(nesterov_a_test_task_all, test_pipeline_run) {
constexpr int kCount = 900;
constexpr int kCount = 400;

// Create data
std::vector<int> in(kCount * kCount, 0);
Expand Down Expand Up @@ -51,7 +51,7 @@ TEST(nesterov_a_test_task_all, test_pipeline_run) {
}

TEST(nesterov_a_test_task_all, test_task_run) {
constexpr int kCount = 900;
constexpr int kCount = 400;

// Create data
std::vector<int> in(kCount * kCount, 0);
Expand Down
20 changes: 10 additions & 10 deletions tasks/all/example/src/ops_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,7 @@ bool nesterov_a_test_task_all::TestTaskALL::RunImpl() {
#pragma omp critical
{ MatMul(input_, rc_size_, output_); }
}
} else if (world_.rank() == 1) {
const int num_threads = ppc::util::GetPPCNumThreads();
std::vector<std::thread> threads(num_threads);
for (int i = 0; i < num_threads; i++) {
threads[i] = std::thread(MatMul, std::cref(input_), rc_size_, std::ref(output_));
threads[i].join();
}
} else if (world_.rank() == 2) {
} else {
oneapi::tbb::task_arena arena(1);
arena.execute([&] {
tbb::task_group tg;
Expand All @@ -59,9 +52,16 @@ bool nesterov_a_test_task_all::TestTaskALL::RunImpl() {
}
tg.wait();
});
} else {
MatMul(input_, rc_size_, output_);

}

const int num_threads = ppc::util::GetPPCNumThreads();
std::vector<std::thread> threads(num_threads);
for (int i = 0; i < num_threads; i++) {
threads[i] = std::thread(MatMul, std::cref(input_), rc_size_, std::ref(output_));
threads[i].join();
}

world_.barrier();
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions tasks/omp/example/perf_tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "omp/example/include/ops_omp.hpp"

TEST(nesterov_a_test_task_omp, test_pipeline_run) {
constexpr int kCount = 500;
constexpr int kCount = 300;

// Create data
std::vector<int> in(kCount * kCount, 0);
Expand Down Expand Up @@ -47,7 +47,7 @@ TEST(nesterov_a_test_task_omp, test_pipeline_run) {
}

TEST(nesterov_a_test_task_omp, test_task_run) {
constexpr int kCount = 500;
constexpr int kCount = 300;

// Create data
std::vector<int> in(kCount * kCount, 0);
Expand Down
4 changes: 2 additions & 2 deletions tasks/stl/example/perf_tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "stl/example/include/ops_stl.hpp"

TEST(nesterov_a_test_task_stl, test_pipeline_run) {
constexpr int kCount = 1000;
constexpr int kCount = 700;

// Create data
std::vector<int> in(kCount * kCount, 0);
Expand Down Expand Up @@ -47,7 +47,7 @@ TEST(nesterov_a_test_task_stl, test_pipeline_run) {
}

TEST(nesterov_a_test_task_stl, test_task_run) {
constexpr int kCount = 1000;
constexpr int kCount = 700;

// Create data
std::vector<int> in(kCount * kCount, 0);
Expand Down
4 changes: 2 additions & 2 deletions tasks/tbb/example/perf_tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "tbb/example/include/ops_tbb.hpp"

TEST(nesterov_a_test_task_tbb, test_pipeline_run) {
constexpr int kCount = 500;
constexpr int kCount = 700;

// Create data
std::vector<int> in(kCount * kCount, 0);
Expand Down Expand Up @@ -47,7 +47,7 @@ TEST(nesterov_a_test_task_tbb, test_pipeline_run) {
}

TEST(nesterov_a_test_task_tbb, test_task_run) {
constexpr int kCount = 500;
constexpr int kCount = 700;

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

0 comments on commit 7854864

Please sign in to comment.