39 #ifndef ECUDA_EVENT_HPP
40 #define ECUDA_EVENT_HPP
85 event() { cudaEventCreate(&_event); }
100 event(
unsigned flags ) { cudaEventCreateWithFlags(&_event,flags); }
123 inline void record( cudaStream_t stream = 0 ) { cudaEventRecord( _event, stream ); }
139 inline cudaError_t
synchronize() {
return cudaEventSynchronize( _event ); }
153 inline cudaError_t
query() {
return cudaEventQuery( _event ); }
175 cudaEventElapsedTime( &t, start._event, end._event );
Encapsulates CUDA API event objects and functions.
event()
Default constructor.
static float elapsed_time(event &start, event &end)
Computes the elapsed time between two events (in milliseconds with a resolution of around 0...
float operator-(event &other)
Computes the elapsed time between another event and this event.
void record(cudaStream_t stream=0)
Records an event.
cudaError_t synchronize()
Wait until the completion of all device work preceding the most recent call to record().
event(unsigned flags)
Constructs an event with the given flags.
cudaError_t query()
Query the status of all device work preceding the most recent call to record().