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

Public Member Functions | |
virtual std::string | getType () const =0 |
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) |
virtual | ~MemorySpace ()=default |
__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 =0 |
virtual void | deserializeImpl (const nlohmann::json &input)=0 |
Detailed Description
This class represents an abstract 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()
|
virtualdefault |
Default destructor
Reimplemented in HiCR::backend::hwloc::MemorySpace, HiCR::backend::ascend::MemorySpace, and HiCR::backend::opencl::MemorySpace.
◆ MemorySpace() [1/2]
|
inlineprotected |
Constructor for the MemorySpace class
- Parameters
-
[in] size The size of the memory space to create
◆ MemorySpace() [2/2]
|
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()
|
protectedpure virtual |
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()
|
pure virtual |
Indicates what type of memory space is contained in this instance
- Returns
- A string containing a human-readable description of the memory space type
Implemented in HiCR::backend::ascend::MemorySpace, HiCR::backend::hwloc::MemorySpace, and HiCR::backend::opencl::MemorySpace.
◆ 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()
|
protectedpure virtual |
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
The documentation for this class was generated from the following file:
- /home/runner/work/HiCR/HiCR/include/hicr/core/memorySpace.hpp
Generated by