Peano
Loading...
Searching...
No Matches
multicore.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
4#include <string>
5#include <set>
6#include <vector>
7#include <list>
8#include <limits>
9
10#include "config.h"
13
14#if defined(SharedOMP) || defined(SharedTBB) || defined(SharedCPP) || defined(SharedSYCL)
15#define SharedMemoryParallelisation
16#endif
17
18#pragma once
19
20namespace tarch {
203 namespace multicore {
207 class Task;
208
209 using TaskNumber = int;
210
212
213 const std::set<TaskNumber> NoInDependencies = std::set<TaskNumber>();
214
258 extern const std::string SpawnedTasksStatisticsIdentifier;
259
266 extern const std::string SpawnedFusableTasksStatisticsIdentifier;
267
268
300 extern const std::string BSPConcurrencyLevelStatisticsIdentifier;
301
323 std::string toString( const std::set<TaskNumber>& taskNumbers );
324
334
336
345
347
426 Task* task,
427 const std::set<TaskNumber>& inDependencies = tarch::multicore::NoInDependencies,
429 );
430
434 enum class TaskWaitType {
435 Mixed,
438 };
439
481 void waitForTasks(const std::set<TaskNumber>& inDependencies, TaskWaitType taskWaitType = TaskWaitType::Mixed);
482
486 void waitForTask(const int taskNumber, TaskWaitType taskWaitType = TaskWaitType::Mixed);
487
583 void spawnAndWait(const std::vector<Task*>& tasks);
584
585
586 namespace native {
630 void spawnAndWaitAsTaskLoop(const std::vector<tarch::multicore::Task*>& tasks);
631
767 Task* task,
768 const std::set<TaskNumber>& inDependencies,
769 const TaskNumber& taskNumber
770 );
771
853 void waitForTasks(const std::set<TaskNumber>& inDependencies);
854
884 } // namespace native
885
886
891 } // namespace multicore
892} // namespace tarch
Abstract super class for a job.
Definition Task.h:21
Interface for any task orchestration.
Definition Strategy.h:288
void spawnTask(Task *task, const std::set< TaskNumber > &inDependencies, const TaskNumber &taskNumber)
Spawn a new task into the tasking backend.
void spawnAndWaitAsTaskLoop(const std::vector< tarch::multicore::Task * > &tasks)
Map onto native tasking.
void waitForAllTasks()
Slightly different than the umbrella version in the general namespace.
void waitForTasks(const std::set< TaskNumber > &inDependencies)
Wait for other task.
const std::set< TaskNumber > NoInDependencies
Definition multicore.h:213
TaskWaitType
This is a hint type which can be used to accelerate any taskwaits.
Definition multicore.h:434
const std::string SpawnedTasksStatisticsIdentifier
Statistics identifier for spawned tasks.
void shutdownSmartMPI()
tarch::multicore::orchestration::Strategy & getOrchestration()
const std::string SpawnedFusableTasksStatisticsIdentifier
Number of fusable tasks over time Please consult std::string SpawnedTasksStatisticsIdentifier for a d...
const std::string BSPConcurrencyLevelStatisticsIdentifier
Statistics identifier for active BSP sections.
void waitForTasks(const std::set< TaskNumber > &inDependencies, TaskWaitType taskWaitType=TaskWaitType::Mixed)
Wait for set of tasks.
void waitForTask(const int taskNumber, TaskWaitType taskWaitType=TaskWaitType::Mixed)
Wrapper around waitForTasks() with a single-element set.
constexpr TaskNumber NoOutDependencies
Definition multicore.h:211
void setOrchestration(tarch::multicore::orchestration::Strategy *realisation)
void spawnAndWait(const std::vector< Task * > &tasks)
Fork-join task submission pattern.
void waitForAllTasks()
Wait for all tasks notably has to take fused tasks into account.
tarch::multicore::orchestration::Strategy * swapOrchestration(tarch::multicore::orchestration::Strategy *realisation)
Swap the active orchestration.
void spawnTask(Task *task, const std::set< TaskNumber > &inDependencies=tarch::multicore::NoInDependencies, const TaskNumber &taskNumber=tarch::multicore::NoOutDependencies)
Spawns a single task in a non-blocking fashion.
std::string toString(const std::set< TaskNumber > &taskNumbers)
Construct string representation.
void initSmartMPI()
Switch on SmartMPI.
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19