RAII wrapper for a CUDA event with convenience methods. More...
#include <cuda_event.hpp>
Public Member Functions | |
| CudaEvent (unsigned flags=cudaEventDisableTiming) | |
| Construct a CUDA event. More... | |
| ~CudaEvent () noexcept | |
| Destroy the CUDA event. More... | |
| CudaEvent (CudaEvent const &)=delete | |
| Non-copyable. | |
| CudaEvent & | operator= (CudaEvent const &)=delete |
| Non-copy-assignable. | |
| CudaEvent (CudaEvent &&other) noexcept | |
| Move constructor. More... | |
| CudaEvent & | operator= (CudaEvent &&other) |
| Move assignment operator. More... | |
| void | record (rmm::cuda_stream_view stream) |
| Record the event on a CUDA stream. More... | |
| bool | is_ready () const |
| Check if the CUDA event has been completed. More... | |
| void | host_wait () const |
| Wait for the event to be completed (blocking). More... | |
| void | stream_wait (rmm::cuda_stream_view stream) const |
| Make a CUDA stream wait on this event (non-blocking). More... | |
| cudaEvent_t const & | value () const noexcept |
| Access the underlying CUDA event handle. More... | |
| operator cudaEvent_t const & () const noexcept | |
| Implicit conversion operator to the CUDA event handle. More... | |
Static Public Member Functions | |
| static std::shared_ptr< CudaEvent > | make_shared_record (rmm::cuda_stream_view stream, unsigned flags=cudaEventDisableTiming) |
| Create and record a CUDA event on a given stream. More... | |
RAII wrapper for a CUDA event with convenience methods.
Creates a CUDA event on construction and destroys it on destruction.
CudaEvent objects must not have static storage duration, since CUDA resources are not guaranteed to be valid during program initialization or shutdown. Definition at line 35 of file cuda_event.hpp.
| rapidsmpf::CudaEvent::CudaEvent | ( | unsigned | flags = cudaEventDisableTiming | ) |
Construct a CUDA event.
| flags | CUDA event creation flags. |
| rapidsmpf::cuda_error | if cudaEventCreateWithFlags fails. |
|
noexcept |
Destroy the CUDA event.
Automatically releases the underlying CUDA event resource.
|
noexcept |
Move constructor.
| other | Source CudaEvent to move from. |
| void rapidsmpf::CudaEvent::host_wait | ( | ) | const |
Wait for the event to be completed (blocking).
| rapidsmpf::cuda_error | if cudaEventSynchronize fails. |
| bool rapidsmpf::CudaEvent::is_ready | ( | ) | const |
Check if the CUDA event has been completed.
| rapidsmpf::cuda_error | if cudaEventQuery fails. |
|
static |
Create and record a CUDA event on a given stream.
Convenience factory that constructs a shared CudaEvent with the specified creation flags, immediately records it on the provided stream, and returns it as a std::shared_ptr.
| stream | CUDA stream on which to record the event. |
| flags | CUDA event creation flags. |
| rapidsmpf::cuda_error | if event creation or recording fails. |
|
inlinenoexcept |
Implicit conversion operator to the CUDA event handle.
Definition at line 139 of file cuda_event.hpp.
Move assignment operator.
| other | Source CudaEvent to move from. |
| void rapidsmpf::CudaEvent::record | ( | rmm::cuda_stream_view | stream | ) |
Record the event on a CUDA stream.
Marks the event as occurring after all prior operations on the given stream.
| stream | The CUDA stream to record the event on. |
| rapidsmpf::cuda_error | if cudaEventRecord fails. |
| void rapidsmpf::CudaEvent::stream_wait | ( | rmm::cuda_stream_view | stream | ) | const |
Make a CUDA stream wait on this event (non-blocking).
Ensures that all operations submitted to the given stream after this call will not begin execution until this event has completed.
| stream | CUDA stream that should wait for the event. |
| rapidsmpf::cuda_error | if cudaStreamWaitEvent fails. |
|
noexcept |
Access the underlying CUDA event handle.