Peano
Loading...
Searching...
No Matches
EnclaveBookkeeping.h
Go to the documentation of this file.
1// This file is part of the ExaHyPE2 project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5
6#include "tarch/logging/Log.h"
8
9
11
12#include <set>
13#include <map>
14#include <unordered_map>
15#include <string>
16
17
18namespace exahype2 {
19 class EnclaveBookkeeping;
20 class EnclaveTask;
21}
22
23
43 public:
44 struct Entry {
46 double* data;
48
49 Entry( int numberOfResultValues_, double* data_, double maxEigenvalue_ );
50 Entry( const Entry& copy ) = default;
51
55 ~Entry() = default;
56 std::string toString() const;
57 };
58 private:
60
62
63 using FinishedTaskMap = std::unordered_map<int, Entry >;
64
70
71 #if PeanoDebug>0
75 std::map<int, ::peano4::datamanagement::CellMarker > _taskToMarkerMapping;
76 #endif
77
79
81
82 EnclaveBookkeeping() = default;
84
110 int number,
113 );
114 public:
115 static constexpr int NoEnclaveTaskNumber = -1;
120 static constexpr int SkeletonTask = -2;
121
123
128
153 int number,
154 double* destination,
155 double& maxEigenvalue,
158 );
159
169 int number,
172 );
173
186 int number,
189 );
190
211 int taskNumber,
212 int numberOfResultValues,
213 double* data,
214 double maxEigenvalue,
217 );
218
226 void registerTask( int taskNumber, const ::peano4::datamanagement::CellMarker& marker );
227
228};
229
Entry waitForTaskToTerminateAndReturnResult(int number, const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h)
Wait for a task result to become available.
std::unordered_map< int, Entry > FinishedTaskMap
void waitForTaskToTerminateAndCopyResultOver(int number, double *destination, double &maxEigenvalue, const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h)
Wait for a task and copy outcome into destination.
static tarch::logging::Log _log
std::set< int > _tasksThatHaveToBeCancelled
void waitForTaskAndDiscardResult(int number, const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h)
Wait for a task and copy outcome into destination.
void dumpStatistics()
For debugging only.
void registerTask(int taskNumber, const ::peano4::datamanagement::CellMarker &marker)
This one is only there for debugging purposes.
FinishedTaskMap _finishedTasks
Plain map onto ouput array.
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.
static const std::string MemoryAllocationsInLookupTableIdentifier
void waitForTaskToTerminateAndWriteResultDirectly(int number, const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &h)
Wait for a task to terminate and write its result directly to the output pointer provided to the encl...
static constexpr int SkeletonTask
Skeletons are not really tasks in the traditional sense.
EnclaveBookkeeping(const EnclaveBookkeeping &)=delete
tarch::multicore::BooleanSemaphore _finishedTasksSemaphore
static constexpr int NoEnclaveTaskNumber
static EnclaveBookkeeping & getInstance()
Log Device.
Definition Log.h:517
This file is part of the multigrid project within Peano 4.
Definition __init__.py:1
Entry(int numberOfResultValues_, double *data_, double maxEigenvalue_)
~Entry()=default
We do not delete data.
Entry(const Entry &copy)=default
Simple vector class.
Definition Vector.h:159