Ginkgo
Generated from pipelines/1589998975 branch based on develop. Ginkgo version 1.10.0
A numerical linear algebra library targeting many-core architectures
|
Represents a generic timer that can be used to record time points and measure time differences on host or device streams. More...
#include <ginkgo/core/base/timer.hpp>
Public Member Functions | |
time_point | create_time_point () |
Returns a newly created time point. More... | |
virtual void | record (time_point &time)=0 |
Records a time point at the current time. | |
virtual void | wait (time_point &time)=0 |
Waits until all kernels in-process when recording the time point are finished. | |
std::chrono::nanoseconds | difference (time_point &start, time_point &stop) |
Computes the difference between the two time points in nanoseconds. More... | |
virtual std::chrono::nanoseconds | difference_async (const time_point &start, const time_point &stop)=0 |
Computes the difference between the two time points in nanoseconds. More... | |
Static Public Member Functions | |
static std::unique_ptr< Timer > | create_for_executor (std::shared_ptr< const Executor > exec) |
Creates the timer type most suitable for recording accurate timings of kernels on the given executor. More... | |
Represents a generic timer that can be used to record time points and measure time differences on host or device streams.
To keep the runtime overhead of timing minimal, time points need to be allocated beforehand using Timer::create_time_point:
|
static |
Creates the timer type most suitable for recording accurate timings of kernels on the given executor.
exec | the executor to create a Timer for |
time_point gko::Timer::create_time_point | ( | ) |
Returns a newly created time point.
Time points may only be used with the timer they were created with.
std::chrono::nanoseconds gko::Timer::difference | ( | time_point & | start, |
time_point & | stop | ||
) |
Computes the difference between the two time points in nanoseconds.
The function synchronizes with stop
before computing the difference.
start | the first time point (earlier) |
end | the second time point (later) |
|
pure virtual |
Computes the difference between the two time points in nanoseconds.
This asynchronous version does not synchronize itself, so the time points need to have been synchronized with, i.e. timer->wait(stop)
needs to have been called. The version is intended for more advanced users who want to measure the overhead of timing functionality separately.
start | the first time point (earlier) |
end | the second time point (later) |
Implemented in gko::DpcppTimer, gko::HipTimer, gko::CudaTimer, and gko::CpuTimer.