Commit 4fe555b7 by FritzFlorian

Add 'bare structure' of parallel_for task.

These currently do nothing but being boilerplate required to implement a new top level task.
parent a7a3dc9b
Pipeline #1156 passed with stages
in 3 minutes 35 seconds
...@@ -32,7 +32,9 @@ add_library(pls STATIC ...@@ -32,7 +32,9 @@ add_library(pls STATIC
include/pls/internal/scheduling/run_on_n_threads_task.h src/internal/scheduling/run_on_n_threads_task.cpp include/pls/internal/scheduling/run_on_n_threads_task.h src/internal/scheduling/run_on_n_threads_task.cpp
include/pls/internal/scheduling/fork_join_task.h src/internal/scheduling/fork_join_task.cpp include/pls/internal/scheduling/fork_join_task.h src/internal/scheduling/fork_join_task.cpp
include/pls/internal/scheduling/scheduler_memory.h src/internal/scheduling/scheduler_memory.cpp include/pls/internal/scheduling/scheduler_memory.h src/internal/scheduling/scheduler_memory.cpp
) include/pls/internal/scheduling/parallel_iterator_task.h
include/pls/internal/scheduling/parallel_iterator_task_impl.h
src/internal/scheduling/parallel_iterator_task.cpp)
# Add everything in `./include` to be in the include path of this project # Add everything in `./include` to be in the include path of this project
target_include_directories(pls target_include_directories(pls
......
...@@ -73,6 +73,7 @@ namespace pls { ...@@ -73,6 +73,7 @@ namespace pls {
fork_join_sub_task* get_local_sub_task(); fork_join_sub_task* get_local_sub_task();
fork_join_sub_task* get_stolen_sub_task(); fork_join_sub_task* get_stolen_sub_task();
protected:
bool internal_stealing(abstract_task* other_task) override; bool internal_stealing(abstract_task* other_task) override;
bool split_task(base::spin_lock* /*lock*/) override; bool split_task(base::spin_lock* /*lock*/) override;
......
#ifndef PLS_PARALLEL_ITERATOR_TASK_H
#define PLS_PARALLEL_ITERATOR_TASK_H
#include "abstract_task.h"
namespace pls {
namespace internal {
namespace scheduling {
template<typename RandomIt, typename Function>
class parallel_iterator_task: public abstract_task {
RandomIt first_, last_;
Function function_;
protected:
bool internal_stealing(abstract_task* other_task) override;
bool split_task(base::spin_lock* /*lock*/) override;
public:
explicit parallel_iterator_task(RandomIt first, RandomIt last, Function function, const abstract_task::id& id);
void execute() override;
};
}
}
}
#include "parallel_iterator_task_impl.h"
#endif //PLS_PARALLEL_ITERATOR_TASK_H
#ifndef PLS_PARALLEL_ITERATOR_TASK_IMPL_H
#define PLS_PARALLEL_ITERATOR_TASK_IMPL_H
namespace pls {
namespace internal {
namespace scheduling {
template<typename RandomIt, typename Function>
parallel_iterator_task<RandomIt, Function>::parallel_iterator_task
(RandomIt first, RandomIt last, Function function, const abstract_task::id& id):
abstract_task(0, id),
first_{first},
last_{last},
function_{function} {}
template<typename RandomIt, typename Function>
void parallel_iterator_task<RandomIt, Function>::execute() {
}
template<typename RandomIt, typename Function>
bool parallel_iterator_task<RandomIt, Function>::split_task(base::spin_lock* /*lock*/) {
return false;
}
template<typename RandomIt, typename Function>
bool parallel_iterator_task<RandomIt, Function>::internal_stealing(abstract_task* other_task) {
return false;
}
}
}
}
#endif //PLS_PARALLEL_ITERATOR_TASK_IMPL_H
#include "pls/internal/scheduling/parallel_iterator_task.h"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment