Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
GpuRegionTimerWrapper< GpuRegionTimerImpl > Class Template Reference

#include <gromacs/gpu_utils/gpuregiontimer.h>

Description

template<typename GpuRegionTimerImpl>
class GpuRegionTimerWrapper< GpuRegionTimerImpl >

This is a GPU region timing wrapper class. It allows for host-side tracking of the accumulated execution timespans in GPU code (measuring kernel or transfers duration). It also partially tracks the correctness of the timer state transitions, as far as current implementation allows (see TODO in getLastRangeTime() for a disabled check). Internally it uses GpuRegionTimerImpl for measuring regions.

Public Member Functions

void openTimingRegion (const DeviceStream &deviceStream)
 To be called before the region start. More...
 
void closeTimingRegion (const DeviceStream &deviceStream)
 To be called after the region end. More...
 
double getLastRangeTime ()
 Accumulates the last timespan of all the events used into the total duration, and resets the internal timer state. To be called after closeTimingRegion() and the command stream of the event having been synchronized. More...
 
void reset ()
 Resets the implementation and total time/call count to zeroes.
 
double getTotalTime () const
 Gets total time recorded (in milliseconds).
 
unsigned int getCallCount () const
 Gets total call count recorded.
 
CommandEventfetchNextEvent ()
 Gets a pointer to a new timing event for passing into individual GPU API calls within the region if they require it (e.g. on OpenCL). More...
 

Member Function Documentation

template<typename GpuRegionTimerImpl >
void GpuRegionTimerWrapper< GpuRegionTimerImpl >::closeTimingRegion ( const DeviceStream deviceStream)
inline

To be called after the region end.

Parameters
[in]deviceStreamThe GPU command stream where the event being measured takes place.
template<typename GpuRegionTimerImpl >
CommandEvent* GpuRegionTimerWrapper< GpuRegionTimerImpl >::fetchNextEvent ( )
inline

Gets a pointer to a new timing event for passing into individual GPU API calls within the region if they require it (e.g. on OpenCL).

Returns
The pointer to the underlying single command timing event.
template<typename GpuRegionTimerImpl >
double GpuRegionTimerWrapper< GpuRegionTimerImpl >::getLastRangeTime ( )
inline

Accumulates the last timespan of all the events used into the total duration, and resets the internal timer state. To be called after closeTimingRegion() and the command stream of the event having been synchronized.

Returns
The last timespan (in milliseconds).
template<typename GpuRegionTimerImpl >
void GpuRegionTimerWrapper< GpuRegionTimerImpl >::openTimingRegion ( const DeviceStream deviceStream)
inline

To be called before the region start.

Parameters
[in]deviceStreamThe GPU command stream where the event being measured takes place.

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