7 #ifndef MULTI_WRAPPER_IMPLS_UNIQUE_SPAN_HPP_ 8 #define MULTI_WRAPPER_IMPLS_UNIQUE_SPAN_HPP_ 10 #include "../detail/unique_span.hpp" 11 #include "../current_device.hpp" 12 #include "../current_context.hpp" 13 #include "../primary_context.hpp" 14 #include "../memory.hpp" 15 #include "../types.hpp" 16 #include "../device.hpp" 27 return detail_::make_unique_span<T>(context.handle(), num_elements);
44 CAW_SET_SCOPE_CONTEXT(pc.handle());
45 return make_unique_span<T>(pc, num_elements);
64 auto current_device_id = cuda::device::current::detail_::get_id();
65 auto pc = cuda::device::primary_context::detail_::leaky_get(current_device_id);
66 return make_unique_span<T>(pc, num_elements);
79 CAW_SET_SCOPE_CONTEXT(context.handle());
80 switch (initial_visibility) {
81 case initial_visibility_t::to_all_devices:
82 return detail_::make_unique_span<T, initial_visibility_t::to_all_devices>(context.handle(), size);
83 case initial_visibility_t::to_supporters_of_concurrent_managed_access:
84 return detail_::make_unique_span<T, initial_visibility_t::to_supporters_of_concurrent_managed_access>(context.handle(), size);
86 throw ::std::logic_error(
"Library not yet updated to support additional initial visibility values");
97 return make_unique_span<T>(pc, size, initial_visibility);
100 template <
typename T>
105 auto current_device_id = cuda::device::current::detail_::get_id();
106 auto pc = cuda::device::primary_context::detail_::leaky_get(current_device_id);
107 return make_unique_span<T>(pc, size, initial_visibility);
116 #endif // MULTI_WRAPPER_IMPLS_UNIQUE_SPAN_HPP_ Wrapper class for a CUDA context.
Definition: context.hpp:244
Definitions and functionality wrapping CUDA APIs.
Definition: array.hpp:22
unique_span< T > make_unique_span(const context_t &context, size_t size)
Allocate memory for a consecutive sequence of typed elements in device-global memory.
Definition: unique_span.hpp:25
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
Wrapper class for a CUDA device.
Definition: device.hpp:135
initial_visibility_t
The choices of which categories CUDA devices must a managed memory region be visible to...
Definition: types.hpp:753