Peano
Loading...
Searching...
No Matches
Strategy.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5namespace tarch {
6 namespace multicore {
7 namespace orchestration {
8 class Strategy;
9
19
267 } // namespace orchestration
268 } // namespace multicore
269} // namespace tarch
270
271#include <string>
272#include <utility>
273#include <chrono>
274
275
276
289public:
300 enum class ExecutionPolicy {
303 };
304
328 FuseInstruction(int device_, int minTasks_, int maxTasks_):
329 device(device_),
330 minTasks(minTasks_),
331 maxTasks(maxTasks_)
332 {}
333
334 std::string toString() const {
335 return "(#device=" + std::to_string(device) + ",min=" + std::to_string(minTasks)
336 + ",max=" + std::to_string(maxTasks) + ")";
337 }
338 };
339
340 virtual ~Strategy() = default;
341
345 virtual void startBSPSection(int nestedParallelismLevel) = 0;
346
350 virtual void endBSPSection(int nestedParallelismLevel) = 0;
351
373 int taskType,
374 int queueSize,
375 double averageNumberOfReadyTasksPerProcessTaskExecution,
376 double probabilityThatTaskIsCompleted
377 ) = 0;
378
379 static constexpr int EndOfBSPSection = -1;
380
391 virtual FuseInstruction fuse(int taskType) = 0;
392
418 virtual ExecutionPolicy paralleliseForkJoinSection(int nestedParallelismLevel, int numberOfTasks, int taskType) = 0;
419
427};
Interface for any task orchestration.
Definition Strategy.h:288
virtual FuseInstruction fuse(int taskType)=0
How many tasks to fuse and to which device to deploy.
virtual FusionImplementation getFusionImplementation() const =0
Determine how the implementation handles fusable tasks.
virtual void updateFuseStatistics(int taskType, int queueSize, double averageNumberOfReadyTasksPerProcessTaskExecution, double probabilityThatTaskIsCompleted)=0
Update task fusion status.
virtual ExecutionPolicy paralleliseForkJoinSection(int nestedParallelismLevel, int numberOfTasks, int taskType)=0
Determine how to handle/realise parallelisation within fork/join region.
virtual void startBSPSection(int nestedParallelismLevel)=0
Notifies the strategy that we enter a BSP section.
virtual void endBSPSection(int nestedParallelismLevel)=0
Notifies the strategy that we leave a BSP (fork-join) section.
ExecutionPolicy
Provide hint of execution policy.
Definition Strategy.h:300
Strategy * createDefaultStrategy()
Default strategy.
FusionImplementation
Control how the fusion is implemented.
Definition Strategy.h:91
@ ProducerConsumerTaskSequence
Map each fusable task onto a producer-consumer task pair.
@ DisableFusionAndMapOntoNativeTask
This option effectively disables fusion as well and all fusable tasks are eagerly executed.
@ DisableFusionAndProcessImmediately
Disable the fusion and process each fusable task immediately.
@ EagerConsumerTasks
Issue consumer task that fuses upon spawning a task if the queue is big enough.
@ LazyEvaluation
All fusable tasks are parked in a big queue and we fuse lazily as we need the outcome.
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19
FuseInstruction(int device_, int minTasks_, int maxTasks_)
Definition Strategy.h:328