11 #ifndef MULTI_WRAPPER_IMPLS_EVENT_HPP_    12 #define MULTI_WRAPPER_IMPLS_EVENT_HPP_    14 #include "../device.hpp"    15 #include "../event.hpp"    16 #include "../stream.hpp"    17 #include "../primary_context.hpp"    18 #include "../virtual_memory.hpp"    19 #include "../current_context.hpp"    20 #include "../current_device.hpp"    22 #include <type_traits>    32     bool              uses_blocking_sync,
    39         do_not_hold_primary_context_refcount_unit,
    47     bool             uses_blocking_sync,
    59     auto pc = device.
primary_context(do_not_hold_primary_context_refcount_unit);
    60     CAW_SET_SCOPE_CONTEXT(pc.handle());
    61     device::primary_context::detail_::increase_refcount(device.
id());
    62     return event::detail_::create_in_current_context(
    64         context::current::detail_::get_handle(),
    65         do_hold_primary_context_refcount_unit,
    73     return detail_::export_(event.
handle());
    78     static constexpr 
const bool do_not_take_ownership { 
false };
    79     static constexpr 
const bool do_not_own_pc_refcount_unit { 
false };
    83         detail_::import(event_ipc_handle),
    84         do_not_take_ownership,
    85         do_not_own_pc_refcount_unit);
    91     auto pc = device.primary_context();
    92     device::primary_context::detail_::increase_refcount(device.id());
    93     auto handle = detail_::import(event_ipc_handle);
    95         device.id(), context::current::detail_::get_handle(), handle,
    96         do_not_take_ownership, do_hold_primary_context_refcount_unit);
   110     static constexpr 
const bool dont_take_ownership { 
false };
   111     return context::wrap(device_id(), context_handle_, dont_take_ownership);
   118         throw ::std::invalid_argument(
"Attempt to record an event on a stream in a different context");
   121     event::detail_::enqueue(context_handle_, stream.
handle(), handle_);
   132 #endif // MULTI_WRAPPER_IMPLS_EVENT_HPP_ context::handle_t context_handle() const noexcept
The raw CUDA handle for the context in which the represented stream is defined. 
Definition: stream.hpp:260
 
Proxy class for a CUDA stream. 
Definition: stream.hpp:246
 
event::handle_t handle() const noexcept
The raw CUDA handle for this event. 
Definition: event.hpp:143
 
stream::handle_t handle() const noexcept
The raw CUDA handle for a stream which this class wraps. 
Definition: stream.hpp:257
 
Wrapper class for a CUDA context. 
Definition: context.hpp:244
 
void synchronize() const
Block or busy-wait until all previously-scheduled work on this stream has been completed. 
Definition: stream.hpp:831
 
Definitions and functionality wrapping CUDA APIs. 
Definition: array.hpp:22
 
handle_t export_(const event_t &event)
Enable use of an event which this process created by other processes. 
Definition: event.hpp:71
 
Wrapper class for a CUDA event. 
Definition: event.hpp:133
 
void fire(const stream_t &stream) const
Records the event and ensures it has occurred before returning (by synchronizing the stream)...
Definition: event.hpp:124
 
event_t create(const context_t &context, bool uses_blocking_sync=sync_by_busy_waiting, bool records_timing=do_record_timings, bool interprocess=not_interprocess)
creates a new event. 
Definition: event.hpp:30
 
device::id_t id() const noexcept
Return the proxied device's ID. 
Definition: device.hpp:594
 
CUipcEventHandle handle_t
The concrete value passed between processes, used to tell the CUDA Runtime API which event is desired...
Definition: ipc.hpp:260
 
event_t wrap(device::id_t device_id, context::handle_t context_handle, handle_t event_handle, bool take_ownership=false, bool hold_pc_refcount_unit=false) noexcept
Wrap an existing CUDA event in a event_t instance. 
Definition: event.hpp:346
 
event_t create(const device_t &device, bool uses_blocking_sync=sync_by_busy_waiting, bool records_timing=do_record_timings, bool interprocess=not_interprocess)
creates a new event on (the primary execution context of) a device. 
Definition: event.hpp:45
 
device::primary_context_t primary_context(bool hold_pc_refcount_unit=false) const
Produce a proxy for the device's primary context - the one used by runtime API calls. 
Definition: device.hpp:152
 
device_t get(id_t id)
Returns a proxy for the CUDA device with a given id. 
Definition: device.hpp:837
 
void record() const
Schedule a specified event to occur (= to fire) when all activities already scheduled on the event's ...
Definition: event.hpp:196
 
device_t device() const
The device w.r.t. which the event is defined. 
Definition: event.hpp:103
 
Can be shared between processes. Must not be able to record timings. 
Definition: constants.hpp:96
 
Wrapper class for a CUDA device. 
Definition: device.hpp:135
 
context_t context() const
The context in which this stream was defined. 
Definition: event.hpp:108