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

Represent a collection of memory regions. More...

#include <Region.hpp>

Collaboration diagram for mxl::lib::fabrics::ofi::MxlRegions:

Public Member Functions

DataLayout const & dataLayout () const noexcept
std::uint32_t maxSyncBatchSize () const noexcept
 MxlRegions (std::vector< Region > regions, DataLayout dataLayout, std::uint32_t maxSyncBatchSize=0)
std::vector< Region > const & regions () const noexcept
 View accessor for the underlying regions.

Static Public Member Functions

static MxlRegions forReader (mxlFlowReader)
static MxlRegions forWriter (mxlFlowWriter)

Private Attributes

DataLayout _layout
std::uint32_t _maxSyncBatchSize
std::vector< Region > _regions

Friends

MxlRegions mxlFabricsRegionsFromFlow (FlowData &flow)
MxlRegions mxlFabricsRegionsFromMutableFlow (FlowData &flow)
 Convert a FlowData's memory regions to MxlRegions. FlowData are obtained from an MXL FlowWriter or FlowReader.

Detailed Description

Represent a collection of memory regions.

This is the internal strucure representing mxlFabricsRegions API type.

Definition at line 202 of file Region.hpp.

Constructor & Destructor Documentation

◆ MxlRegions()

mxl::lib::fabrics::ofi::MxlRegions::MxlRegions ( std::vector< Region > regions,
DataLayout dataLayout,
std::uint32_t maxSyncBatchSize = 0 )
inline

Definition at line 205 of file Region.hpp.

206 : _regions{std::move(regions)}
209 {}
DataLayout const & dataLayout() const noexcept
Definition Region.cpp:120
std::vector< Region > const & regions() const noexcept
View accessor for the underlying regions.
Definition Region.cpp:115
std::vector< Region > _regions
Definition Region.hpp:230
std::uint32_t maxSyncBatchSize() const noexcept
Definition Region.cpp:125

Member Function Documentation

◆ dataLayout()

DataLayout const & mxl::lib::fabrics::ofi::MxlRegions::dataLayout ( ) const
nodiscardnoexcept

Definition at line 120 of file Region.cpp.

121 {
122 return _layout;
123 }

◆ forReader()

MxlRegions mxl::lib::fabrics::ofi::MxlRegions::forReader ( mxlFlowReader )
static

Definition at line 105 of file Region.cpp.

106 {
108 }
friend MxlRegions mxlFabricsRegionsFromFlow(FlowData &flow)
FlowReader * to_FlowReader(mxlFlowReader reader) noexcept
Utility function to convert from a C mxlFlowReader handle to a C++ FlowReader instance.
Definition Instance.hpp:252
mxlFlowReader reader

◆ forWriter()

MxlRegions mxl::lib::fabrics::ofi::MxlRegions::forWriter ( mxlFlowWriter )
static

Definition at line 110 of file Region.cpp.

111 {
113 }
friend MxlRegions mxlFabricsRegionsFromMutableFlow(FlowData &flow)
Convert a FlowData's memory regions to MxlRegions. FlowData are obtained from an MXL FlowWriter or Fl...
Definition Region.cpp:130
FlowWriter * to_FlowWriter(mxlFlowWriter writer) noexcept
Utility function to convert from a C mxlFlowWriter handle to a C++ FlowWriter instance.
Definition Instance.hpp:257
mxlFlowWriter writer

◆ maxSyncBatchSize()

std::uint32_t mxl::lib::fabrics::ofi::MxlRegions::maxSyncBatchSize ( ) const
nodiscardnoexcept

Definition at line 125 of file Region.cpp.

126 {
127 return _maxSyncBatchSize;
128 }

◆ regions()

std::vector< Region > const & mxl::lib::fabrics::ofi::MxlRegions::regions ( ) const
nodiscardnoexcept

View accessor for the underlying regions.

Definition at line 115 of file Region.cpp.

116 {
117 return _regions;
118 }

◆ mxlFabricsRegionsFromFlow

MxlRegions mxlFabricsRegionsFromFlow ( FlowData & flow)
friend

◆ mxlFabricsRegionsFromMutableFlow

MxlRegions mxlFabricsRegionsFromMutableFlow ( FlowData & flow)
friend

Convert a FlowData's memory regions to MxlRegions. FlowData are obtained from an MXL FlowWriter or FlowReader.

Definition at line 130 of file Region.cpp.

131 {
132 auto mxlRegions = mxlFabricsRegionsFromFlow(flow);
133
134 if (mxlIsDiscreteDataFormat(static_cast<int>(flow.flowInfo()->config.common.format)))
135 {
136 auto& discreteFlow = static_cast<DiscreteFlowData&>(flow);
137
138 if (mxlRegions._regions.size() != discreteFlow.grainCount())
139 {
140 throw Exception::invalidState("Unexpected number of grains in discrete flow");
141 }
142
143 for (std::size_t i = 0; i < discreteFlow.grainCount(); ++i)
144 {
145 mxlRegions._regions[i].grainIndexPtr = &discreteFlow.grainAt(i)->header.info.index;
146 mxlRegions._regions[i].validSlicesPtr = &discreteFlow.grainAt(i)->header.info.validSlices;
147 }
148 }
149
150 return mxlRegions;
151 }
static Exception invalidState(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INVALID_STATE exception.
Definition Exception.hpp:59
int mxlIsDiscreteDataFormat(int format)
Definition dataformat.h:75

Member Data Documentation

◆ _layout

DataLayout mxl::lib::fabrics::ofi::MxlRegions::_layout
private

Definition at line 231 of file Region.hpp.

◆ _maxSyncBatchSize

std::uint32_t mxl::lib::fabrics::ofi::MxlRegions::_maxSyncBatchSize
private

Definition at line 232 of file Region.hpp.

◆ _regions

std::vector<Region> mxl::lib::fabrics::ofi::MxlRegions::_regions
private

Definition at line 230 of file Region.hpp.


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