ComputeResource Class Reference

HiCR: HiCR::ComputeResource Class Reference
HiCR

#include <computeResource.hpp>

Inheritance diagram for HiCR::ComputeResource:
HiCR::backend::ascend::ComputeResource HiCR::backend::hwloc::ComputeResource HiCR::backend::opencl::ComputeResource

Public Member Functions

 ComputeResource ()=default
 
 ComputeResource (const nlohmann::json &input)
 
virtual ~ComputeResource ()=default
 
__INLINE__ std::string getType () const
 
__INLINE__ nlohmann::json serialize () const
 
__INLINE__ void deserialize (const nlohmann::json &input)
 

Protected Member Functions

virtual __INLINE__ void serializeImpl (nlohmann::json &output) const
 
virtual __INLINE__ void deserializeImpl (const nlohmann::json &input)
 

Protected Attributes

std::string _type
 

Detailed Description

This class represents an generic definition for a Compute Resource that:

  • Represents a single autonomous unit of computing power (e.g., CPU core, device)
  • This is a copy-able class that only contains metadata

Constructor & Destructor Documentation

◆ ComputeResource() [1/2]

HiCR::ComputeResource::ComputeResource ( )
default

Default constructor

◆ ComputeResource() [2/2]

HiCR::ComputeResource::ComputeResource ( const nlohmann::json &  input)
inline

Deserializing constructor

The instance created will contain all information, if successful in deserializing it, corresponding to the passed processing unit This instance should NOT be used for anything else than reporting/printing the contained resources

Parameters
[in]inputA JSON-encoded serialized processing unit information

◆ ~ComputeResource()

virtual HiCR::ComputeResource::~ComputeResource ( )
virtualdefault

Member Function Documentation

◆ deserialize()

__INLINE__ void HiCR::ComputeResource::deserialize ( const nlohmann::json &  input)
inline

De-serialization function to re-construct the serialized compute resource information coming (typically) from remote instances

Parameters
[in]inputJSON-formatted serialized compute resource information

◆ deserializeImpl()

virtual __INLINE__ void HiCR::ComputeResource::deserializeImpl ( const nlohmann::json &  input)
inlineprotectedvirtual

Backend-specific implementation of the deserialize function

Parameters
[in]inputSerialized compute resource information corresponding to the specific backend's topology manager

Reimplemented in HiCR::backend::hwloc::ComputeResource.

◆ getType()

__INLINE__ std::string HiCR::ComputeResource::getType ( ) const
inline

Indicates what type of compute unit is contained in this instance

Returns
A string containing a human-readable description of the compute resource type

◆ serialize()

__INLINE__ nlohmann::json HiCR::ComputeResource::serialize ( ) const
inline

Serialization function to enable sharing compute resource information

Returns
JSON-formatted serialized compute resource information

◆ serializeImpl()

virtual __INLINE__ void HiCR::ComputeResource::serializeImpl ( nlohmann::json &  output) const
inlineprotectedvirtual

Backend-specific implemtation of the serialize function that allows adding more information than the one provided by default by HiCR

Parameters
[out]outputJSON-formatted serialized compute resource information

Reimplemented in HiCR::backend::hwloc::ComputeResource.

Member Data Documentation

◆ _type

std::string HiCR::ComputeResource::_type
protected

Type, used to identify exactly this compute resource's model/technology


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