20 std::unique_ptr<mem_mapper::base> mmapper)
23 mmapper_(std::
move(mmapper)),
25 home_pm_(init_intra_home_pm()),
26 home_vm_(init_intra_home_vm()),
28 home_all_mapped_(map_ahead_of_time()) {}
34 std::size_t
size()
const {
return size_; }
56 ss <<
"/ityr_ori_coll_mem_" <<
id <<
"_" <<
inter_rank;
77 common::virtual_mem init_intra_home_vm()
const {
78 common::virtual_mem
vm(home_pm_.
size(), mmapper_->block_size());
84 std::size_t pm_offset = 0;
85 while (pm_offset <
vm.
size()) {
89 std::byte* numa_seg_addr =
reinterpret_cast<std::byte*
>(
vm.
addr()) + numa_seg.pm_offset_b;
90 std::size_t numa_seg_size = numa_seg.pm_offset_e - numa_seg.pm_offset_b;
94 std::byte* numa_seg_addr =
reinterpret_cast<std::byte*
>(
vm.
addr()) + numa_seg.pm_offset_b;
95 std::size_t numa_seg_size = numa_seg.pm_offset_e - numa_seg.pm_offset_b;
98 pm_offset = numa_seg.pm_offset_e;
106 bool map_ahead_of_time()
const {
111 }
else if (mmapper_->should_map_all_home()) {
114 std::size_t offset = 0;
115 while (offset < size_) {
116 auto seg = mmapper_->get_segment(offset);
118 std::byte* seg_addr =
reinterpret_cast<std::byte*
>(vm_.
addr()) + seg.offset_b;
119 std::size_t seg_size = seg.offset_e - seg.offset_b;
120 home_pm_.
map_to_vm(seg_addr, seg_size, seg.pm_offset);
122 offset = seg.offset_e;
132 std::unique_ptr<mem_mapper::base> mmapper_;
133 common::virtual_mem vm_;
134 common::physical_mem home_pm_;
135 common::virtual_mem home_vm_;
136 std::unique_ptr<common::rma::win> win_;
137 bool home_all_mapped_;
140 template <
typename Fn>
144 std::size_t offset_b =
reinterpret_cast<uintptr_t
>(addr) -
145 reinterpret_cast<uintptr_t
>(cm.
vm().
addr());
146 std::size_t offset_e = offset_b +
size;
150 std::size_t offset = offset_b;
151 while (offset < offset_e) {
154 offset = seg.offset_e;
Definition: physical_mem.hpp:18
std::size_t size() const
Definition: physical_mem.hpp:41
void map_to_vm(void *addr, std::size_t size, std::size_t offset) const
Definition: physical_mem.hpp:43
Definition: virtual_mem.hpp:24
void * addr() const
Definition: virtual_mem.hpp:46
std::size_t size() const
Definition: virtual_mem.hpp:47
Definition: coll_mem.hpp:16
coll_mem(coll_mem &&)=default
coll_mem & operator=(coll_mem &&)=default
coll_mem_id_t id() const
Definition: coll_mem.hpp:33
std::size_t effective_size() const
Definition: coll_mem.hpp:36
const common::rma::win & win() const
Definition: coll_mem.hpp:51
bool home_all_mapped() const
Definition: coll_mem.hpp:37
const common::virtual_mem & home_vm() const
Definition: coll_mem.hpp:47
std::size_t local_size() const
Definition: coll_mem.hpp:35
std::size_t size() const
Definition: coll_mem.hpp:34
const common::virtual_mem & vm() const
Definition: coll_mem.hpp:41
const mem_mapper::base & mem_mapper() const
Definition: coll_mem.hpp:39
const common::physical_mem & home_pm() const
Definition: coll_mem.hpp:43
coll_mem(std::size_t size, coll_mem_id_t id, std::unique_ptr< mem_mapper::base > mmapper)
Definition: coll_mem.hpp:18
Definition: mem_mapper.hpp:35
virtual segment get_segment(std::size_t offset) const =0
#define ITYR_CHECK(cond)
Definition: util.hpp:48
void bind_to(void *, std::size_t, node_t)
Definition: numa.hpp:88
void interleave(void *, std::size_t, const node_bitmask &)
Definition: numa.hpp:89
std::unique_ptr< win > create_win(T *baseptr, std::size_t count)
Definition: rma.hpp:16
ITYR_RMA_IMPL::win win
Definition: rma.hpp:13
numa::node_t numa_node(rank_t intra_rank)
Definition: topology.hpp:229
rank_t inter_my_rank()
Definition: topology.hpp:215
bool numa_enabled()
Definition: topology.hpp:226
rank_t inter_rank(rank_t global_rank)
Definition: topology.hpp:219
rank_t inter_n_ranks()
Definition: topology.hpp:216
rank_t intra_my_rank()
Definition: topology.hpp:211
const numa::node_bitmask & numa_nodemask_all()
Definition: topology.hpp:230
MPI_Comm intra_mpicomm()
Definition: topology.hpp:210
virtual_mem reserve_same_vm_coll(std::size_t size, std::size_t alignment=alignof(max_align_t))
Definition: virtual_mem.hpp:170
void mpi_barrier(MPI_Comm comm)
Definition: mpi_util.hpp:42
Definition: block_region_set.hpp:9
void for_each_mem_segment(const coll_mem &cm, const void *addr, std::size_t size, Fn fn)
Definition: coll_mem.hpp:141
uint64_t coll_mem_id_t
Definition: coll_mem.hpp:14
constexpr block_size_t block_size
Definition: ori.hpp:19
constexpr auto size(const checkout_span< T, Mode > &cs) noexcept
Definition: checkout_span.hpp:178
ForwardIteratorD move(const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d)
Move a range to another.
Definition: parallel_loop.hpp:934