Skip to content

Commit 5d9cac1

Browse files
authored
Rename GetPPCNumThreads function (#435)
1 parent 28ba938 commit 5d9cac1

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

modules/core/util/func_tests/util_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
TEST(util_tests, check_unset_env) {
1010
#ifndef _WIN32
11-
int save_var = ppc::util::GetPPCNumThreads();
11+
int save_var = ppc::util::GetNumThreads();
1212

1313
unsetenv("PPC_NUM_THREADS"); // NOLINT(concurrency-mt-unsafe)
1414

15-
EXPECT_EQ(ppc::util::GetPPCNumThreads(), 1);
15+
EXPECT_EQ(ppc::util::GetNumThreads(), 1);
1616

1717
setenv("PPC_NUM_THREADS", std::to_string(save_var).c_str(), 1); // NOLINT(concurrency-mt-unsafe)
1818
#else
@@ -22,12 +22,12 @@ TEST(util_tests, check_unset_env) {
2222

2323
TEST(util_tests, check_set_env) {
2424
#ifndef _WIN32
25-
int save_var = ppc::util::GetPPCNumThreads();
25+
int save_var = ppc::util::GetNumThreads();
2626

2727
const int num_threads = static_cast<int>(std::thread::hardware_concurrency());
2828
setenv("PPC_NUM_THREADS", std::to_string(num_threads).c_str(), 1); // NOLINT(concurrency-mt-unsafe)
2929

30-
EXPECT_EQ(ppc::util::GetPPCNumThreads(), num_threads);
30+
EXPECT_EQ(ppc::util::GetNumThreads(), num_threads);
3131

3232
setenv("PPC_NUM_THREADS", std::to_string(save_var).c_str(), 1); // NOLINT(concurrency-mt-unsafe)
3333
#else

modules/core/util/include/util.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
namespace ppc::util {
1414

1515
std::string GetAbsolutePath(const std::string &relative_path);
16-
int GetPPCNumThreads();
16+
int GetNumThreads();
1717

1818
} // namespace ppc::util

modules/core/util/src/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ std::string ppc::util::GetAbsolutePath(const std::string &relative_path) {
1616
return path.string();
1717
}
1818

19-
int ppc::util::GetPPCNumThreads() {
19+
int ppc::util::GetNumThreads() {
2020
#ifdef _WIN32
2121
size_t len;
2222
char omp_env[100];

tasks/all/example/src/ops_all.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void nesterov_a_test_task_all::MatMul(const std::vector<int> &in_vec, int rc_siz
2323
}
2424

2525
void nesterov_a_test_task_all::MatMulTBB(const std::vector<int> &in_vec, int rc_size, std::vector<int> &out_vec) {
26-
tbb::parallel_for(0, ppc::util::GetPPCNumThreads(), [&](int i) { MatMul(in_vec, rc_size - i, out_vec); });
26+
tbb::parallel_for(0, ppc::util::GetNumThreads(), [&](int i) { MatMul(in_vec, rc_size - i, out_vec); });
2727
MatMul(in_vec, rc_size, out_vec);
2828
}
2929

@@ -52,7 +52,7 @@ bool nesterov_a_test_task_all::TestTaskALL::RunImpl() {
5252
MatMulTBB(input_, rc_size_, output_);
5353
}
5454

55-
const int num_threads = ppc::util::GetPPCNumThreads();
55+
const int num_threads = ppc::util::GetNumThreads();
5656
std::vector<std::thread> threads(num_threads);
5757
for (int i = 0; i < num_threads; i++) {
5858
threads[i] = std::thread(MatMul, std::cref(input_), rc_size_, std::ref(output_));

tasks/all/runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ int main(int argc, char** argv) {
7474
MPI_Init(&argc, &argv);
7575

7676
// Limit the number of threads in TBB
77-
tbb::global_control control(tbb::global_control::max_allowed_parallelism, ppc::util::GetPPCNumThreads());
77+
tbb::global_control control(tbb::global_control::max_allowed_parallelism, ppc::util::GetNumThreads());
7878

7979
::testing::InitGoogleTest(&argc, argv);
8080

tasks/stl/example/src/ops_stl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ bool nesterov_a_test_task_stl::TestTaskSTL::PreProcessingImpl() {
3333
}
3434

3535
bool nesterov_a_test_task_stl::TestTaskSTL::RunImpl() {
36-
const int num_threads = ppc::util::GetPPCNumThreads();
36+
const int num_threads = ppc::util::GetNumThreads();
3737
std::vector<std::thread> threads(num_threads);
3838
for (int i = 0; i < num_threads; i++) {
3939
threads[i] = std::thread(MatMul, std::cref(input_), rc_size_, std::ref(output_));

tasks/tbb/example/src/ops_tbb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ bool nesterov_a_test_task_tbb::TestTaskTBB::PreProcessingImpl() {
3434
}
3535

3636
bool nesterov_a_test_task_tbb::TestTaskTBB::RunImpl() {
37-
tbb::parallel_for(0, ppc::util::GetPPCNumThreads(), [&](int i) { MatMul(input_, rc_size_ - i, output_); });
37+
tbb::parallel_for(0, ppc::util::GetNumThreads(), [&](int i) { MatMul(input_, rc_size_ - i, output_); });
3838
MatMul(input_, rc_size_, output_);
3939
return true;
4040
}

tasks/tbb/runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
int main(int argc, char** argv) {
88
// Limit the number of threads in TBB
9-
tbb::global_control control(tbb::global_control::max_allowed_parallelism, ppc::util::GetPPCNumThreads());
9+
tbb::global_control control(tbb::global_control::max_allowed_parallelism, ppc::util::GetNumThreads());
1010

1111
::testing::InitGoogleTest(&argc, argv);
1212
return RUN_ALL_TESTS();

0 commit comments

Comments
 (0)