RPCEngine Class Reference

HiCR: HiCR::frontend::RPCEngine Class Reference
HiCR
HiCR::frontend::RPCEngine Class Reference

#include <RPCEngine.hpp>

Public Types

using RPCTargetIndex_t = uint64_t
 

Public Member Functions

 RPCEngine (CommunicationManager &communicationManager, InstanceManager &instanceManager, MemoryManager &memoryManager, ComputeManager &computeManager, std::shared_ptr< MemorySpace > bufferMemorySpace, std::shared_ptr< ComputeResource > computeResource, const uint64_t baseTag=_HICR_RPC_ENGINE_CHANNEL_BASE_TAG)
 
__INLINE__ void initialize ()
 
 ~RPCEngine ()=default
 
__INLINE__ void addRPCTarget (const std::string &RPCName, const std::shared_ptr< HiCR::ExecutionUnit > e)
 
__INLINE__ bool hasPendingRPCs ()
 
__INLINE__ void listen ()
 
__INLINE__ std::shared_ptr< HiCR::InstancegetRPCRequester ()
 
virtual void requestRPC (HiCR::Instance &instance, const std::string &RPCName)
 
__INLINE__ void submitReturnValue (void *pointer, const size_t size)
 
__INLINE__ std::shared_ptr< HiCR::LocalMemorySlotgetReturnValue (HiCR::Instance &instance) const
 
__INLINE__ HiCR::CommunicationManagergetCommunicationManager () const
 
__INLINE__ HiCR::InstanceManagergetInstanceManager () const
 
__INLINE__ HiCR::MemoryManagergetMemoryManager () const
 
__INLINE__ HiCR::ComputeManagergetComputeManager () const
 

Detailed Description

This class encapsulates the HICR-based logic for sending, listening to, and executing remote procedure calls among HiCR distances. An RPC request is represented by a single 64-bit identifier. The requester simply sends this identifier to the receiver instance. Incoming requests are stored in a channel, ready to be picked up by the receiver. To pick up a request, the receiver must enter the listening state. For an RPC to execute, the listener must have registered the corresponding index, together with an associated listenable unit to run. The listenable unit is described as a HiCR execution unit object.

Member Typedef Documentation

◆ RPCTargetIndex_t

Type definition for an index for a listenable unit.

Constructor & Destructor Documentation

◆ RPCEngine()

HiCR::frontend::RPCEngine::RPCEngine ( CommunicationManager communicationManager,
InstanceManager instanceManager,
MemoryManager memoryManager,
ComputeManager computeManager,
std::shared_ptr< MemorySpace bufferMemorySpace,
std::shared_ptr< ComputeResource computeResource,
const uint64_t  baseTag = _HICR_RPC_ENGINE_CHANNEL_BASE_TAG 
)
inline

Constructor

Parameters
[in]communicationManagerThe communication manager to use to communicate with other instances
[in]instanceManagerThe instance manager to use to get information about other instances
[in]memoryManagerThe memory manager to use to allocate buffer memory
[in]computeManagerThe compute manager to use to execute incoming RPCs
[in]bufferMemorySpaceThe memory space where the RPC engine will allocate all of its internal buffer from
[in]computeResourceThe compute resource to use to execute RPCs
[in]baseTagThe tag to use for the creation of channels. Provide different values if you plan to create multiple RPC engines otherwise collisions might occur

◆ ~RPCEngine()

HiCR::frontend::RPCEngine::~RPCEngine ( )
default

Default Destructor

Member Function Documentation

◆ addRPCTarget()

__INLINE__ void HiCR::frontend::RPCEngine::addRPCTarget ( const std::string &  RPCName,
const std::shared_ptr< HiCR::ExecutionUnit e 
)
inline

Function to add an RPC target with a name, and the combination of a execution unit and the processing unit that is in charge of executing it

Parameters
[in]RPCNameName of the RPC to add
[in]eIndicates the execution unit to run when this RPC is triggered

◆ getCommunicationManager()

__INLINE__ HiCR::CommunicationManager * HiCR::frontend::RPCEngine::getCommunicationManager ( ) const
inline

Gets the internal communication manager this module was initialized with

Returns
A pointer to the internal communication manager

◆ getComputeManager()

__INLINE__ HiCR::ComputeManager * HiCR::frontend::RPCEngine::getComputeManager ( ) const
inline

Gets the internal compute manager this module was initialized with

Returns
A pointer to the internal computey manager

◆ getInstanceManager()

__INLINE__ HiCR::InstanceManager * HiCR::frontend::RPCEngine::getInstanceManager ( ) const
inline

Gets the internal instance manager this module was initialized with

Returns
A pointer to the internal instance manager

◆ getMemoryManager()

__INLINE__ HiCR::MemoryManager * HiCR::frontend::RPCEngine::getMemoryManager ( ) const
inline

Gets the internal memory manager this module was initialized with

Returns
A pointer to the internal memory manager

◆ getReturnValue()

__INLINE__ std::shared_ptr< HiCR::LocalMemorySlot > HiCR::frontend::RPCEngine::getReturnValue ( HiCR::Instance instance) const
inline

Function to get a return value from a remote instance that ran an RPC

Parameters
[in]instanceInstance from which to read the return value. An RPC request should be sent to that instance before calling this function.
Returns
A pointer to a newly allocated local memory slot containing the return value

◆ getRPCRequester()

__INLINE__ std::shared_ptr< HiCR::Instance > HiCR::frontend::RPCEngine::getRPCRequester ( )
inline

Function to retrieve a pointer to the instance who has requested the executing RPC

Returns
a pointer to the instance who requested the RPC

◆ hasPendingRPCs()

__INLINE__ bool HiCR::frontend::RPCEngine::hasPendingRPCs ( )
inline

Function to check whether there is a pending RPC to listen to.

Returns
true, if there is a pending RPC; false, otherwise.

◆ initialize()

__INLINE__ void HiCR::frontend::RPCEngine::initialize ( )
inline

Initializes the RPC engine:

  • Creates RPC channels
  • Creates Return value channels

◆ listen()

__INLINE__ void HiCR::frontend::RPCEngine::listen ( )
inline

Function to put the current instance to listen for incoming RPCs

◆ requestRPC()

virtual void HiCR::frontend::RPCEngine::requestRPC ( HiCR::Instance instance,
const std::string &  RPCName 
)
inlinevirtual

Function to request the execution of a remote function in a remote HiCR instance

Parameters
[in]RPCNameThe name of the RPC to run
[in]instanceInstance on which to run the RPC

◆ submitReturnValue()

__INLINE__ void HiCR::frontend::RPCEngine::submitReturnValue ( void *  pointer,
const size_t  size 
)
inline

Function to submit a return value for the currently running RPC

Parameters
[in]pointerPointer to the start of the data buffer to send
[in]sizeSize of the data buffer to send

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