#ifndef ALSK_ALSK_EXECUTOR_IMPL_SEQUENTIAL_H #define ALSK_ALSK_EXECUTOR_IMPL_SEQUENTIAL_H #include #include #include #include "../executorbase.h" #include "../executorstate.h" #include "../../skeleton/traits.h" namespace alsk { namespace exec { template struct Sequential: ExecutorBase { using Tag = alsk::tag::Sequential; public: template std::size_t contextIdCount(Impl&, std::size_t) { return 1; } template std::size_t contextId(Impl&, std::size_t) { return 0; } template void executeParallel(Impl& impl, BTask& task, Parameters const& parameters, std::size_t n) { Info info; for(std::size_t i = 0; i < n; ++i) Task::execute(impl, task, i, info, parameters, std::tuple<>{}); } template Value executeParallelAccumulate(Impl& impl, BTask& task, BSelect& select, Parameters const& parameters, std::size_t n) { Info info; Value best{}; if(n) best = Task::execute(impl, task, 0, info, parameters, std::tuple<>{}); for(std::size_t i = 1; i < n; ++i) { Value current = Task::execute(impl, task, i, info, parameters, std::tuple<>{}); best = Select::execute(impl, select, i, info, parameters, std::tuple<>{}, std::move(current), std::move(best)); } return best; } }; template struct ExecutorState> {}; } } #endif