Peano
Loading...
Searching...
No Matches
EnclaveTasking.EnclaveTask.template.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#include "repositories/SolverRepository.h"
6
8
10
11#include "exahype2/EnclaveBookkeeping.h"
12#include "exahype2/EnclaveTask.h"
13
14{{SOLVER_INCLUDES}}
15
16#include <vector>
17#include <memory>
18
19#ifdef UseSmartMPI
20#include "smartmpi.h"
21#endif
22
23{% for item in NAMESPACE -%}
24 namespace {{ item }} {
25
26{%- endfor %}
27 class {{CLASSNAME}};
28
29{% for item in NAMESPACE -%}
30 }
31{%- endfor %}
32
38class {{NAMESPACE | join("::")}}::{{CLASSNAME}}: public ::exahype2::EnclaveTask
39#ifdef UseSmartMPI
40, public smartmpi::Task
41#endif
42{
43 private:
45
46 #ifdef UseSmartMPI
47 /*
48 * This uniquely identifies an enclave task. Unlike _enclaveTaskTypeId it
49 * differentiates between tasks within a task type, not between task types.
50 *
51 * Crucially, the value of this ID is not necessarily the same as that of
52 * tarch::multicore::Task::_id . That is because _id is reset each time
53 * we move a task to another rank and reconstitute it there (see the constructor
54 * of tarch::multicore::Task). Instead, _remoteTaskId tracks the ID of
55 * the original task object (i.e. the task originally spawned and
56 * only then moved). In smartmpi we need to keep track of the task's
57 * ID so that it can be bookmarked correctly after being moved around.
58 *
59 * As such moveTask(...), sends _id if the task has not yet been
60 * moved and _remoteTaskId if it has already been moved. Similarly,
61 * _remoteTaskId is always sent when forwarding task outcomes since the
62 * task will already have been moved.
63 */
64 int _remoteTaskId = -1;
65 #endif
66
71 static int _enclaveTaskTypeId;
72
73 public:
74 static int getEnclaveTaskTypeId();
75
88 static double applyKernelToCell(
89 const ::peano4::datamanagement::CellMarker& marker,
90 double t,
91 double dt,
92 double* __restrict__ reconstructedPatch,
93 double* __restrict__ targetPatch
94 );
95
109 {{CLASSNAME}}(
110 const ::peano4::datamanagement::CellMarker& marker,
111 double t,
112 double dt,
113 double* __restrict__ reconstructedPatch,
114 double* __restrict__ output
115 );
116
117 #ifdef UseSmartMPI
118 bool isSmartMPITask() const;
119
120 virtual void runLocally() override;
121 virtual void moveTask(int rank, int tag, MPI_Comm communicator) override;
122 virtual void runLocallyAndSendTaskOutputToRank(int rank, int tag, MPI_Comm communicator) override;
123 virtual void forwardTaskOutputToRank(int rank, int tag, MPI_Comm communicator) override;
124
125 static smartmpi::Task* receiveTask(int rank, int tag, MPI_Comm communicator);
126 static smartmpi::Task* receiveOutcome(int rank, int tag, MPI_Comm communicator, const bool intentionToForward);
127 #endif
128
129 {% if STATELESS_PDE_TERMS %}
130 virtual void fuse(const std::vector<Task*>& otherTasks, int targetDevice = Host) override;
131 virtual bool canFuse() const override;
132 {% endif %}
133};
134
135{# Empty line here #}
Log Device.
Definition Log.h:517