geopm  3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
Public Member Functions | Static Public Member Functions | List of all members
geopm::Profile Class Referenceabstract

Enables application profiling and application feedback to the control algorithm. More...

#include <Profile.hpp>

Inheritance diagram for geopm::Profile:
Inheritance graph
[legend]

Public Member Functions

 Profile ()=default
 
virtual ~Profile ()=default
 
virtual uint64_t region (const std::string &region_name, long hint)=0
 Register a region of code to be profiled. More...
 
virtual void enter (uint64_t region_id)=0
 Mark a region entry point. More...
 
virtual void exit (uint64_t region_id)=0
 Mark a region exit point. More...
 
virtual void epoch (void)=0
 Signal pass through outer loop. More...
 
virtual void shutdown (void)=0
 
virtual void thread_init (uint32_t num_work_unit)=0
 Update the total work for all CPUs. This method should be called by one thread in the same parallel region with the total work units expected to be completed by the entire group. More...
 
virtual void thread_post (int cpu)=0
 Mark one unit of work completed by the thread on this CPU. More...
 
virtual std::vector< std::string > region_names (void)=0
 
virtual void reset_cpu_set (void)=0
 
virtual void overhead (double overhead_sec)=0
 
virtual void connect (void)=0
 

Static Public Member Functions

static Profiledefault_profile (void)
 
static int get_cpu (void)
 Returns the Linux logical CPU index that the calling thread is executing on, and caches the result to be used in future calls. This method should be used by callers to report the correct CPU to thread_init() and thread_post(). More...
 

Detailed Description

Enables application profiling and application feedback to the control algorithm.

The information gathered by the Profile class identifies regions of code, progress within regions, and global synchronization points in the application. Regions of code define periods in the application during which control parameters are tuned with the expectation that control parameters for a region can be optimized independently of other regions. In this way a region is associated with a set of control parameters which can be optimized, and future time intervals associated with the same region will benefit from the application of control parameters which were determined from tuning within previous occurrences of the region. There are two competing motivations for defining a region within the application. The first is to identify a section of code that has distinct compute, memory, or network characteristics. The second is to avoid defining these regions such that they are nested within each other, as nested regions are ignored and only the outer most region is used for tuning when nesting occurs. Identifying progress within a region can be used to alleviate load imbalance in the application under the assumption that the region is bulk synchronous. Under the assumption that the application employs an iterative algorithm which synchronizes periodically the user can alleviate load imbalance on larger time scales than the regions provide. This is done by marking the end of the outer most loop, or the "epoch."

The Profile class is the C++ implementation of the computational application side interface to the GEOPM profiler. The class methods support the C interface defined for use with the geopm_prof_c structure and are named accordingly. The geopm_prof_c structure is an opaque reference to the Profile class.

Constructor & Destructor Documentation

◆ Profile()

geopm::Profile::Profile ( )
default

◆ ~Profile()

virtual geopm::Profile::~Profile ( )
virtualdefault

Member Function Documentation

◆ connect()

virtual void geopm::Profile::connect ( void  )
pure virtual

Implemented in geopm::ProfileImp.

◆ default_profile()

Profile & geopm::Profile::default_profile ( void  )
static

◆ enter()

virtual void geopm::Profile::enter ( uint64_t  region_id)
pure virtual

Mark a region entry point.

Called to denote the beginning of region of code that was assigned the region_id when it was registered. Nesting of regions is not supported: calls to this method from within a region previously entered but not yet exited are silently ignored.

Parameters
[in]region_idThe identifier returned by Profile::region() when the region was registered.

Implemented in geopm::ProfileImp.

◆ epoch()

virtual void geopm::Profile::epoch ( void  )
pure virtual

Signal pass through outer loop.

Called once for each pass through the outer most computational loop executed by the application. This function call should occur exactly once in the application source at the beginning of the loop that encapsulates the primary computational region of the application.

Implemented in geopm::ProfileImp.

◆ exit()

virtual void geopm::Profile::exit ( uint64_t  region_id)
pure virtual

Mark a region exit point.

Called to denote the end of a region of code that was assigned the region_id when it was registered. Nesting of regions is not supported: calls to this method that are not exiting from the oldest unclosed entry point with the same region_id are silently ignored.

Parameters
[in]region_idThe identifier returned by Profile::region() when the region was registered.

Implemented in geopm::ProfileImp.

◆ get_cpu()

int geopm::Profile::get_cpu ( void  )
static

Returns the Linux logical CPU index that the calling thread is executing on, and caches the result to be used in future calls. This method should be used by callers to report the correct CPU to thread_init() and thread_post().

◆ overhead()

virtual void geopm::Profile::overhead ( double  overhead_sec)
pure virtual

Implemented in geopm::ProfileImp.

◆ region()

virtual uint64_t geopm::Profile::region ( const std::string &  region_name,
long  hint 
)
pure virtual

Register a region of code to be profiled.

The statistics gathered for each region are aggregated in the final report, and the power policy will be determined distinctly for each region. The registration of a region is idempotent, and the first call will have more overhead than subsequent attempts to re-register the same region.

Parameters
[in]region_nameUnique name that identifies the region being profiled. This name will be printed next to the region statistics in the report.
[in]hintValue from the #geopm_hint_e structure which is used to derive a starting policy before the application has been profiled.
Returns
Returns the region_id which is a unique identifier derived from the region_name. This value is passed to Profile::enter() and Profile::exit() to associate these calls with the registered region.

Implemented in geopm::ProfileImp.

◆ region_names()

virtual std::vector<std::string> geopm::Profile::region_names ( void  )
pure virtual

Implemented in geopm::ProfileImp.

◆ reset_cpu_set()

virtual void geopm::Profile::reset_cpu_set ( void  )
pure virtual

Implemented in geopm::ProfileImp.

◆ shutdown()

virtual void geopm::Profile::shutdown ( void  )
pure virtual

Implemented in geopm::ProfileImp.

◆ thread_init()

virtual void geopm::Profile::thread_init ( uint32_t  num_work_unit)
pure virtual

Update the total work for all CPUs. This method should be called by one thread in the same parallel region with the total work units expected to be completed by the entire group.

Parameters
[in]num_work_unitThe total work units for all threads in the same parallel region.

Implemented in geopm::ProfileImp.

◆ thread_post()

virtual void geopm::Profile::thread_post ( int  cpu)
pure virtual

Mark one unit of work completed by the thread on this CPU.

Parameters
[in]cpuThe Linux logical CPU obtained with get_cpu().

Implemented in geopm::ProfileImp.


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