Skip to content

YAKL Timers

Matt Norman edited this page Dec 11, 2021 · 9 revisions

YAKL includes performance timers based on the General Purpose Timing Library (GPTL) by Jim Rosinski (https://github.com/jmrosinski/GPTL). To use timers, simple place these calls around the code you want to time:

yakl::timer_start("mylabel")
...
yakl::timer_stop("mylabel")

YAKL handles the initialization and output internally, but you do have to pass -DYAKL_PROFILE as a command line argument. At the end of the run, the timer data is printed to stdout, and it is written to a file yakl_timer_output.txt. GPTL automatically keeps track of nested timer calls and gives easy to read output that gives the total walltime as well as the min and max walltime among the calls.

To make profiling easier, you can also pass -DYAKL_AUTO_PROFILE, and YAKL will wrap GPTL timer calls around every named parallel_for call in the code. Since calls without string labels wouldn't be very informative in a set of timers, those are not included.

Important: All timer calls involve an fence() operation to ensure GPU kernels are accurately timed. This can add significant overhead to latency-sensitive (small-workload) applications. Also, if you do not specify either -DYAKL_PROFILE or -DYAKL_AUTO_PROFILE, then all timer calls will become no-ops.

Clone this wiki locally