9 namespace checkout_mode {
65 template <
typename T,
typename Mode>
74 using reference =
typename std::iterator_traits<pointer>::reference;
87 : ptr_((gptr && n > 0) ? ori::
checkout(gptr, n, Mode{}) : nullptr),
89 ITYR_CHECK(((ptr_ && n_ > 0) || (!ptr_ && n == 0)));
130 constexpr
bool empty() const noexcept {
return n_ == 0; }
172 template <
typename T,
typename Mode>
177 template <
typename T,
typename Mode>
182 template <
typename T,
typename Mode>
187 template <
typename T,
typename Mode>
237 template <
typename T,
typename Mode>
252 template <
typename T,
typename Mode>
259 inline auto make_checkouts_aux() {
260 return std::make_tuple();
263 template <
typename T,
typename Mode,
typename... Rest>
264 inline auto make_checkouts_aux(ori::global_ptr<T> gptr, std::size_t n, Mode
mode, Rest&&... rest) {
265 checkout_span<T, Mode> cs;
266 cs.checkout_nb(gptr, n,
mode);
267 return std::tuple_cat(std::make_tuple(
std::move(cs)),
268 make_checkouts_aux(std::forward<Rest>(rest)...));
271 template <
typename T,
typename Mode,
typename... Rest>
272 inline auto make_checkouts_aux(global_span<T> gspan, Mode
mode, Rest&&... rest) {
273 checkout_span<T, Mode> cs;
274 cs.checkout_nb(gspan.data(), gspan.size(),
mode);
275 return std::tuple_cat(std::make_tuple(
std::move(cs)),
276 make_checkouts_aux(std::forward<Rest>(rest)...));
310 template <
typename... Args>
312 auto css = internal::make_checkouts_aux(std::forward<Args>(
args)...);
Checkout span to automatically manage the lifetime of checked-out memory.
Definition: checkout_span.hpp:66
constexpr reverse_iterator rbegin() const noexcept
Definition: checkout_span.hpp:119
constexpr const_reverse_iterator crend() const noexcept
Definition: checkout_span.hpp:123
std::size_t size_type
Definition: checkout_span.hpp:70
constexpr pointer data() const noexcept
Definition: checkout_span.hpp:110
const_pointer const_iterator
Definition: checkout_span.hpp:77
constexpr reference back() const
Definition: checkout_span.hpp:128
void checkout_nb(ori::global_ptr< T > gptr, std::size_t n, Mode)
Manually perform the nonblocking checkout operation by checking in the previous span.
Definition: checkout_span.hpp:144
std::add_const_t< element_type > * const_pointer
Definition: checkout_span.hpp:72
T element_type
Definition: checkout_span.hpp:68
constexpr reverse_iterator rend() const noexcept
Definition: checkout_span.hpp:120
~checkout_span()
Perform the checkin operation when destroyed.
Definition: checkout_span.hpp:95
constexpr reference operator[](size_type i) const
Definition: checkout_span.hpp:125
constexpr iterator begin() const noexcept
Definition: checkout_span.hpp:113
constexpr size_type size() const noexcept
Definition: checkout_span.hpp:111
checkout_span(ori::global_ptr< T > gptr, std::size_t n, Mode)
Construct a checkout span by checking out a global memory region.
Definition: checkout_span.hpp:86
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: checkout_span.hpp:79
pointer iterator
Definition: checkout_span.hpp:76
element_type * pointer
Definition: checkout_span.hpp:71
typename std::iterator_traits< pointer >::difference_type difference_type
Definition: checkout_span.hpp:73
void checkout(ori::global_ptr< T > gptr, std::size_t n, Mode)
Manually perform the checkout operation by checking in the previous span.
Definition: checkout_span.hpp:135
checkout_span & operator=(const checkout_span &)=delete
constexpr reference front() const
Definition: checkout_span.hpp:127
checkout_span()
Definition: checkout_span.hpp:81
std::reverse_iterator< iterator > reverse_iterator
Definition: checkout_span.hpp:78
checkout_span(checkout_span &&cs)
Definition: checkout_span.hpp:100
checkout_span & operator=(checkout_span &&cs)
Definition: checkout_span.hpp:101
constexpr bool empty() const noexcept
Definition: checkout_span.hpp:130
constexpr const_iterator cbegin() const noexcept
Definition: checkout_span.hpp:116
void checkin()
Manually perform the checkin operation by discarding the current checkout span.
Definition: checkout_span.hpp:153
std::remove_cv_t< element_type > value_type
Definition: checkout_span.hpp:69
checkout_span(const checkout_span &)=delete
typename std::iterator_traits< const_pointer >::reference const_reference
Definition: checkout_span.hpp:75
constexpr const_reverse_iterator crbegin() const noexcept
Definition: checkout_span.hpp:122
constexpr iterator end() const noexcept
Definition: checkout_span.hpp:114
constexpr const_iterator cend() const noexcept
Definition: checkout_span.hpp:117
typename std::iterator_traits< pointer >::reference reference
Definition: checkout_span.hpp:74
Global span to represent a view of a global memory range.
Definition: global_span.hpp:33
constexpr size_type size() const noexcept
Definition: global_span.hpp:74
constexpr pointer data() const noexcept
Definition: global_span.hpp:73
Definition: global_ptr.hpp:19
#define ITYR_CHECK(cond)
Definition: util.hpp:48
constexpr read_write_t read_write
Read+Write checkout mode.
Definition: checkout_span.hpp:39
constexpr read_t read
Read-only checkout mode.
Definition: checkout_span.hpp:19
ori::mode::read_t read_t
See ityr::checkout_mode::read.
Definition: checkout_span.hpp:12
ori::mode::write_t write_t
See ityr::checkout_mode::write.
Definition: checkout_span.hpp:22
constexpr no_access_t no_access
Checkout mode to disable automatic checkout.
Definition: checkout_span.hpp:48
constexpr write_t write
Write-only checkout mode.
Definition: checkout_span.hpp:29
ori::mode::read_write_t read_write_t
See ityr::checkout_mode::read_write.
Definition: checkout_span.hpp:32
ITYR_CONCAT(mode_, ITYR_PROFILER_MODE) mode
Definition: profiler.hpp:257
va_list args
Definition: util.hpp:76
std::pair< T *, bool > checkout_nb(global_ptr< T > ptr, std::size_t count, mode::read_t)
Definition: ori.hpp:108
void checkin(T *raw_ptr, std::size_t count, mode::read_t)
Definition: ori.hpp:168
auto checkout(global_ptr< T > ptr, std::size_t count, Mode mode)
Definition: ori.hpp:148
void checkout_complete()
Definition: ori.hpp:139
Definition: allocator.hpp:16
global_reverse_iterator< global_iterator< T, Mode > > make_reverse_iterator(ori::global_ptr< T > gptr, Mode mode)
Make a reverse iterator for global memory.
Definition: global_iterator.hpp:333
constexpr auto begin(const checkout_span< T, Mode > &cs) noexcept
Definition: checkout_span.hpp:183
constexpr auto data(const checkout_span< T, Mode > &cs) noexcept
Definition: checkout_span.hpp:173
auto make_checkouts(Args &&... args)
Checkout multiple global memory regions.
Definition: checkout_span.hpp:311
checkout_span< T, Mode > make_checkout(ori::global_ptr< T > gptr, std::size_t n, Mode mode)
Checkout a global memory region.
Definition: checkout_span.hpp:238
constexpr auto size(const checkout_span< T, Mode > &cs) noexcept
Definition: checkout_span.hpp:178
constexpr auto end(const checkout_span< T, Mode > &cs) noexcept
Definition: checkout_span.hpp:188
ForwardIteratorD move(const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d)
Move a range to another.
Definition: parallel_loop.hpp:934
See ityr::checkout_mode::no_access.
Definition: checkout_span.hpp:42