Class CUDAEventTimer

Class Documentation

class util::CUDAEventTimer

Class to simplify the use of CUDAEvents for timing. Timing between CUDAEvent_t is only accurate in the default stream, hence streams cannot be passed.

Todo:

  • this appears unreliable on WDDM devices

- make this device aware (cudaGetDevice, cudaSetDevice)?

Public Functions

inline CUDAEventTimer()

Default constructor, creates the cudaEvents and initialises values.

inline ~CUDAEventTimer()

Destroys the cudaEvents created by this instance

inline void start()

Record the start event, resetting the syncronisation flag.

inline void stop()

Record the stop event, resetting the syncronisation flag.

inline float sync()

Syncrhonize the cudaEvent(s), calcualting the elapsed time in ms between the two events. this is only accurate if used for the default stream (hence streams are not used) Sets the flag indicating syncronisation has occured, and therefore the elapsed time can be queried.

Returns

elapsed time in milliseconds

inline float getElapsedMilliseconds()

Get the elapsed time between the start event being issued and the stop event occuring.

Returns

elapsed time in milliseconds