MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
mxl::lib::fabrics::ofi::LocalRegionGroup Class Reference

Represent a scatter-gather list of source memory regions used for data transfer. More...

#include <LocalRegion.hpp>

Public Types

using const_iterator = std::vector<LocalRegion>::const_iterator
using iterator = std::vector<LocalRegion>::iterator

Public Member Functions

::iovec const * asIovec () const noexcept
 Return the underlying array of iovec structures representing the memory region group.
iterator begin ()
const_iterator begin () const
void *const * desc () const noexcept
 Return the underlying array of descriptors representing the memory region group.
iterator end ()
const_iterator end () const
 LocalRegionGroup (std::vector< LocalRegion > inner)
LocalRegion & operator[] (std::size_t index)
LocalRegion const & operator[] (std::size_t index) const
std::size_t size () const noexcept
LocalRegionGroupSpan span (std::size_t beginIndex, std::size_t endIndex) const
 Return a span representing a contiguous subset of the LocalRegionGroup.

Static Private Member Functions

static std::vector< void * > descFromGroup (std::vector< LocalRegion > group) noexcept
 Generate descriptor array from a group of LocalRegion.
static std::vector<::iovec > iovFromGroup (std::vector< LocalRegion > group) noexcept
 Generate iovec array from a group of LocalRegion.

Private Attributes

std::vector< void * > _descs
std::vector< LocalRegion > _inner
std::vector<::iovec > _iovs

Detailed Description

Represent a scatter-gather list of source memory regions used for data transfer.

Definition at line 48 of file LocalRegion.hpp.

Member Typedef Documentation

◆ const_iterator

Definition at line 52 of file LocalRegion.hpp.

◆ iterator

Definition at line 51 of file LocalRegion.hpp.

Constructor & Destructor Documentation

◆ LocalRegionGroup()

mxl::lib::fabrics::ofi::LocalRegionGroup::LocalRegionGroup ( std::vector< LocalRegion > inner)
inline

Definition at line 55 of file LocalRegion.hpp.

56 : _inner(std::move(inner))
59 {}
static std::vector< void * > descFromGroup(std::vector< LocalRegion > group) noexcept
Generate descriptor array from a group of LocalRegion.
static std::vector<::iovec > iovFromGroup(std::vector< LocalRegion > group) noexcept
Generate iovec array from a group of LocalRegion.

Member Function Documentation

◆ asIovec()

iovec const * mxl::lib::fabrics::ofi::LocalRegionGroup::asIovec ( ) const
nodiscardnoexcept

Return the underlying array of iovec structures representing the memory region group.

Definition at line 32 of file LocalRegion.cpp.

33 {
34 return _iovs.data();
35 }

◆ begin() [1/2]

iterator mxl::lib::fabrics::ofi::LocalRegionGroup::begin ( )
inline

Definition at line 71 of file LocalRegion.hpp.

72 {
73 return _inner.begin();
74 }

◆ begin() [2/2]

const_iterator mxl::lib::fabrics::ofi::LocalRegionGroup::begin ( ) const
inlinenodiscard

Definition at line 82 of file LocalRegion.hpp.

83 {
84 return _inner.cbegin();
85 }

◆ desc()

void *const * mxl::lib::fabrics::ofi::LocalRegionGroup::desc ( ) const
nodiscardnoexcept

Return the underlying array of descriptors representing the memory region group.

Definition at line 37 of file LocalRegion.cpp.

38 {
39 return _descs.data();
40 }

◆ descFromGroup()

std::vector< void * > mxl::lib::fabrics::ofi::LocalRegionGroup::descFromGroup ( std::vector< LocalRegion > group)
staticprivatenoexcept

Generate descriptor array from a group of LocalRegion.

Definition at line 49 of file LocalRegion.cpp.

50 {
51 std::vector<void*> descs;
52 std::ranges::transform(group, std::back_inserter(descs), [](LocalRegion& reg) { return reg.desc; });
53 return descs;
54 }

◆ end() [1/2]

iterator mxl::lib::fabrics::ofi::LocalRegionGroup::end ( )
inline

Definition at line 76 of file LocalRegion.hpp.

77 {
78 return _inner.end();
79 }

◆ end() [2/2]

const_iterator mxl::lib::fabrics::ofi::LocalRegionGroup::end ( ) const
inlinenodiscard

Definition at line 88 of file LocalRegion.hpp.

89 {
90 return _inner.cend();
91 }

◆ iovFromGroup()

std::vector<::iovec > mxl::lib::fabrics::ofi::LocalRegionGroup::iovFromGroup ( std::vector< LocalRegion > group)
staticprivatenoexcept

Generate iovec array from a group of LocalRegion.

Definition at line 42 of file LocalRegion.cpp.

43 {
44 std::vector<::iovec> iovs;
45 std::ranges::transform(group, std::back_inserter(iovs), [](LocalRegion const& reg) { return reg.toIovec(); });
46 return iovs;
47 }

◆ operator[]() [1/2]

LocalRegion & mxl::lib::fabrics::ofi::LocalRegionGroup::operator[] ( std::size_t index)
inline

Definition at line 93 of file LocalRegion.hpp.

94 {
95 return _inner[index];
96 }
uint64_t index

◆ operator[]() [2/2]

LocalRegion const & mxl::lib::fabrics::ofi::LocalRegionGroup::operator[] ( std::size_t index) const
inline

Definition at line 98 of file LocalRegion.hpp.

99 {
100 return _inner[index];
101 }

◆ size()

std::size_t mxl::lib::fabrics::ofi::LocalRegionGroup::size ( ) const
inlinenodiscardnoexcept

Definition at line 104 of file LocalRegion.hpp.

105 {
106 return _inner.size();
107 }

◆ span()

LocalRegionGroupSpan mxl::lib::fabrics::ofi::LocalRegionGroup::span ( std::size_t beginIndex,
std::size_t endIndex ) const
nodiscard

Return a span representing a contiguous subset of the LocalRegionGroup.

Parameters
beginIndexThe starting index of the span (inclusive).
endIndexThe ending index of the span (exclusive).
Returns
A LocalRegionGroupSpan representing the specified subset of the LocalRegionGroup.

Definition at line 56 of file LocalRegion.cpp.

57 {
58 if (end < begin)
59 {
60 throw Exception::invalidArgument("end {} is smaller than begin {}", end, begin);
61 }
62
63 auto const spanLength = end - begin;
64 if (spanLength > _inner.size())
65 {
67 "requested span size {} will be bigger than the actual size of the full vector {}", spanLength, _inner.size());
68 }
69
70 return LocalRegionGroupSpan{
71 std::span{_inner.cbegin() + begin, spanLength},
72 std::span{_iovs.cbegin() + begin, spanLength},
73 std::span{_descs.cbegin() + begin, spanLength},
74 };
75 }
static Exception invalidArgument(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INVALID_ARG exception.
Definition Exception.hpp:43

Member Data Documentation

◆ _descs

std::vector<void*> mxl::lib::fabrics::ofi::LocalRegionGroup::_descs
private

cached descriptor array

Definition at line 131 of file LocalRegion.hpp.

◆ _inner

std::vector<LocalRegion> mxl::lib::fabrics::ofi::LocalRegionGroup::_inner
private

Definition at line 128 of file LocalRegion.hpp.

◆ _iovs

std::vector<::iovec> mxl::lib::fabrics::ofi::LocalRegionGroup::_iovs
private

cached iovec array

Definition at line 130 of file LocalRegion.hpp.


The documentation for this class was generated from the following files: