ComputeManager Class Reference

HiCR: HiCR::backend::nosv::ComputeManager Class Reference
HiCR

#include <computeManager.hpp>

Inheritance diagram for HiCR::backend::nosv::ComputeManager:
HiCR::ComputeManager

Public Member Functions

__INLINE__ std::unique_ptr< HiCR::ProcessingUnitcreateProcessingUnit (std::shared_ptr< HiCR::ComputeResource > computeResource) const override
 
__INLINE__ std::unique_ptr< HiCR::ExecutionStatecreateExecutionState (std::shared_ptr< HiCR::ExecutionUnit > executionUnit, void *const argument=nullptr) const override
 
- Public Member Functions inherited from HiCR::ComputeManager
virtual ~ComputeManager ()=default
 
virtual std::unique_ptr< HiCR::ExecutionStatecreateExecutionState (std::shared_ptr< HiCR::ExecutionUnit > executionUnit, void *const argument=nullptr) const =0
 
__INLINE__ void initialize (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit)
 
__INLINE__ void start (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit, std::unique_ptr< HiCR::ExecutionState > &executionState)
 
__INLINE__ void suspend (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit)
 
__INLINE__ void resume (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit)
 
__INLINE__ void terminate (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit)
 
__INLINE__ void await (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit)
 

Static Public Member Functions

static __INLINE__ std::shared_ptr< HiCR::ExecutionUnitcreateExecutionUnit (const std::function< void(void *)> &executionUnit)
 

Protected Member Functions

__INLINE__ void initializeImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit) override
 
__INLINE__ void startImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit, std::unique_ptr< HiCR::ExecutionState > &executionState) override
 
__INLINE__ void suspendImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit) override
 
__INLINE__ void resumeImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit) override
 
__INLINE__ void terminateImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit) override
 
__INLINE__ void awaitImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit) override
 
__INLINE__ nosv::ProcessingUnitgetPUPointer (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit)
 
- Protected Member Functions inherited from HiCR::ComputeManager
virtual void initializeImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit)=0
 
virtual void startImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit, std::unique_ptr< HiCR::ExecutionState > &executionState)=0
 
virtual void suspendImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit)=0
 
virtual void resumeImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit)=0
 
virtual void terminateImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit)=0
 
virtual void awaitImpl (std::unique_ptr< HiCR::ProcessingUnit > &processingUnit)=0
 

Detailed Description

This class represents an abstract definition of a compute manager. That is, the set of functions to be implemented by a given backend that allows the discovery of compute resources, the definition of replicable execution units (functions or kernels to run), and the instantiation of execution states, that represent the execution lifetime of an execution unit.

Member Function Documentation

◆ awaitImpl()

__INLINE__ void HiCR::backend::nosv::ComputeManager::awaitImpl ( std::unique_ptr< HiCR::ProcessingUnit > &  processingUnit)
inlineoverrideprotected

Internal implementation of the await function

Parameters
[in]processingUnitThe processing to wait for

◆ createExecutionState()

__INLINE__ std::unique_ptr< HiCR::ExecutionState > HiCR::backend::nosv::ComputeManager::createExecutionState ( std::shared_ptr< HiCR::ExecutionUnit executionUnit,
void *const  argument = nullptr 
) const
inlineoverride

This function enables the creation of an empty execution state object.

The instantiation of its internal memory structures is delayed until explicit initialization to reduce memory usage when, for example, scheduling many tasks that do not need to execute at the same time.

Parameters
[in]executionUnitThe replicable state-less execution unit to instantiate into an execution state
[in]argumentArgument (closure) to pass to the execution unit to make this execution state unique
Returns
A unique pointer to the newly create execution state. It needs to be unique because the state cannot be simultaneously executed my multiple processing units

◆ createExecutionUnit()

static __INLINE__ std::shared_ptr< HiCR::ExecutionUnit > HiCR::backend::nosv::ComputeManager::createExecutionUnit ( const std::function< void(void *)> &  executionUnit)
inlinestatic

This function enables the creation of an execution unit.

Its default constructor takes a simple replicable CPU-executable function

Parameters
[in]executionUnitThe replicable function to execute
Returns
The newly created execution unit

◆ createProcessingUnit()

__INLINE__ std::unique_ptr< HiCR::ProcessingUnit > HiCR::backend::nosv::ComputeManager::createProcessingUnit ( std::shared_ptr< HiCR::ComputeResource computeResource) const
inlineoverridevirtual

Creates a new processing unit from the provided compute resource

Parameters
[in]computeResourceThis is the identifier of the compute resource to use to instantiate into a processing unit. The identifier should be one of those provided by the backend. Providing an arbitrary identifier may lead to unexpected behavior.
Returns
A unique pointer to the newly created processing unit. It is important to preserve the uniqueness of this object, since it represents a physical resource (e.g., core) and we do not want to assign it to multiple workers.

Implements HiCR::ComputeManager.

◆ getPUPointer()

__INLINE__ nosv::ProcessingUnit * HiCR::backend::nosv::ComputeManager::getPUPointer ( std::unique_ptr< HiCR::ProcessingUnit > &  processingUnit)
inlineprotected

Getting the pointer of the casted nOS-V PU one

Parameters
[in]processingUnitThe processing unit casted into the nosv one
Returns
the dynamicly casted pointer of the processingUnit

◆ initializeImpl()

__INLINE__ void HiCR::backend::nosv::ComputeManager::initializeImpl ( std::unique_ptr< HiCR::ProcessingUnit > &  processingUnit)
inlineoverrideprotected

Backend-specific implementation of the initialize function

Parameters
[in]processingUnitThe processing unit to initialize

◆ resumeImpl()

__INLINE__ void HiCR::backend::nosv::ComputeManager::resumeImpl ( std::unique_ptr< HiCR::ProcessingUnit > &  processingUnit)
inlineoverrideprotected

Internal implementation of the resume function

Parameters
[in]processingUnitThe processing unit to resume

◆ startImpl()

__INLINE__ void HiCR::backend::nosv::ComputeManager::startImpl ( std::unique_ptr< HiCR::ProcessingUnit > &  processingUnit,
std::unique_ptr< HiCR::ExecutionState > &  executionState 
)
inlineoverrideprotected

Internal implmentation of the start function

Parameters
[in]processingUnitThe processing unit to initiate computation with
[in]executionStateThe execution state to start running with the given processing unit

◆ suspendImpl()

__INLINE__ void HiCR::backend::nosv::ComputeManager::suspendImpl ( std::unique_ptr< HiCR::ProcessingUnit > &  processingUnit)
inlineoverrideprotected

Internal implementation of the suspend function

Parameters
[in]processingUnitThe processing unit to suspend

◆ terminateImpl()

__INLINE__ void HiCR::backend::nosv::ComputeManager::terminateImpl ( std::unique_ptr< HiCR::ProcessingUnit > &  processingUnit)
inlineoverrideprotected

Internal implementation of the terminate function

Parameters
[in]processingUnitThe processing unit to terminate

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