Skip to content

Introduce Asynchronous and device independent timer

Haocheng LIU requested to merge haocheng.liu/vtk-m:asynchronize-timer into master

This commit refactors the timer to be asynchronous and device independent. Now it's using an similiar API as vtkOpenGLRenderTimer with Start, Stop, Reset, Ready, and GetElapsedTime function.

Bascially it can be used in two modes:

  • Create a Timer without any device info. vtkm::cont::Timer time;

    • It would enable timers for all enabled devices on the machine. Users can get a specific elapsed time by passing a device id into the GetElapsedtime function. If no device is provided, it would pick the maximum of all timer results - the logic behind this decision is that if cuda is disabled, openmp, serial and tbb roughly give the same results; if cuda is enabled it's safe to return the maximum elapsed time since users are more interested in the device execution time rather than the kernal launch time. The Ready function can be handy here to query the status of the timer.
  • Create a Timer with a device id. vtkm::cont::Timer time((vtkm::cont::DeviceAdapterTagCuda()));

    • It works as the old timer that times for a specific device id.

close #296 (closed)

Edited by Haocheng LIU

Merge request reports