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
10#include <set>
11#include <unordered_map>
12#include <string>
13
14
15namespace exahype2 {
16 class EnclaveBookkeeping;
17 class EnclaveTask;
18}
19
20
40 public:
41 struct Entry {
43 double* data;
45
46 Entry( int numberOfResultValues_, double* data_, double maxEigenvalue_ );
47 std::string toString() const;
48 };
49 private:
51
53
58 std::unordered_map<int, Entry > _finishedTasks;
59
61
63
64 EnclaveBookkeeping() = default;
65
76 public:
77 static constexpr int NoEnclaveTaskNumber = -1;
82 static constexpr int SkeletonTask = -2;
83
85
89 void dumpStatistics();
90
109 void waitForTaskToTerminateAndCopyResultOver(int number, double* destination, double& maxEigenvalue);
110
114 void waitForTaskAndDiscardResult(int number);
115
116 void cancelTask(int number);
117
132 void finishedTask(int taskNumber, int numberOfResultValues, double* data, double maxEigenvalue);
133};
134
static EnclaveBookkeeping & getInstance()
static tarch::logging::Log _log
std::set< int > _tasksThatHaveToBeCancelled
void dumpStatistics()
For debugging only.
void waitForTaskAndDiscardResult(int number)
Wait for a task and copy outcome into destination.
static const std::string MemoryAllocationsInLookupTableIdentifier
std::unordered_map< int, Entry > _finishedTasks
Plain map onto ouput array.
void finishedTask(int taskNumber, int numberOfResultValues, double *data, double maxEigenvalue)
Usually called directly by EnclaveTask.
static constexpr int SkeletonTask
Skeletons are not really tasks in the traditional sense.
Entry waitForTaskToTerminateAndReturnResult(int number)
Wait for a task result to become available.
tarch::multicore::BooleanSemaphore _finishedTasksSemaphore
void waitForTaskToTerminateAndCopyResultOver(int number, double *destination, double &maxEigenvalue)
Wait for a task and copy outcome into destination.
static constexpr int NoEnclaveTaskNumber
Log Device.
Definition Log.h:516
For the generic kernels that I use here most of the time.
Definition CellAccess.h:13
Entry(int numberOfResultValues_, double *data_, double maxEigenvalue_)