Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 6 additions & 8 deletions modules/util/include/func_test_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
#include "task/include/task.hpp"
#include "util/include/util.hpp"

using namespace ppc::task;

namespace ppc::util {

template <typename InType, typename OutType, typename TestType = void>
using FuncTestParam = std::tuple<std::function<TaskPtr<InType, OutType>(InType)>, std::string, TestType>;
using FuncTestParam = std::tuple<std::function<ppc::task::TaskPtr<InType, OutType>(InType)>, std::string, TestType>;

template <typename InType, typename OutType, typename TestType = void>
using GTestFuncParam = ::testing::TestParamInfo<FuncTestParam<InType, OutType, TestType>>;
Expand Down Expand Up @@ -98,7 +96,7 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
}

private:
TaskPtr<InType, OutType> task_;
ppc::task::TaskPtr<InType, OutType> task_;
};

template <typename Tuple, std::size_t... Is>
Expand All @@ -115,10 +113,10 @@ auto ExpandToValues(const Tuple& t) {
template <typename Task, typename InType, typename SizesContainer, std::size_t... Is>
auto GenTaskTuplesImpl(const SizesContainer& sizes, const std::string& settings_path,
std::index_sequence<Is...> /*unused*/) {
return std::make_tuple(std::make_tuple(
TaskGetter<Task, InType>,
std::string(GetNamespace<Task>()) + "_" + GetStringTaskType(Task::GetStaticTypeOfTask(), settings_path),
sizes[Is])...);
return std::make_tuple(std::make_tuple(ppc::task::TaskGetter<Task, InType>,
std::string(GetNamespace<Task>()) + "_" +
ppc::task::GetStringTaskType(Task::GetStaticTypeOfTask(), settings_path),
sizes[Is])...);
}

template <typename Task, typename InType, typename SizesContainer>
Expand Down
31 changes: 15 additions & 16 deletions modules/util/include/perf_test_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@
#include "task/include/task.hpp"
#include "util/include/util.hpp"

using namespace ppc::task;
using namespace ppc::performance;

namespace ppc::util {

double GetTimeMPI();
int GetMPIRank();

template <typename InType, typename OutType>
using PerfTestParam =
std::tuple<std::function<TaskPtr<InType, OutType>(InType)>, std::string, PerfResults::TypeOfRunning>;
using PerfTestParam = std::tuple<std::function<ppc::task::TaskPtr<InType, OutType>(InType)>, std::string,
ppc::performance::PerfResults::TypeOfRunning>;

template <typename InType, typename OutType>
/// @brief Base class for performance testing of parallel tasks.
Expand All @@ -38,7 +35,7 @@ class BaseRunPerfTests : public ::testing::TestWithParam<PerfTestParam<InType, O
public:
/// @brief Generates a readable name for the performance test case.
static std::string CustomPerfTestName(const ::testing::TestParamInfo<PerfTestParam<InType, OutType>>& info) {
return GetStringParamName(std::get<GTestParamIndex::kTestParams>(info.param)) + "_" +
return ppc::performance::GetStringParamName(std::get<GTestParamIndex::kTestParams>(info.param)) + "_" +
std::get<GTestParamIndex::kNameTest>(info.param);
}

Expand All @@ -47,7 +44,7 @@ class BaseRunPerfTests : public ::testing::TestWithParam<PerfTestParam<InType, O
/// @brief Supplies input data for performance testing.
virtual InType GetTestInputData() = 0;

virtual void SetPerfAttributes(PerfAttr& perf_attrs) {
virtual void SetPerfAttributes(ppc::performance::PerfAttr& perf_attrs) {
if (task_->GetDynamicTypeOfTask() == ppc::task::TypeOfTask::kMPI ||
task_->GetDynamicTypeOfTask() == ppc::task::TypeOfTask::kALL) {
const double t0 = GetTimeMPI();
Expand Down Expand Up @@ -80,13 +77,13 @@ class BaseRunPerfTests : public ::testing::TestWithParam<PerfTestParam<InType, O
}

task_ = task_getter(GetTestInputData());
Perf perf(task_);
PerfAttr perf_attr;
ppc::performance::Perf perf(task_);
ppc::performance::PerfAttr perf_attr;
SetPerfAttributes(perf_attr);

if (mode == PerfResults::TypeOfRunning::kPipeline) {
if (mode == ppc::performance::PerfResults::TypeOfRunning::kPipeline) {
perf.PipelineRun(perf_attr);
} else if (mode == PerfResults::TypeOfRunning::kTaskRun) {
} else if (mode == ppc::performance::PerfResults::TypeOfRunning::kTaskRun) {
perf.TaskRun(perf_attr);
} else {
std::stringstream err_msg;
Expand All @@ -103,16 +100,18 @@ class BaseRunPerfTests : public ::testing::TestWithParam<PerfTestParam<InType, O
}

private:
TaskPtr<InType, OutType> task_;
ppc::task::TaskPtr<InType, OutType> task_;
};

template <typename TaskType, typename InputType>
auto MakePerfTaskTuples(const std::string& settings_path) {
const auto name =
std::string(GetNamespace<TaskType>()) + "_" + GetStringTaskType(TaskType::GetStaticTypeOfTask(), settings_path);
const auto name = std::string(GetNamespace<TaskType>()) + "_" +
ppc::task::GetStringTaskType(TaskType::GetStaticTypeOfTask(), settings_path);

return std::make_tuple(std::make_tuple(TaskGetter<TaskType, InputType>, name, PerfResults::TypeOfRunning::kPipeline),
std::make_tuple(TaskGetter<TaskType, InputType>, name, PerfResults::TypeOfRunning::kTaskRun));
return std::make_tuple(std::make_tuple(ppc::task::TaskGetter<TaskType, InputType>, name,
ppc::performance::PerfResults::TypeOfRunning::kPipeline),
std::make_tuple(ppc::task::TaskGetter<TaskType, InputType>, name,
ppc::performance::PerfResults::TypeOfRunning::kTaskRun));
}

template <typename Tuple, std::size_t... I>
Expand Down
Loading