Skip to content

Commit

Permalink
Clarify dependencies of local reduction operations in index managers.
Browse files Browse the repository at this point in the history
  • Loading branch information
jblueh committed Mar 4, 2024
1 parent 141b13a commit d1d16c7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
6 changes: 5 additions & 1 deletion include/codi/tapes/indices/linearIndexManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ namespace codi {
/// \copydoc IndexManagerInterface::addToTapeValues <br><br>
/// Implementation: Adds maximum live indices.
void addToTapeValues(TapeValues& values) const {
values.addLongEntry("Max. live indices", getLargestCreatedIndex(), TapeValues::LocalReductionOperation::Sum);
TapeValues::LocalReductionOperation constexpr operation = NeedsStaticStorage
? TapeValues::LocalReductionOperation::Max
: TapeValues::LocalReductionOperation::Sum;

values.addLongEntry("Max. live indices", getLargestCreatedIndex(), operation);
}

/// \copydoc IndexManagerInterface::freeIndex <br><br>
Expand Down
7 changes: 5 additions & 2 deletions include/codi/tapes/indices/multiUseIndexManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ namespace codi {

double memoryindexUseVector = (double)indexUse.size() * (double)(sizeof(Index));

values.addDoubleEntry("Memory: index use vector", memoryindexUseVector,
TapeValues::LocalReductionOperation::Max, true, true);
TapeValues::LocalReductionOperation constexpr operation = NeedsStaticStorage
? TapeValues::LocalReductionOperation::Max
: TapeValues::LocalReductionOperation::Sum;

values.addDoubleEntry("Memory: index use vector", memoryindexUseVector, operation, true, true);
}

/// \copydoc ReuseIndexManager::assignIndex
Expand Down
5 changes: 4 additions & 1 deletion include/codi/tapes/indices/parallelReuseIndexManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ namespace codi {
void addToTapeValues(TapeValues& values) const {
unsigned long maximumGlobalIndex = globalMaximumIndex();

values.addUnsignedLongEntry("Max. live indices", maximumGlobalIndex, TapeValues::LocalReductionOperation::Max);
// As maximumGlobalIndex is static, it uses a local maximum reduction.
TapeValues::LocalReductionOperation constexpr operation = TapeValues::LocalReductionOperation::Max;

values.addUnsignedLongEntry("Max. live indices", maximumGlobalIndex, operation);
// The number of current live indices cannot be computed from one instance alone.
// It equals the number of maximum live indices minus the number of indices stored across all instances.

Expand Down
8 changes: 6 additions & 2 deletions include/codi/tapes/indices/reuseIndexManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ namespace codi {
unsigned long storedIndices = this->usedIndicesPos + this->unusedIndicesPos;
long currentLiveIndices = maximumGlobalIndex - storedIndices;

values.addUnsignedLongEntry("Max. live indices", maximumGlobalIndex, TapeValues::LocalReductionOperation::Max);
values.addLongEntry("Cur. live indices", currentLiveIndices, TapeValues::LocalReductionOperation::Max);
TapeValues::LocalReductionOperation constexpr operation = NeedsStaticStorage
? TapeValues::LocalReductionOperation::Max
: TapeValues::LocalReductionOperation::Sum;

values.addUnsignedLongEntry("Max. live indices", maximumGlobalIndex, operation);
values.addLongEntry("Cur. live indices", currentLiveIndices, operation);

Base::addToTapeValues(values);
}
Expand Down

0 comments on commit d1d16c7

Please sign in to comment.