InstanceManager Class Reference

HiCR: HiCR::InstanceManager Class Reference
HiCR
HiCR::InstanceManager Class Referenceabstract

#include <instanceManager.hpp>

Inheritance diagram for HiCR::InstanceManager:
HiCR::backend::hwloc::InstanceManager HiCR::backend::mpi::InstanceManager

Public Types

using RPCTargetIndex_t = uint64_t
 
using RPCFunction_t = std::function< void()>
 
using instanceList_t = std::vector< std::shared_ptr< HiCR::Instance > >
 

Public Member Functions

 InstanceManager ()=default
 
virtual ~InstanceManager ()=default
 
__INLINE__ instanceList_tgetInstances ()
 
__INLINE__ std::shared_ptr< HiCR::InstancegetCurrentInstance () const
 
__INLINE__ std::shared_ptr< HiCR::InstanceTemplatecreateInstanceTemplate (const HiCR::Topology &requestedTopology=HiCR::Topology())
 
__INLINE__ std::shared_ptr< HiCR::InstancecreateInstance (const HiCR::InstanceTemplate instanceTemplate)
 
__INLINE__ void terminateInstance (const std::shared_ptr< HiCR::Instance > instance)
 
__INLINE__ void addInstance (HiCR::Instance::instanceId_t instanceId)
 
virtual void finalize ()=0
 
virtual void abort (int errorCode)=0
 
virtual HiCR::Instance::instanceId_t getRootInstanceId () const =0
 

Protected Member Functions

virtual std::shared_ptr< HiCR::InstancecreateInstanceImpl (const HiCR::InstanceTemplate instanceTemplate)
 
virtual std::shared_ptr< HiCR::InstanceaddInstanceImpl (HiCR::Instance::instanceId_t instanceId)
 
virtual void terminateInstanceImpl (const std::shared_ptr< HiCR::Instance > instance)
 
__INLINE__ void setCurrentInstance (const std::shared_ptr< HiCR::Instance > &instance)
 
__INLINE__ void addInstance (const std::shared_ptr< HiCR::Instance > &instance)
 

Detailed Description

Encapsulates a HiCR Backend Instance Manager.

Backends need to fulfill the abstract virtual functions described here, so that HiCR can detect/create/communicate with other HiCR instances

Member Typedef Documentation

◆ instanceList_t

using HiCR::InstanceManager::instanceList_t = std::vector<std::shared_ptr<HiCR::Instance> >

Type definition for an unsorted set of unique pointers to the detected instances

◆ RPCFunction_t

using HiCR::InstanceManager::RPCFunction_t = std::function<void()>

Type definition for a function that can be executed as RPC

◆ RPCTargetIndex_t

Type definition for an index for a listenable unit.

Constructor & Destructor Documentation

◆ InstanceManager()

HiCR::InstanceManager::InstanceManager ( )
default

Default constructor is deleted, this class requires the passing of a memory manager

◆ ~InstanceManager()

virtual HiCR::InstanceManager::~InstanceManager ( )
virtualdefault

Member Function Documentation

◆ abort()

virtual void HiCR::InstanceManager::abort ( int  errorCode)
pure virtual

This function calls the internal implementation of the abort procedure for the given instance manager

Parameters
[in]errorCodeThe error code to publish upon aborting execution

Implemented in HiCR::backend::hwloc::InstanceManager, and HiCR::backend::mpi::InstanceManager.

◆ addInstance() [1/2]

__INLINE__ void HiCR::InstanceManager::addInstance ( const std::shared_ptr< HiCR::Instance > &  instance)
inlineprotected

Add a new instance to the manager scope

Parameters
[in]instanceThe instance to add

◆ addInstance() [2/2]

__INLINE__ void HiCR::InstanceManager::addInstance ( HiCR::Instance::instanceId_t  instanceId)
inline

Function to add a new instance to the set of instances tracked by the instance manager.

Parameters
[in]instanceIdthe id of the instance

◆ addInstanceImpl()

virtual std::shared_ptr< HiCR::Instance > HiCR::InstanceManager::addInstanceImpl ( HiCR::Instance::instanceId_t  instanceId)
inlineprotectedvirtual

Backend-specific implementation of the addInstance function

Parameters
[in]instanceIdthe id of the instance
Returns
A pointer to the backend-specific instance

◆ createInstance()

__INLINE__ std::shared_ptr< HiCR::Instance > HiCR::InstanceManager::createInstance ( const HiCR::InstanceTemplate  instanceTemplate)
inline

Function to create a new HiCR instance

Parameters
[in]instanceTemplateThe HiCR instance template to try to obtain in the new instance
Returns
A pointer to the newly created instance (if successful), a null pointer otherwise.

◆ createInstanceImpl()

virtual std::shared_ptr< HiCR::Instance > HiCR::InstanceManager::createInstanceImpl ( const HiCR::InstanceTemplate  instanceTemplate)
inlineprotectedvirtual

Backend-specific implementation of the createInstance function

Parameters
[in]instanceTemplateThe HiCR instance template to try to obtain in the new instance
Returns
A pointer to the newly created instance (if successful), a null pointer otherwise.

◆ createInstanceTemplate()

__INLINE__ std::shared_ptr< HiCR::InstanceTemplate > HiCR::InstanceManager::createInstanceTemplate ( const HiCR::Topology requestedTopology = HiCR::Topology())
inline

Function to create new instance template

Parameters
[in]requestedTopologyThe HiCR topology to try to obtain in the new instance
Returns
A pointer to the newly created instance template

◆ finalize()

virtual void HiCR::InstanceManager::finalize ( )
pure virtual

This function calls the internal implementation of the finalization procedure for the given instance manager

Implemented in HiCR::backend::hwloc::InstanceManager, and HiCR::backend::mpi::InstanceManager.

◆ getCurrentInstance()

__INLINE__ std::shared_ptr< HiCR::Instance > HiCR::InstanceManager::getCurrentInstance ( ) const
inline

Function to retrieve the currently executing instance

Returns
A pointer to the local HiCR instance (in other words, the one running this function)

◆ getInstances()

__INLINE__ instanceList_t & HiCR::InstanceManager::getInstances ( )
inline

This function prompts the backend to perform the necessary steps to discover and list the currently created (active or not)

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

◆ getRootInstanceId()

virtual HiCR::Instance::instanceId_t HiCR::InstanceManager::getRootInstanceId ( ) const
pure virtual

Returns the id of the backend's root instance id

Returns
The id of the root instance id

Implemented in HiCR::backend::hwloc::InstanceManager, and HiCR::backend::mpi::InstanceManager.

◆ setCurrentInstance()

__INLINE__ void HiCR::InstanceManager::setCurrentInstance ( const std::shared_ptr< HiCR::Instance > &  instance)
inlineprotected

Set the current instance

Parameters
[in]instanceThe instance to set as current instance

◆ terminateInstance()

__INLINE__ void HiCR::InstanceManager::terminateInstance ( const std::shared_ptr< HiCR::Instance instance)
inline

Function to terminate a given instance

Parameters
[in]instanceThe HiCR instance to terminate

◆ terminateInstanceImpl()

virtual void HiCR::InstanceManager::terminateInstanceImpl ( const std::shared_ptr< HiCR::Instance instance)
inlineprotectedvirtual

Backend-specific implementation of the terminate function

Parameters
[in]instanceThe HiCR instance to terminate

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