42#include "../../tools/parallel/parallelToolbox.hpp"
43#include "reuseIndexManagerBase.hpp"
58 template<
typename T_Index,
typename T_ParallelToolbox>
65 CODI_DEFAULT_PARALLEL_TOOLBOX);
71 template<
typename Type>
72 using Atomic =
typename ParallelToolbox::template Atomic<Type>;
91 static Atomic<T_Index> globalMaximumIndex;
92 static bool globalMaximumIndexInitialized;
93 static ReadWriteMutex globalMaximumIndexMutex;
101 globalMaximumIndexMutex.lockWrite();
102 if (!globalMaximumIndexInitialized) {
103 globalMaximumIndex = reservedIndices;
104 globalMaximumIndexInitialized =
true;
106 globalMaximumIndexMutex.unlockWrite();
107 generateNewIndices();
120 unsigned long maximumGlobalIndex = globalMaximumIndex;
134 return globalMaximumIndex;
160 template<
typename Index,
typename ParallelToolbox>
161 typename ParallelReuseIndexManager<Index, ParallelToolbox>::template Atomic<Index>
162 ParallelReuseIndexManager<Index, ParallelToolbox>::globalMaximumIndex;
164 template<
typename Index,
typename ParallelToolbox>
165 bool ParallelReuseIndexManager<Index, ParallelToolbox>::globalMaximumIndexInitialized =
false;
167 template<
typename Index,
typename ParallelToolbox>
168 typename ParallelReuseIndexManager<Index, ParallelToolbox>::ReadWriteMutex
169 ParallelReuseIndexManager<Index, ParallelToolbox>::globalMaximumIndexMutex;
#define CODI_NO_INLINE
See codi::Config::AvoidedInlines.
Definition config.h:417
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:457
#define codiAssert(x)
See codi::Config::EnableAssert.
Definition config.h:432
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:94
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
Reuse index manager with a one-to-one relation between tapes and index manager.
Definition parallelReuseIndexManager.hpp:60
static bool constexpr NeedsStaticStorage
< See ReuseIndexManagerBase.
Definition parallelReuseIndexManager.hpp:84
T_Index Index
See ParallelReuseIndexManager.
Definition parallelReuseIndexManager.hpp:63
~ParallelReuseIndexManager()
Destructor.
Definition parallelReuseIndexManager.hpp:111
void addToTapeValues(TapeValues &values) const
Add storage and other information to the tape values.
Definition parallelReuseIndexManager.hpp:119
Index getLargestCreatedIndex() const
Returns the largest created index.
Definition parallelReuseIndexManager.hpp:133
friend Base
Allow the base class to access protected and private members.
Definition parallelReuseIndexManager.hpp:67
ParallelReuseIndexManager(Index const &reservedIndices)
Definition parallelReuseIndexManager.hpp:100
T_ParallelToolbox ParallelToolbox
See ParallelReuseIndexManager.
Definition parallelReuseIndexManager.hpp:64
Identifiers are reused. Freed identifiers are assigned to new variables. Variables keep their indices...
Definition reuseIndexManagerBase.hpp:66
static bool constexpr IsLinear
Identifiers are not coupled to statements.
Definition reuseIndexManagerBase.hpp:80
std::vector< Index > unusedIndices
Pool of indices that have not been used in this recording yet.
Definition reuseIndexManagerBase.hpp:90
static bool constexpr CopyNeedsStatement
No copy optimization is implemented.
Definition reuseIndexManagerBase.hpp:79
void addToTapeValues(TapeValues &values) const
Add storage and other information to the tape values.
Definition reuseIndexManagerBase.hpp:233
size_t indexSizeIncrement
Block size for index pool enlargement.
Definition reuseIndexManagerBase.hpp:93
size_t unusedIndicesPos
Number of remaining unused indices.
Definition reuseIndexManagerBase.hpp:91
Tape information that can be printed in a pretty print format or a table format.
Definition tapeValues.hpp:73
void addUnsignedLongEntry(std::string const &name, unsigned long const &value)
Add unsigned long entry.
Definition tapeValues.hpp:150