STORMM Source Documentation
Loading...
Searching...
No Matches
stormm::card::Ledger Class Reference

A struct for storing records of all active Hybrid memory arrays. This will also store tables of identifiers that indicate the most recent state of a group of Hybrid arrays, which can be accessed by structs of pointers to make sure that they reflect the most recent state of all their underlying arrays. More...

#include <hybrid.h>

Public Member Functions

 Ledger ()
 Constructor initializes the number of entries and allocations.
 
 ~Ledger ()=default
 Default destructor.
 
int getActiveEntryCount () const
 Retrieve the number of entries for Hybrid memory objects currently stored.
 
int getSerialNumber ()
 Produce a number corresponding to some unused entry in the ledger. This will be either the lowest positive integer not yet assigned, or if some integers once assigned to destroyed Hybrid objects have been freed up, the first such integer from that list.
 
llint getTotalExpedited () const
 Retrieve the total allocation of decoupled memory, in bytes.
 
llint getTotalDecoupled () const
 Retrieve the total allocation of decoupled memory, in bytes.
 
llint getTotalUnified () const
 Retrieve the total allocation of unified memory, in bytes.
 
llint getTotalHostOnly () const
 Retrieve the total allocation of host-only memory, in bytes.
 
llint getTotalDevcOnly () const
 Retrieve the total allocation of device-only memory, in bytes.
 
llint getTotalHostMounted () const
 Retrieve the total allocation of host-mounted memory, in bytes.
 
void setEntry (int serno, HybridKind kind, const HybridLabel hlbl, size_t length, size_t element_size, int allocations)
 Begin a catalog for the place of a Hybrid object among many others. This is to be called once for each object, in its constructor.
 
void unsetEntry (int serno)
 Remove a Hybrid object from the catalog. This is to be called by the Hybrid object's destructor.
 
void logMemory (size_t capacity, size_t element_size, HybridFormat fmt, const HybridLabel hlbl, llint multiplier)
 Log each tagged Hybrid array in the ledger.
 
bool testActive (int serno)
 Query an index in the ledger to determine whether it catalogs an active Hybrid object.
 
int getAllocations (int serno)
 Query the number of times the Hybrid object catalogged in a particular entry has had its data arrays allocated.
 
void printMemoryProfile (int n_display=8, llint display_threshold=mega)
 Print the current memory usage of all Hybrid objects. The function will print totals followed by specific usages.
 
LedgerEntry getEntry (int index) const
 Get information about a single entry of a ledger.
 
std::vector< LedgerEntrygetEntry (const std::string &name) const
 

Detailed Description

A struct for storing records of all active Hybrid memory arrays. This will also store tables of identifiers that indicate the most recent state of a group of Hybrid arrays, which can be accessed by structs of pointers to make sure that they reflect the most recent state of all their underlying arrays.

Member Function Documentation

◆ getEntry()

LedgerEntry stormm::card::Ledger::getEntry ( int index) const

Get information about a single entry of a ledger.

Overloaded:

  • Produce the entry from a specific index
  • Produce all entries corresponding to a particular label name

◆ printMemoryProfile()

void stormm::card::Ledger::printMemoryProfile ( int n_display = 8,
llint display_threshold = mega )

Print the current memory usage of all Hybrid objects. The function will print totals followed by specific usages.

Parameters
n_displayDisplay at least this many usages. Show all Hybrid objects if this value is less than zero or greater than the number of unique arrays.
display_thresholdIn addition, print any Hybrid objects allocated to more than this value on either the host or device

◆ setEntry()

void stormm::card::Ledger::setEntry ( int serno,
HybridKind kind,
const HybridLabel hlbl,
size_t length,
size_t element_size,
int allocations )

Begin a catalog for the place of a Hybrid object among many others. This is to be called once for each object, in its constructor.

Parameters
sourceThe Hybrid object to be catalogged

◆ testActive()

bool stormm::card::Ledger::testActive ( int serno)

Query an index in the ledger to determine whether it catalogs an active Hybrid object.

Parameters
sernoSerial number of the Hybrid object in question

◆ unsetEntry()

void stormm::card::Ledger::unsetEntry ( int serno)

Remove a Hybrid object from the catalog. This is to be called by the Hybrid object's destructor.

Parameters
sourceThe Hybrid object to be catalogged

The documentation for this class was generated from the following files: