15 for (
auto [addr_begin, addr_end,
id] : coll_mem_ids_) {
16 if (addr_begin <= addr && addr < addr_end) {
17 return *coll_mems_[id];
20 common::die(
"Address %p was passed but not allocated by Itoyori", addr);
27 std::byte* raw_ptr =
reinterpret_cast<std::byte*
>(cm.
vm().
addr());
29 coll_mem_ids_.emplace_back(std::make_tuple(raw_ptr, raw_ptr +
size,
id));
35 std::byte* p =
reinterpret_cast<std::byte*
>(cm.
vm().
addr());
36 auto it = std::find(coll_mem_ids_.begin(), coll_mem_ids_.end(),
37 std::make_tuple(p, p + cm.
size(), cm.
id()));
39 coll_mem_ids_.erase(it);
41 coll_mems_[cm.
id()].reset();
45 std::vector<std::optional<coll_mem>> coll_mems_;
46 std::vector<std::tuple<void*, void*, coll_mem_id_t>> coll_mem_ids_;
void * addr() const
Definition: virtual_mem.hpp:46
Definition: coll_mem_manager.hpp:10
coll_mem & create(std::size_t size, std::unique_ptr< mem_mapper::base > mmapper)
Definition: coll_mem_manager.hpp:23
coll_mem_manager()
Definition: coll_mem_manager.hpp:12
void destroy(coll_mem &cm)
Definition: coll_mem_manager.hpp:34
coll_mem & get(void *addr)
Definition: coll_mem_manager.hpp:14
Definition: coll_mem.hpp:16
coll_mem_id_t id() const
Definition: coll_mem.hpp:33
std::size_t size() const
Definition: coll_mem.hpp:34
const common::virtual_mem & vm() const
Definition: coll_mem.hpp:41
#define ITYR_CHECK(cond)
Definition: util.hpp:48
Definition: block_region_set.hpp:9
uint64_t coll_mem_id_t
Definition: coll_mem.hpp:14
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