MemorySpace Class Reference
HiCR
|
#include <memorySpace.hpp>

Public Member Functions | |
MemorySpace (const nlohmann::json &input) | |
virtual | ~MemorySpace ()=default |
__INLINE__ std::string | getType () const |
virtual __INLINE__ const size_t | getSize () const |
virtual __INLINE__ size_t | getUsage () const |
__INLINE__ void | increaseUsage (const size_t delta) |
__INLINE__ void | decreaseUsage (const size_t delta) |
__INLINE__ nlohmann::json | serialize () const |
__INLINE__ void | deserialize (const nlohmann::json &input) |
Protected Member Functions | |
MemorySpace (const size_t size) | |
MemorySpace ()=default | |
virtual void | serializeImpl (nlohmann::json &output) const |
virtual void | deserializeImpl (const nlohmann::json &input) |
Protected Attributes | |
std::string | _type |
Detailed Description
This class represents an generic definition for a Memory Space that:
- Represents a autonomous unit of byte-addressable memory (e.g., host memory, NUMA domain, device global RAM)
- The space is assumed to be contiguous and have a fixed sized determined at construction time
- This is a copy-able class that only contains metadata
A Device object may comprise one or more such Memory Spaces on which data can be allocated, copied and communicated among different Memory Spaces, provided there is connectivity
Constructor & Destructor Documentation
◆ MemorySpace() [1/3]
|
inline |
Deserializing constructor
The instance created will contain all information, if successful in deserializing it, corresponding to the passed host RAM This instance should NOT be used for anything else than reporting/printing the contained resources
- Parameters
-
[in] input A JSON-encoded serialized host RAM information
◆ ~MemorySpace()
|
virtualdefault |
Default destructor
Reimplemented in HiCR::backend::hwloc::MemorySpace, HiCR::backend::ascend::MemorySpace, and HiCR::backend::opencl::MemorySpace.
◆ MemorySpace() [2/3]
|
inlineprotected |
Constructor for the MemorySpace class
- Parameters
-
[in] size The size of the memory space to create
◆ MemorySpace() [3/3]
|
protecteddefault |
Default constructor for deserialization purposes
Member Function Documentation
◆ decreaseUsage()
|
inline |
Registers a decrease in the used memory size of the current memory space, either by freeing or manual deregistering
- Parameters
-
delta How much (in bytes) has the memory usage decreased
◆ deserialize()
|
inline |
Serialization function to enable sharing memory space information
- Parameters
-
[in] input JSON-formatted serialized memory space information
◆ deserializeImpl()
|
inlineprotectedvirtual |
Backend-specific implementation of the deserialize function
- Parameters
-
[in] input Serialized compute resource information corresponding to the specific backend's topology manager
◆ getSize()
|
inlinevirtual |
Returns the memory space's size
- Returns
- The memory space's size
◆ getType()
|
inline |
Indicates what type of memory space this represents
- Returns
- A string containing a human-readable description of the memory space type
◆ getUsage()
|
inlinevirtual |
If supported, obtain the amount of memory currently in use. In conjunction with the total size above, the user may deduce information like, usage%, if a particular allocation will be possible etc.
- Returns
- The current memory usage for this memory space
◆ increaseUsage()
|
inline |
Registers an increase in the used memory size of the current memory space, either by allocation or manual registering
- Parameters
-
delta How much (in bytes) has the memory usage increased
◆ serialize()
|
inline |
Serialization function to enable sharing memory space information
- Returns
- JSON-formatted serialized memory space information
◆ serializeImpl()
|
inlineprotectedvirtual |
Backend-specific implemtation of the serialize function that allows adding more information than the one provided by default by HiCR
- Parameters
-
[out] output JSON-formatted serialized compute resource information
Member Data Documentation
◆ _type
|
protected |
Type, used to identify exactly this memory space's model/technology
The documentation for this class was generated from the following file:
- /home/runner/work/HiCR/HiCR/include/hicr/core/memorySpace.hpp
Generated by