5#ifndef GKO_PUBLIC_CORE_BASE_TIMER_HPP_
6#define GKO_PUBLIC_CORE_BASE_TIMER_HPP_
11#include <ginkgo/core/base/executor.hpp>
24 time_point(time_point&&);
26 time_point& operator=(time_point&&);
28 time_point(
const time_point&) =
delete;
30 time_point& operator=(
const time_point&) =
delete;
36 friend class CpuTimer;
37 friend class CudaTimer;
38 friend class HipTimer;
39 friend class DpcppTimer;
55 CUevent_st* cuda_event;
56 GKO_HIP_EVENT_STRUCT* hip_event;
57 sycl::event* dpcpp_event;
58 std::chrono::steady_clock::time_point chrono;
82 virtual ~Timer() =
default;
137 std::shared_ptr<const Executor> exec);
141 virtual void init_time_point(
time_point& time) = 0;
156 void init_time_point(
time_point& time)
override;
175 CudaTimer(std::shared_ptr<const CudaExecutor> exec);
178 void init_time_point(
time_point& time)
override;
182 CUstream_st* stream_;
201 HipTimer(std::shared_ptr<const HipExecutor> exec);
204 void init_time_point(
time_point& time)
override;
208 GKO_HIP_STREAM_STRUCT* stream_;
222 DpcppTimer(std::shared_ptr<const DpcppExecutor> exec);
225 void init_time_point(
time_point& time)
override;
A timer using std::chrono::steady_clock for timing.
Definition timer.hpp:146
std::chrono::nanoseconds difference_async(const time_point &start, const time_point &stop) override
Computes the difference between the two time points in nanoseconds.
void wait(time_point &time) override
Waits until all kernels in-process when recording the time point are finished.
void record(time_point &time) override
Records a time point at the current time.
void wait(time_point &time) override
Waits until all kernels in-process when recording the time point are finished.
std::chrono::nanoseconds difference_async(const time_point &start, const time_point &stop) override
Computes the difference between the two time points in nanoseconds.
void record(time_point &time) override
Records a time point at the current time.
void record(time_point &time) override
Records a time point at the current time.
std::chrono::nanoseconds difference_async(const time_point &start, const time_point &stop) override
Computes the difference between the two time points in nanoseconds.
void wait(time_point &time) override
Waits until all kernels in-process when recording the time point are finished.
void wait(time_point &time) override
Waits until all kernels in-process when recording the time point are finished.
std::chrono::nanoseconds difference_async(const time_point &start, const time_point &stop) override
Computes the difference between the two time points in nanoseconds.
void record(time_point &time) override
Records a time point at the current time.
Represents a generic timer that can be used to record time points and measure time differences on hos...
Definition timer.hpp:80
std::chrono::nanoseconds difference(time_point &start, time_point &stop)
Computes the difference between the two time points in nanoseconds.
time_point create_time_point()
Returns a newly created time point.
virtual void wait(time_point &time)=0
Waits until all kernels in-process when recording the time point are finished.
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.
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.
virtual void record(time_point &time)=0
Records a time point at the current time.
An opaque wrapper for a time point generated by a timer.
Definition timer.hpp:20
The Stopping criterion namespace.
Definition logger.hpp:52
The Ginkgo namespace.
Definition abstract_factory.hpp:20