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 {
93 namespace multicore {
97 class Task;
98
99 using TaskNumber = int;
100
102
103 const std::set<TaskNumber> NoInDependencies = std::set<TaskNumber>();
104
126 std::string toString( const std::set<TaskNumber>& taskNumbers );
127
135 void initSmartMPI();
136 void shutdownSmartMPI();
137
139
148
150
228 void spawnTask(
229 Task* task,
230 const std::set<TaskNumber>& inDependencies = tarch::multicore::NoInDependencies,
232 );
233
242
284 void waitForTasks(const std::set<TaskNumber>& inDependencies, TaskWaitType taskWaitType = TaskWaitType::Mixed);
285
289 void waitForTask(const int taskNumber, TaskWaitType taskWaitType = TaskWaitType::Mixed);
290
386 void spawnAndWait(const std::vector<Task*>& tasks);
387
388
389 namespace native {
433 void spawnAndWaitAsTaskLoop(const std::vector<tarch::multicore::Task*>& tasks);
434
569 void spawnTask(
570 Task* task,
571 const std::set<TaskNumber>& inDependencies,
572 const TaskNumber& taskNumber
573 );
574
656 void waitForTasks(const std::set<TaskNumber>& inDependencies);
657
686 void waitForAllTasks();
687 } // namespace native
688
689
693 void waitForAllTasks();
694
695
726 void processFusedTask(Task* myTask, const std::vector<tarch::multicore::Task*>& tasksOfSameType, int device);
727
728 } // namespace multicore
729} // namespace tarch
Abstract super class for a job.
Definition Task.h:21
Interface for any task orchestration.
Definition Strategy.h:287
void spawnAndWaitAsTaskLoop(const std::vector< tarch::multicore::Task * > &tasks)
Map onto native tasking.
Definition Tasks.cpp:113
const std::set< TaskNumber > NoInDependencies
Definition multicore.h:103
TaskWaitType
This is a hint type which can be used to accelerate any taskwaits.
Definition multicore.h:237
void shutdownSmartMPI()
Definition multicore.cpp:71
tarch::multicore::orchestration::Strategy & getOrchestration()
Definition multicore.cpp:97
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:101
void setOrchestration(tarch::multicore::orchestration::Strategy *realisation)
Definition multicore.cpp:78
void processFusedTask(Task *myTask, const std::vector< tarch::multicore::Task * > &tasksOfSameType, int device)
Process a fused task.
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.
Definition multicore.cpp:87
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.
Definition multicore.cpp:33
void initSmartMPI()
Switch on SmartMPI.
Definition multicore.cpp:55
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19