15 if (offset + length >
len)
21 .addr =
addr + offset,
29 return ::iovec{.iov_base =
reinterpret_cast<void*
>(
addr), .iov_len =
len};
44 std::vector<::iovec> iovs;
45 std::ranges::transform(group, std::back_inserter(iovs), [](
LocalRegion const& reg) {
return reg.
toIovec(); });
51 std::vector<void*> descs;
52 std::ranges::transform(group, std::back_inserter(descs), [](
LocalRegion& reg) {
return reg.
desc; });
64 if (spanLength >
_inner.size())
67 "requested span size {} will be bigger than the actual size of the full vector {}", spanLength,
_inner.size());
85 return std::accumulate(
_inner.begin(),
_inner.end(), std::size_t{0}, [](std::size_t sum,
auto const region) { return sum + region.len; });
static Exception invalidArgument(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INVALID_ARG exception.
static Exception invalidState(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INVALID_STATE exception.
Represent a span of a LocalRegionGroup.
std::span<::iovec const > _iovec
void *const * desc() const noexcept
std::span< LocalRegion const > _inner
std::span< void *const > _descs
LocalRegionGroupSpan(std::span< LocalRegion const >, std::span<::iovec const >, std::span< void *const >)
std::size_t byteSize() const noexcept
Returns the sum of each region size in the span.
std::vector< void * > _descs
::iovec const * asIovec() const noexcept
Return the underlying array of iovec structures representing the memory region group.
void *const * desc() const noexcept
Return the underlying array of descriptors representing the memory region group.
LocalRegionGroupSpan span(std::size_t beginIndex, std::size_t endIndex) const
Return a span representing a contiguous subset of the LocalRegionGroup.
std::vector< LocalRegion > _inner
static std::vector< void * > descFromGroup(std::vector< LocalRegion > group) noexcept
Generate descriptor array from a group of LocalRegion.
std::vector<::iovec > _iovs
static std::vector<::iovec > iovFromGroup(std::vector< LocalRegion > group) noexcept
Generate iovec array from a group of LocalRegion.
Represent a source memory region used for for data transfer.
LocalRegion sub(std::uint64_t offset, std::size_t length) const
Create a sub-region of this LocalRegion.
::iovec toIovec() const noexcept
Convert this LocalRegion to a struct iovec used by libfabric transfer functions.