class
#include <src/taskflow/cuda/cuda_stream.hpp>
cudaScopedPerThreadEvent class that provides RAII-styled guard of event acquisition
Contents
Sample usage:
{ tf::cudaScopedPerThreadEvent event(1); // acquires a event on device 1 // use event as a normal cuda event (cudaEvent_t) cudaStreamWaitEvent(stream, event); } // leaving the scope releases the event back to the pool on device 1
The scoped per-thread event is primarily used by tf::
cudaScopedPerThreadEvent is non-copyable.
Constructors, destructors, conversion operators
- cudaScopedPerThreadEvent(int device) explicit
- constructs a scoped event under the given device
- cudaScopedPerThreadEvent()
- constructs a scoped event under the current device.
- ~cudaScopedPerThreadEvent()
- destructs the scoped event guard
- operator cudaEvent_t() const
- implicit conversion to the native CUDA event (cudaEvent_t)
- cudaScopedPerThreadEvent(const cudaScopedPerThreadEvent&) deleted
- disabled copy constructor
- cudaScopedPerThreadEvent(cudaScopedPerThreadEvent&&) defaulted
- default move constructor
Public functions
- auto operator=(const cudaScopedPerThreadEvent&) -> cudaScopedPerThreadEvent& deleted
- disabled copy assignment
- auto operator=(cudaScopedPerThreadEvent&&) -> cudaScopedPerThreadEvent& deleted
- default move assignment
Function documentation
tf:: cudaScopedPerThreadEvent:: cudaScopedPerThreadEvent(int device) explicit
constructs a scoped event under the given device
Parameters | |
---|---|
device | device context of the requested event |
The constructor acquires a event from a per-thread event pool.
tf:: cudaScopedPerThreadEvent:: cudaScopedPerThreadEvent()
constructs a scoped event under the current device.
The constructor acquires a event from a per-thread event pool.
tf:: cudaScopedPerThreadEvent:: ~cudaScopedPerThreadEvent()
destructs the scoped event guard
The destructor releases the event to the per-thread event pool.