ProcessingUnit Class Reference

HiCR: HiCR::backend::pthreads::ProcessingUnit Class Reference
HiCR
HiCR::backend::pthreads::ProcessingUnit Class Referencefinal

#include <processingUnit.hpp>

Inheritance diagram for HiCR::backend::pthreads::ProcessingUnit:
HiCR::ProcessingUnit

Public Member Functions

__INLINE__ std::string getType () override
 
__INLINE__ ProcessingUnit (const std::shared_ptr< HiCR::ComputeResource > &computeResource)
 
- Public Member Functions inherited from HiCR::ProcessingUnit
 ProcessingUnit ()=delete
 
__INLINE__ ProcessingUnit (std::shared_ptr< HiCR::ComputeResource > computeResource)
 
virtual ~ProcessingUnit ()=default
 
__INLINE__ ProcessingUnit::state_t getState () const
 
__INLINE__ std::shared_ptr< ComputeResourcegetComputeResource ()
 

Static Public Member Functions

static __INLINE__ void updateAffinity (const std::set< hwloc::ComputeResource::logicalProcessorId_t > &affinity)
 
static __INLINE__ std::set< HiCR::backend::hwloc::ComputeResource::logicalProcessorId_tgetAffinity ()
 

Friends

class HiCR::backend::pthreads::ComputeManager
 

Additional Inherited Members

- Public Types inherited from HiCR::ProcessingUnit
enum  state_t {
  uninitialized , ready , running , suspended ,
  terminating , terminated
}
 

Detailed Description

Implementation of a kernel-level thread as processing unit for the pthreads backend.

This implementation uses Pthreads as backend for the creation and management of OS threads.

Constructor & Destructor Documentation

◆ ProcessingUnit()

__INLINE__ HiCR::backend::pthreads::ProcessingUnit::ProcessingUnit ( const std::shared_ptr< HiCR::ComputeResource > &  computeResource)
inline

Constructor for the ProcessingUnit class

Parameters
computeResourceRepresents the compute resource (core) affinity to associate this processing unit to

Member Function Documentation

◆ getAffinity()

static __INLINE__ std::set< HiCR::backend::hwloc::ComputeResource::logicalProcessorId_t > HiCR::backend::pthreads::ProcessingUnit::getAffinity ( )
inlinestatic

Queries the OS for the currently set affinity for this thread, and prints it to screen.

Returns
The set of cores/processing units that this thread is bound to

◆ getType()

__INLINE__ std::string HiCR::backend::pthreads::ProcessingUnit::getType ( )
inlineoverridevirtual

Gets the processing unit's type

Returns
A string, containing the processing unit's type

Implements HiCR::ProcessingUnit.

◆ updateAffinity()

static __INLINE__ void HiCR::backend::pthreads::ProcessingUnit::updateAffinity ( const std::set< hwloc::ComputeResource::logicalProcessorId_t > &  affinity)
inlinestatic

Sets up new affinity for the thread. The thread needs to yield or be preempted for the new affinity to work.

Parameters
[in]affinityNew affinity to use

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