|
| void | raisePeak (std::atomic< std::size_t > &a_mark, const std::size_t a_value) noexcept |
| | Raise a high-water mark to a_value unless it is already at least that.
|
| |
| void | addBytes (const Kind a_kind, const std::size_t a_bytes) noexcept |
| | Record an allocation.
|
| |
| void | removeBytes (const Kind a_kind, const std::size_t a_bytes) noexcept |
| | Record a release.
|
| |
| std::size_t | getBytes (const Kind a_kind) noexcept |
| | Get the bytes currently held by one kind.
|
| |
| std::size_t | getPeak (const Kind a_kind) noexcept |
| | Get the high-water mark of one kind.
|
| |
| std::size_t | getAllocatedBytes () noexcept |
| | Get the bytes currently held by particle data of every kind.
|
| |
| std::size_t | getPeakBytes () noexcept |
| | Get the high-water mark across all kinds.
|
| |
Running totals of the memory held by particle data on this rank.
Chombo's memory tracking counts only allocations that pass through its Arena, i.e. BaseFab-backed mesh data. Particle storage never reaches it – ParticleSoA allocates with std::aligned_alloc and the exchange buffers are plain std::vector – so on a particle-heavy run the largest term in the footprint is invisible to overallMemoryUsage(). This namespace closes that gap.
The total is split by kind, because the two answer different questions and have different remedies:
- Container: the arenas owned by ParticleSoA. Capacity a rank is holding, including the slack that geometric growth leaves behind. Released only when a container is destroyed or shrunk, so it persists between operations.
- Buffer: the flat send and receive buffers of a cross-rank exchange. Payload in flight. Exists only for the duration of one exchange, and is sized by how much is being moved rather than by how much a rank owns.
A peak that is mostly Container means a rank is retaining capacity, and shrinking it is the fix. A peak that is mostly Buffer means too much is moved at once, and chunking the exchange is the fix. The summed total cannot tell them apart, which is the reason for the split.
Peaks are tracked per kind and for the total. The total peak is not the sum of the per-kind peaks, because the two need not peak at the same moment.
This is a companion to Chombo's Arena accounting rather than an independent facility, so it is compiled in and out with it: with USE_MT=FALSE the whole namespace is inert, the counters do not exist, and the memory report prints nothing. The functions are still declared, so that the allocation sites in ParticleSoA and ParticleContainer read the same either way and cannot fall out of step with each other behind a preprocessor guard.