Peano
Loading...
Searching...
No Matches
EnclaveTask.cpp
Go to the documentation of this file.
1#include "EnclaveTask.h"
2
3#include "config.h"
8
9
11
12
14
15
17
18
20 logDebug( "releaseTaskNumber(int)", "enclave task number " << number << " has been released and should be recycled later" );
21 _enumerator.releaseNumber(number);
22}
23
24
26 return _enumerator.getNumber();
27}
28
29
31 int enclaveTaskTypeId,
32 const ::peano4::datamanagement::CellMarker& marker,
33 double t,
34 double dt,
35 double* __restrict__ inputValues,
36 double* __restrict__ outputValues,
37 int numberOfInputValues,
38 int numberOfResultValues,
39 Functor functor
40):
41 tarch::multicore::Task(enclaveTaskTypeId, tarch::multicore::Task::DefaultPriority),
43 _marker(marker),
44 _t(t),
45 _dt(dt),
46 _inputValues(inputValues),
47 _outputValues(outputValues),
48 _numberOfInputValues(numberOfInputValues),
49 _numberOfResultValues(numberOfResultValues),
50 _functor(functor),
51 _maxEigenvalue(-1.0) {
52 logTraceIn("EnclaveTask(...)");
53
56
57 logTraceOut("EnclaveTask(...)");
58}
59
60
67
68
71 assertion(_inputValues != nullptr);
72
73 if (_outputValues==nullptr) {
75 }
76 else {
77 logDebug( "computeTask()", "enclave task " << _taskNumber << " writes directly into mesh data structure at " << _outputValues << " (uses data from " << _inputValues << ")" );
78 }
79
80 logDebug("computeTask()", "lambda=" << _maxEigenvalue);
81 _functor();
82}
83
84
#define assertion1(expr, param)
#define assertion(expr)
#define logDebug(methodName, logMacroMessageStream)
Definition Log.h:50
#define logTraceOut(methodName)
Definition Log.h:379
#define logTraceIn(methodName)
Definition Log.h:369
#define logTraceInWith1Argument(methodName, argument0)
Definition Log.h:370
static EnclaveBookkeeping & getInstance()
void registerTask(int taskNumber, const ::peano4::datamanagement::CellMarker &marker)
This one is only there for debugging purposes.
void finishedTask(int taskNumber, int numberOfResultValues, double *data, double maxEigenvalue, const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h)
Usually called directly by EnclaveTask.
std::function< void()> Functor
Definition EnclaveTask.h:81
virtual void run() override
Computes a task and bookmarks the outcome.
static tarch::logging::Log _log
Definition EnclaveTask.h:86
static int getNumberOfActiveTasks()
double *__restrict__ _inputValues
static int reserveTaskNumber()
Reserve a new enclave task number.
const int _taskNumber
Each task needs a unique number, so we can look up its output.
Definition EnclaveTask.h:91
EnclaveTask(int enclaveTaskTypeId, const ::peano4::datamanagement::CellMarker &marker, double t, double dt, double *__restrict__ inputValues, double *__restrict__ outputValues, int numberOfInputValues, int numberOfResultValues, Functor functor)
Create plain enclave task.
void computeTask()
Compute the task.
double *__restrict__ _outputValues
static void releaseTaskNumber(int number)
const double _t
These are the reconstructed values in the Finite Volume sense and the linear combination in the DG so...
const ::peano4::datamanagement::CellMarker _marker
Definition EnclaveTask.h:92
int getTaskId() const
Return _taskNumber.
static tarch::multicore::TaskEnumerator _enumerator
Log Device.
Definition Log.h:516
Rank-global enumerator for tasks.
virtual std::string toString() const
Definition Task.cpp:51
Task(int taskType, int priority)
Construct task.
Definition Task.cpp:25
static constexpr int DefaultPriority
Definition Task.h:27
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19
@ ManagedSharedAcceleratorDeviceMemory
To be used on host only.
Definition accelerator.h:73
T * allocateMemory(std::size_t count, MemoryLocation location, int device=accelerator::Device::HostDevice)
Allocates memory on the specified memory location.
Definition accelerator.h:99