45 inline void init(MPI_Comm comm = MPI_COMM_WORLD) {
58 template <
typename T,
template <block_
size_t>
typename MemMapper,
typename... MemMapperArgs>
61 std::forward<MemMapperArgs>(mmargs)...)));
79 template <
typename ConstT,
typename T>
81 static_assert(std::is_same_v<std::remove_const_t<ConstT>, T>,
82 "from_ptr must be of the same type as to_ptr ignoring const");
83 static_assert(std::is_trivially_copyable_v<T>,
"GET requires trivially copyable types");
89 static_assert(std::is_trivially_copyable_v<T>,
"PUT requires trivially copyable types");
95 template <
bool SkipFetch,
typename T>
97 std::size_t
size = count *
sizeof(T);
98 auto ret =
reinterpret_cast<std::remove_const_t<T>*
>(
std::malloc(
size +
sizeof(
void*)));
102 *
reinterpret_cast<void**
>(
reinterpret_cast<std::byte*
>(ret) +
size) =
103 const_cast<std::remove_const_t<T>*
>(ptr.
raw_ptr());
107 template <
typename T>
110 return {checkout_with_getput<false>(ptr, count),
true};
114 return {ptr.
raw_ptr(), completed};
117 template <
typename T>
119 static_assert(!std::is_const_v<T>,
"Const pointers cannot be checked out with write access mode");
121 return {checkout_with_getput<true>(ptr, count),
true};
125 return {ptr.
raw_ptr(), completed};
128 template <
typename T>
130 static_assert(!std::is_const_v<T>,
"Const pointers cannot be checked out with read+write access mode");
132 return {checkout_with_getput<false>(ptr, count),
true};
136 return {ptr.
raw_ptr(), completed};
147 template <
typename T,
typename Mode>
156 template <
bool RegisterDirty,
typename T>
158 std::size_t
size = count *
sizeof(T);
159 void* gptr = *
reinterpret_cast<void**
>(
reinterpret_cast<std::byte*
>(
160 const_cast<std::remove_const_t<T>*
>(raw_ptr)) +
size);
161 if constexpr (RegisterDirty) {
164 std::free(
const_cast<std::remove_const_t<T>*
>(raw_ptr));
167 template <
typename T>
170 checkin_with_getput<false>(raw_ptr, count);
176 template <
typename T>
178 static_assert(!std::is_const_v<T>,
"Const pointers cannot be checked in with write access mode");
180 checkin_with_getput<true>(raw_ptr, count);
186 template <
typename T>
188 static_assert(!std::is_const_v<T>,
"Const pointers cannot be checked in with read+write access mode");
190 checkin_with_getput<true>(raw_ptr, count);
214 template <
typename T>
219 template <
typename T>
Definition: mpi_util.hpp:430
Definition: prof_events.hpp:124
static auto & get()
Definition: util.hpp:180
static void init(Args &&... args)
Definition: util.hpp:190
static void fini()
Definition: util.hpp:194
Definition: file_mem.hpp:12
Definition: global_ptr.hpp:19
constexpr pointer raw_ptr() const noexcept
Definition: global_ptr.hpp:40
ori(MPI_Comm comm)
Definition: ori.hpp:23
Definition: prof_events.hpp:66
ITYR_CONCAT(mode_, ITYR_PROFILER_MODE) mode
Definition: profiler.hpp:257
constexpr read_write_t read_write
Definition: util.hpp:15
constexpr read_t read
Definition: util.hpp:11
constexpr write_t write
Definition: util.hpp:13
Definition: block_region_set.hpp:9
void fini()
Definition: ori.hpp:49
std::pair< T *, bool > checkout_nb(global_ptr< T > ptr, std::size_t count, mode::read_t)
Definition: ori.hpp:108
void collect_deallocated()
Definition: ori.hpp:228
void get(global_ptr< ConstT > from_ptr, T *to_ptr, std::size_t count)
Definition: ori.hpp:80
void init(MPI_Comm comm=MPI_COMM_WORLD)
Definition: ori.hpp:45
void checkin(T *raw_ptr, std::size_t count, mode::read_t)
Definition: ori.hpp:168
file_mem & file_mem_get(void *addr)
Definition: ori.hpp:252
void cache_prof_begin()
Definition: ori.hpp:232
global_ptr< T > malloc_coll(std::size_t count)
Definition: ori.hpp:54
void free(global_ptr< T > ptr, std::size_t count)
Definition: ori.hpp:75
auto release_lazy()
Definition: ori.hpp:200
void free_coll(global_ptr< T > ptr)
Definition: ori.hpp:70
auto checkout(global_ptr< T > ptr, std::size_t count, Mode mode)
Definition: ori.hpp:148
void put(const T *from_ptr, global_ptr< T > to_ptr, std::size_t count)
Definition: ori.hpp:88
core::instance::instance_type::release_handler release_handler
Definition: ori.hpp:204
void poll()
Definition: ori.hpp:224
global_ptr< T > malloc(std::size_t count)
Definition: ori.hpp:65
void checkout_complete()
Definition: ori.hpp:139
constexpr block_size_t block_size
Definition: ori.hpp:19
void file_mem_free_coll(void *addr)
Definition: ori.hpp:248
void release()
Definition: ori.hpp:196
T * checkout_with_getput(global_ptr< T > ptr, std::size_t count)
Definition: ori.hpp:96
uint32_t block_size_t
Definition: util.hpp:30
void unset_readonly_coll(global_ptr< T > ptr, std::size_t count)
Definition: ori.hpp:220
void cache_prof_print()
Definition: ori.hpp:240
void cache_prof_end()
Definition: ori.hpp:236
void * file_mem_alloc_coll(const std::string &fpath, bool mlock)
Definition: ori.hpp:244
void acquire()
Definition: ori.hpp:206
void checkin_with_getput(T *raw_ptr, std::size_t count)
Definition: ori.hpp:157
constexpr bool force_getput
Definition: ori.hpp:93
void set_readonly_coll(global_ptr< T > ptr, std::size_t count)
Definition: ori.hpp:215
constexpr auto size(const checkout_span< T, Mode > &cs) noexcept
Definition: checkout_span.hpp:178
#define ITYR_ORI_FORCE_GETPUT
#define ITYR_ORI_BLOCK_SIZE
Definition: options.hpp:153
Definition: options.hpp:60
Definition: options.hpp:96
Definition: options.hpp:66