ExecutionState Class Reference

HiCR: HiCR::ExecutionState Class Reference
HiCR
HiCR::ExecutionState Class Referenceabstract

#include <executionState.hpp>

Inheritance diagram for HiCR::ExecutionState:
HiCR::backend::ascend::ExecutionState HiCR::backend::boost::ExecutionState HiCR::backend::nosv::ExecutionState HiCR::backend::opencl::ExecutionState HiCR::backend::pthreads::ExecutionState

Public Types

enum  state_t {
  uninitialized , initialized , running , suspended ,
  finished
}
 

Public Member Functions

__INLINE__ void resume ()
 
__INLINE__ void suspend ()
 
__INLINE__ bool checkFinalization ()
 
__INLINE__ state_t getState ()
 
 ExecutionState ()=delete
 
virtual ~ExecutionState ()=default
 

Protected Member Functions

 ExecutionState (const std::shared_ptr< HiCR::ExecutionUnit > &executionUnit)
 
virtual void resumeImpl ()=0
 
virtual void suspendImpl ()=0
 
virtual bool checkFinalizationImpl ()=0
 

Detailed Description

This class is an abstract representation of the lifetime of an execution unit. It exposes initialization, suspension and resume functionalities that should (ideally) be implemented for all execution/processing unit combinations.

Member Enumeration Documentation

◆ state_t

Complete state set that a task can be in

Enumerator
uninitialized 

Internal state not yet allocated

initialized 

Ready to run (internal state created)

running 

Indicates that the task is currently running

suspended 

Set by the task if it suspends for an asynchronous operation

finished 

Set by the task upon complete termination

Constructor & Destructor Documentation

◆ ExecutionState() [1/2]

HiCR::ExecutionState::ExecutionState ( )
delete

Default constructor is deleted to prevent instantiation without proper arguments

◆ ~ExecutionState()

virtual HiCR::ExecutionState::~ExecutionState ( )
virtualdefault

◆ ExecutionState() [2/2]

HiCR::ExecutionState::ExecutionState ( const std::shared_ptr< HiCR::ExecutionUnit > &  executionUnit)
inlineprotected

To save memory, the initialization of execution states (i.e., allocation of required structures) is deferred until this function is called.

Parameters
[in]executionUnitRepresents a replicable executable unit (e.g., function, kernel) to execute

Member Function Documentation

◆ checkFinalization()

__INLINE__ bool HiCR::ExecutionState::checkFinalization ( )
inline

Actively check for the finalization of an initialized execution state

Returns
True, if the execution has finalized; False, otherwise.

◆ checkFinalizationImpl()

virtual bool HiCR::ExecutionState::checkFinalizationImpl ( )
protectedpure virtual

Backend-specific implementation of the checkFinalization function

Returns
True, if the execution has finalized; False, otherwise.

Implemented in HiCR::backend::ascend::ExecutionState, HiCR::backend::boost::ExecutionState, HiCR::backend::nosv::ExecutionState, HiCR::backend::opencl::ExecutionState, and HiCR::backend::pthreads::ExecutionState.

◆ getState()

__INLINE__ state_t HiCR::ExecutionState::getState ( )
inline

Returns the current state of the execution

Returns
The current execution state

◆ resume()

__INLINE__ void HiCR::ExecutionState::resume ( )
inline

Starts a newly initialized execution states or resumes a suspended one

◆ resumeImpl()

virtual void HiCR::ExecutionState::resumeImpl ( )
protectedpure virtual

◆ suspend()

__INLINE__ void HiCR::ExecutionState::suspend ( )
inline

Suspends the execution of a running execution state

◆ suspendImpl()

virtual void HiCR::ExecutionState::suspendImpl ( )
protectedpure virtual

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