TopologyManager Class Reference

HiCR: HiCR::TopologyManager Class Reference
HiCR
HiCR::TopologyManager Class Referenceabstract

#include <topologyManager.hpp>

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

Public Member Functions

virtual ~TopologyManager ()=default
 
virtual HiCR::Topology queryTopology ()=0
 
virtual HiCR::Topology _deserializeTopology (const nlohmann::json &topology) const =0
 

Protected Member Functions

 TopologyManager ()=default
 

Detailed Description

Encapsulates a HiCR Backend Device Manager.

The purpose of this class is to discover the computing topology for a given device type. E.g., if this is a backend for an NPU device and the system contains 8 such devices, it will discover an array of Device type of size 8.

Backends need to fulfill the abstract virtual functions described here, so that HiCR can detect hardware devices

Constructor & Destructor Documentation

◆ ~TopologyManager()

virtual HiCR::TopologyManager::~TopologyManager ( )
virtualdefault

◆ TopologyManager()

HiCR::TopologyManager::TopologyManager ( )
protecteddefault

Protected default constructor used to build a new instance of this topology manager based on serialized information

Note
The instance created by this constructor should only be used to print/query the topology. It cannot be used to operate (memcpy, compute, etc).

Member Function Documentation

◆ _deserializeTopology()

virtual HiCR::Topology HiCR::TopologyManager::_deserializeTopology ( const nlohmann::json &  topology) const
pure virtual

This function deserializes a JSON-encoded topology into a topology class with its constituent devices, as recognized by the called backend, and returns it

If the backend does not recognize a device in the encoded topology, it will not add it to the topology

Parameters
[in]topologyThe JSON-encoded topology to deserialize
Returns
The deserialized topology containing only devices recognized by the backend

Implemented in HiCR::backend::ascend::TopologyManager, HiCR::backend::hwloc::TopologyManager, and HiCR::backend::opencl::TopologyManager.

◆ queryTopology()

virtual HiCR::Topology HiCR::TopologyManager::queryTopology ( )
pure virtual

This function prompts the backend to perform the necessary steps to discover the system topology

In case of change in resource availability during runtime, users need to re-run this function to be able to see the changes.

Returns
The detected topology, as detected by the specific b ackend

Implemented in HiCR::backend::ascend::TopologyManager, HiCR::backend::hwloc::TopologyManager, and HiCR::backend::opencl::TopologyManager.


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