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>;
94 static Atomic<T_Index> _globalMaximumIndex;
95 return _globalMaximumIndex;
101 static bool _globalMaximumIndexInitialized =
false;
102 return _globalMaximumIndexInitialized;
108 static ReadWriteMutex _globalMaximumIndexMutex;
109 return _globalMaximumIndexMutex;
118 globalMaximumIndexMutex().lockWrite();
119 if (!globalMaximumIndexInitialized()) {
120 globalMaximumIndex() = reservedIndices;
121 globalMaximumIndexInitialized() =
true;
123 globalMaximumIndexMutex().unlockWrite();
124 generateNewIndices();
137 unsigned long maximumGlobalIndex = globalMaximumIndex();
140 TapeValues::LocalReductionOperation
constexpr operation = TapeValues::LocalReductionOperation::Max;
154 return globalMaximumIndex();
#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:91
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:128
void addToTapeValues(TapeValues &values) const
Add storage and other information to the tape values.
Definition parallelReuseIndexManager.hpp:136
Index getLargestCreatedIndex() const
Returns the largest created index.
Definition parallelReuseIndexManager.hpp:153
friend Base
Allow the base class to access protected and private members.
Definition parallelReuseIndexManager.hpp:67
ParallelReuseIndexManager(Index const &reservedIndices)
Definition parallelReuseIndexManager.hpp:117
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:259
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:75
void addUnsignedLongEntry(std::string const &name, unsigned long const &value, LocalReductionOperation operation=LocalReductionOperation::Sum)
Add unsigned long entry.
Definition tapeValues.hpp:163