Device Class Reference
HiCR
|
#include <device.hpp>

Public Types | |
using | computeResourceList_t = std::vector< std::shared_ptr< ComputeResource > > |
using | memorySpaceList_t = std::vector< std::shared_ptr< MemorySpace > > |
Public Member Functions | |
virtual std::string | getType () const =0 |
__INLINE__ const computeResourceList_t & | getComputeResourceList () |
__INLINE__ const memorySpaceList_t & | getMemorySpaceList () |
__INLINE__ void | addComputeResource (const std::shared_ptr< HiCR::ComputeResource > &computeResource) |
__INLINE__ void | addMemorySpace (const std::shared_ptr< HiCR::MemorySpace > &memorySpace) |
virtual | ~Device ()=default |
Device (computeResourceList_t computeResources, memorySpaceList_t memorySpaces) | |
__INLINE__ nlohmann::json | serialize () const |
__INLINE__ void | deserialize (const nlohmann::json &input) |
Protected Member Functions | |
Device ()=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 HiCR Device that:
- Represents a physical computing device (e.g., CPU+RAM, GPU+DRAM), containing a set of compute resources (e.g., cores) and/or memory spaces (e.g., RAM)
- It may contain information about the connectivity between its compute and memory resources
- This is a copy-able class that only contains metadata
Member Typedef Documentation
◆ computeResourceList_t
using HiCR::Device::computeResourceList_t = std::vector<std::shared_ptr<ComputeResource> > |
Common type for a collection of compute resources
◆ memorySpaceList_t
using HiCR::Device::memorySpaceList_t = std::vector<std::shared_ptr<MemorySpace> > |
Common definition of a collection of memory spaces
Constructor & Destructor Documentation
◆ ~Device()
|
virtualdefault |
Default destructor
Reimplemented in HiCR::backend::ascend::Device, HiCR::backend::opencl::Device, and HiCR::backend::hwloc::Device.
◆ Device() [1/2]
|
inline |
Constructor requires at least to provide the initial set of compute resources and memory spaces
- Parameters
-
[in] computeResources The list of detected compute resources contained in this device [in] memorySpaces The list of detected memory spaces contained in this device
◆ Device() [2/2]
|
protecteddefault |
Protected constructor only for the derived classes to run the deserializing constructor
Member Function Documentation
◆ addComputeResource()
|
inline |
This function allows the deferred addition (post construction) of compute resources
- Parameters
-
[in] computeResource The compute resource to add
◆ addMemorySpace()
|
inline |
This function allows the deferred addition (post construction) of memory spaces
- Parameters
-
[in] memorySpace The compute resource to add
◆ deserialize()
|
inline |
De-serialization function to re-construct the serialized device information coming (typically) from remote instances
- Parameters
-
[in] input JSON-formatted serialized device information
- Note
- Important: Deserialized devices are not meant to be used in any from other than printing or reporting its topology. Any attempt of actually using them for computation or data transfers will result in undefined behavior.
◆ deserializeImpl()
|
protectedpure virtual |
Backend-specific implementation of the deserialize function
- Parameters
-
[in] input Serialized device information
◆ getComputeResourceList()
|
inline |
This function returns the list of queried compute resources, as visible by the device.
- Returns
- The list of compute resources contained in this device
◆ getMemorySpaceList()
|
inline |
This function returns the list of queried memory spaces, as visible by the device.
- Returns
- The list of memory spaces contained in this device
◆ getType()
|
pure virtual |
Indicates what type of device is represented in this instance
- Returns
- A string containing a human-readable description of the compute resource type
Implemented in HiCR::backend::ascend::Device, HiCR::backend::hwloc::Device, and HiCR::backend::opencl::Device.
◆ serialize()
|
inline |
Serialization function to enable sharing device information
- Returns
- JSON-formatted serialized device information
◆ serializeImpl()
|
protectedpure virtual |
Backend-specific implementation of the serialize function
- Parameters
-
[out] output Serialized device information
The documentation for this class was generated from the following file:
- /home/runner/work/HiCR/HiCR/include/hicr/core/device.hpp
Generated by