libSCALE  0.2.0
A modern C++ CUDA API
sp::BlockingEvent Class Reference

An event that the host can synchronise with. More...

#include <Event.hpp>

Inheritance diagram for sp::BlockingEvent:
[legend]

Public Member Functions

void synchronize () const
 Block the host until the event completes. More...
 
- Public Member Functions inherited from sp::Event
bool isDone () const
 Returns true iff the work captured by this event has been completed. More...
 
- Public Member Functions inherited from sp::RAIIObject< EventAllocator, bool >
 RAIIObject (const CTorArgs &... args)
 Allocate a new object and take ownership of it. More...
 
 RAIIObject (const APIType &obj, bool own=true)
 Wrap an existing object. More...
 
const APIType get () const
 Get the underlying C API object (eg. cudaStream_t) More...
 
APIType get ()
 Get the underlying C API object (eg. cudaStream_t) More...
 
APIType operator* ()
 
const APIType operator* () const
 
 operator APIType () const
 Implicitly convert to the C API type, so you can just pass this object to the C library whence it came. More...
 
 operator APIType ()
 

Friends

class Stream
 

Additional Inherited Members

- Protected Types inherited from sp::RAIIObject< EventAllocator, bool >
using APIType = typename AllocType::APIType
 The C API type. Something like cudaStream_t. More...
 
using UnderlyingType = std::remove_pointer_t< APIType >
 

Detailed Description

An event that the host can synchronise with.

BlockingEvent provides a synchronize() function that blocks the host until the work represented by the event is done. BlockingEvents are less efficient than normal Events for device-side synchronisation between streams. Avoid using BlockingEvent unless you really need to synchronise with the event from the host.

You can obtain a BlockingEvent representing the outstanding work on a stream by calling sp::Stream::recordBlockingEvent().

Member Function Documentation

◆ synchronize()

void sp::BlockingEvent::synchronize ( ) const

Block the host until the event completes.

See also
cudaEventSynchronize()