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
284 } // namespace orchestration
285 } // namespace multicore
286} // namespace tarch
287
288#include <string>
289#include <utility>
290#include <chrono>
291
292
293
306public:
317 enum class ExecutionPolicy {
320 };
321
345 FuseInstruction(int device_, int minTasks_, int maxTasks_):
346 device(device_),
347 minTasks(minTasks_),
348 maxTasks(maxTasks_)
349 {}
350
351 std::string toString() const {
352 return "(#device=" + std::to_string(device) + ",min=" + std::to_string(minTasks)
353 + ",max=" + std::to_string(maxTasks) + ")";
354 }
355 };
356
357 virtual ~Strategy() = default;
358
362 virtual void startBSPSection(int nestedParallelismLevel) = 0;
363
367 virtual void endBSPSection(int nestedParallelismLevel) = 0;
368
390 int taskType,
391 int queueSize,
392 double averageNumberOfReadyTasksPerProcessTaskExecution,
393 double probabilityThatTaskIsCompleted
394 ) = 0;
395
396 static constexpr int EndOfBSPSection = -1;
397
408 virtual FuseInstruction fuse(int taskType) = 0;
409
435 virtual ExecutionPolicy paralleliseForkJoinSection(int nestedParallelismLevel, int numberOfTasks, int taskType) = 0;
436
444};
Interface for any task orchestration.
Definition Strategy.h:305
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:317
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:345