Topology Class Reference

HiCR: HiCR::Topology Class Reference
HiCR

#include <topology.hpp>

Public Types

using deviceList_t = std::vector< std::shared_ptr< Device > >
 

Public Member Functions

 Topology (const nlohmann::json &input)
 
__INLINE__ const deviceList_tgetDevices () const
 
__INLINE__ void addDevice (const std::shared_ptr< HiCR::Device > &device)
 
__INLINE__ void merge (const Topology &source)
 
__INLINE__ nlohmann::json serialize () const
 
__INLINE__ void deserialize (const nlohmann::json &input)
 
__INLINE__ bool isSubset (const HiCR::Topology givenTopology)
 
nlohmann::json & getMetadata ()
 
const nlohmann::json & getMetadata () const
 
void setMetadata (const nlohmann::json &metadata)
 

Static Public Member Functions

static __INLINE__ void verify (const nlohmann::json &input)
 

Detailed Description

This class represents an abstract definition for a HiCR Topology that:

  • Describes the physical resources (devices) of a given system (real or constructed for requesting new currents)
  • Information about the connectivity between the given devices

Member Typedef Documentation

◆ deviceList_t

using HiCR::Topology::deviceList_t = std::vector<std::shared_ptr<Device> >

Common type for a collection of devices

Constructor & Destructor Documentation

◆ Topology()

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

Deserializing constructor

Parameters
[in]inputA JSON-encoded serialized topology information

Member Function Documentation

◆ addDevice()

__INLINE__ void HiCR::Topology::addDevice ( const std::shared_ptr< HiCR::Device > &  device)
inline

This function allows manually adding a new device into an existing topology

Parameters
[in]deviceThe device to add

◆ deserialize()

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

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

Parameters
[in]inputJSON-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.

◆ getDevices()

__INLINE__ const deviceList_t & HiCR::Topology::getDevices ( ) const
inline

This function prompts the backend to perform the necessary steps to return existing devices

Returns
A set of pointers to HiCR currents that refer to both local and remote currents

◆ getMetadata() [1/2]

nlohmann::json & HiCR::Topology::getMetadata ( )
inline

A function to get internal topology metadata

Returns
The internal topology metadata

◆ getMetadata() [2/2]

const nlohmann::json & HiCR::Topology::getMetadata ( ) const
inline

A const variant of the function to get internal topology metadata

Returns
The internal topology metadata

◆ isSubset()

__INLINE__ bool HiCR::Topology::isSubset ( const HiCR::Topology  givenTopology)
inline

Checks whether the given topology is a subset of this topology That is, whether it contains the given devices in the current type provided

The devices are checked in order. That is the first current device that satisfies a given device will be removed from the list when checking the next given device.

Parameters
[in]givenTopologyThe given topology to compare this topology with
Returns
true, if this current satisfies the current type; false, otherwise.

◆ merge()

__INLINE__ void HiCR::Topology::merge ( const Topology source)
inline

This function allows manually merging one topology information into another

Parameters
[in]sourceThe source topology to add into this current

◆ serialize()

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

Serialization function to enable sharing topology information across different HiCR currents (or any other purposes)

Returns
JSON-formatted serialized topology, as detected by this topology manager

◆ setMetadata()

void HiCR::Topology::setMetadata ( const nlohmann::json &  metadata)
inline

A function to set internal topology metadata

Parameters
[in]metadataThe JSON-based metadata to store

◆ verify()

static __INLINE__ void HiCR::Topology::verify ( const nlohmann::json &  input)
inlinestatic

Verifies the provided input (encoded in JSON) satisfied the standard format to describe a topology

Parameters
[in]inputJSON-formatted serialized topology

The documentation for this class was generated from the following file:
  • /home/runner/work/HiCR/HiCR/include/hicr/core/topology.hpp