Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Checks: >
-misc-const-correctness,
-misc-non-private-member-variables-in-classes,
-misc-use-internal-linkage,
-modernize-use-trailing-return-type,
-portability-avoid-pragma-once,
-readability-inconsistent-ifelse-braces,
-readability-magic-numbers
Expand Down Expand Up @@ -100,6 +99,10 @@ CheckOptions:
value: 1
- key: modernize-type-traits.IgnoreMacros
value: 1
- key: modernize-use-trailing-return-type.TransformFunctions
value: false
- key: modernize-use-trailing-return-type.TransformLambdas
value: all_except_auto
Comment thread
aobolensk marked this conversation as resolved.
- key: cppcoreguidelines-avoid-goto.IgnoreMacros
value: 1
- key: readability-simplify-boolean-expr.ChainedConditionalReturn
Expand Down
2 changes: 1 addition & 1 deletion modules/util/include/func_test_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
[this](const auto &test_param) { RunTestCase(test_param); });
}

void ExecuteTest(FuncTestParam<InType, OutType, TestType> test_param) {
void ExecuteTest(const FuncTestParam<InType, OutType, TestType> &test_param) {
const auto &descriptor = GetTaskDescriptor(test_param);

ValidateTaskDescriptor(descriptor);
Expand Down
8 changes: 4 additions & 4 deletions modules/util/include/perf_test_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,18 @@ void RunTaskForValidation(const ppc::task::TaskPtr<InType, OutType> &task) {

inline std::function<double()> MakeTechnologyTimer(ppc::task::TypeOfTask task_type) {
if (task_type == ppc::task::TypeOfTask::kMPI || task_type == ppc::task::TypeOfTask::kALL) {
return [] { return GetTimeMPI(); };
return [] -> double { return GetTimeMPI(); };
}
if (task_type == ppc::task::TypeOfTask::kOMP) {
return [] { return omp_get_wtime(); };
return [] -> double { return omp_get_wtime(); };
}
if (task_type == ppc::task::TypeOfTask::kTBB) {
const auto t0 = tbb::tick_count::now();
return [t0] { return (tbb::tick_count::now() - t0).seconds(); };
return [t0] -> double { return (tbb::tick_count::now() - t0).seconds(); };
}
if (task_type == ppc::task::TypeOfTask::kSEQ || task_type == ppc::task::TypeOfTask::kSTL) {
const auto t0 = std::chrono::high_resolution_clock::now();
return [t0] {
return [t0] -> double {
const auto now = std::chrono::high_resolution_clock::now();
const auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(now - t0).count();
return static_cast<double>(ns) * 1e-9;
Expand Down
6 changes: 4 additions & 2 deletions modules/util/include/task_descriptor_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ inline ppc::task::TaskDescriptor MakeTaskDescriptor(std::string_view task_namesp
const auto task_name = task_type == ppc::task::TypeOfTask::kUnknown
? std::string(task_type_name)
: std::string(task_type_name) + "_" + std::string(ppc::task::StatusOfTaskToString(status));
return {task_type, status, ppc::task::TaskCategoryFromSettingsPath(settings_task_path),
std::string(task_namespace) + "_" + task_name};
return {.type = task_type,
.status = status,
.category = ppc::task::TaskCategoryFromSettingsPath(settings_task_path),
.display_name = std::string(task_namespace) + "_" + task_name};
}

template <typename TestParam>
Expand Down
2 changes: 1 addition & 1 deletion modules/util/include/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ namespace test {

[[nodiscard]] inline std::string SanitizeToken(std::string_view token_sv) {
std::string token{token_sv};
auto is_allowed = [](char c) {
auto is_allowed = [](char c) -> bool {
return std::isalnum(static_cast<unsigned char>(c)) || c == '_' || c == '-' || c == '.';
};
std::ranges::replace(token, ' ', '_');
Expand Down
8 changes: 5 additions & 3 deletions modules/util/tests/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ using FuncTestUtilParam = ppc::util::FuncTestParam<int, int, int>;

FuncTestUtilParam MakeFuncTestUtilParam(const std::string &test_name, ppc::task::TypeOfTask task_type,
ppc::task::StatusOfTask task_status, int value) {
return FuncTestUtilParam{[](int) -> ppc::task::TaskPtr<int, int> {
return {};
}, test_name, value, ppc::task::TaskDescriptor{task_type, task_status, ppc::task::TaskCategory::kThreads, test_name}};
return FuncTestUtilParam{[](int) -> ppc::task::TaskPtr<int, int> { return {}; }, test_name, value,
ppc::task::TaskDescriptor{.type = task_type,
.status = task_status,
.category = ppc::task::TaskCategory::kThreads,
.display_name = test_name}};
}

void ExpectSingleNonFatalFailureContains(const ::testing::TestPartResultArray &failures, std::string_view message) {
Expand Down
4 changes: 2 additions & 2 deletions tasks/example/threads/all/src/ops_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bool NesterovATestTaskALL::RunImpl() {
std::vector<std::thread> threads(num_threads);
std::atomic<int> counter(0);
for (std::thread &thread : threads) {
thread = std::thread([&counter]() { counter++; });
thread = std::thread([&counter]() -> void { counter++; });
thread.join();
}
GetOutput() /= counter;
Expand All @@ -70,7 +70,7 @@ bool NesterovATestTaskALL::RunImpl() {
{
GetOutput() *= num_threads;
std::atomic<int> counter(0);
tbb::parallel_for(0, ppc::util::GetNumThreads(), [&](int /*i*/) { counter++; });
tbb::parallel_for(0, ppc::util::GetNumThreads(), [&](int /*i*/) -> void { counter++; });
GetOutput() /= counter;
}
MPI_Barrier(MPI_COMM_WORLD);
Expand Down
2 changes: 1 addition & 1 deletion tasks/example/threads/stl/src/ops_stl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bool NesterovATestTaskSTL::RunImpl() {

std::atomic<int> counter(0);
for (std::thread &thread : threads) {
thread = std::thread([&counter]() { counter++; });
thread = std::thread([&counter]() -> void { counter++; });
thread.join();
}

Expand Down
2 changes: 1 addition & 1 deletion tasks/example/threads/tbb/src/ops_tbb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bool NesterovATestTaskTBB::RunImpl() {
GetOutput() *= num_threads;

std::atomic<int> counter(0);
tbb::parallel_for(0, ppc::util::GetNumThreads(), [&](int /*i*/) { counter++; });
tbb::parallel_for(0, ppc::util::GetNumThreads(), [&](int /*i*/) -> void { counter++; });

GetOutput() /= counter;
return GetOutput() > 0;
Expand Down
Loading