RAII Wrapper to a libfabric fi_av instance.
More...
#include <AddressVector.hpp>
|
| | AddressVector (fid_av *raw, std::shared_ptr< Domain > domain) |
| void | close () |
| | Close the address vector and release all resources. Called from the destructor and the move assignment operator.
|
RAII Wrapper to a libfabric fi_av instance.
Definition at line 18 of file AddressVector.hpp.
◆ ~AddressVector()
| mxl::lib::fabrics::ofi::AddressVector::~AddressVector |
( |
| ) |
|
Definition at line 94 of file AddressVector.cpp.
95 {
97 }
void close()
Close the address vector and release all resources. Called from the destructor and the move assignmen...
void catchAndLogFabricError(F &&fun, std::string_view msg)
◆ AddressVector() [1/3]
| mxl::lib::fabrics::ofi::AddressVector::AddressVector |
( |
AddressVector const & | | ) |
|
|
delete |
◆ AddressVector() [2/3]
| mxl::lib::fabrics::ofi::AddressVector::AddressVector |
( |
AddressVector && | other | ) |
|
|
noexcept |
Definition at line 99 of file AddressVector.cpp.
101 ,
_domain(std::move(other._domain))
102 {
103 other._raw = nullptr;
104 }
std::shared_ptr< Domain > _domain
◆ AddressVector() [3/3]
| mxl::lib::fabrics::ofi::AddressVector::AddressVector |
( |
fid_av * | raw, |
|
|
std::shared_ptr< Domain > | domain ) |
|
private |
◆ addrToString()
| std::string mxl::lib::fabrics::ofi::AddressVector::addrToString |
( |
RawFabricAddress const & | addr | ) |
const |
|
nodiscard |
Convert a libfabric endpoint address into a human-readable string.
Definition at line 72 of file AddressVector.cpp.
73 {
74 std::string s;
75 std::size_t len = 0;
76
77 ::fi_av_straddr(
_raw, addr.raw(),
nullptr, &len);
78 s.resize(len);
79
80 auto ret = ::fi_av_straddr(
_raw, addr.raw(), s.data(), &len);
81 if (ret == nullptr)
82 {
84 }
85
86 return s;
87 }
static Exception internal(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INTERNAL exception.
◆ close()
| void mxl::lib::fabrics::ofi::AddressVector::close |
( |
| ) |
|
|
private |
Close the address vector and release all resources. Called from the destructor and the move assignment operator.
Definition at line 117 of file AddressVector.cpp.
118 {
120 {
122
123 fiCall(::fi_close,
"Failed to close address vector", &
_raw->fid);
125 }
126 }
int fiCall(F &&fun, std::string_view msg, T &&... args)
Call a libfabric function and check its return code.
◆ insert()
| fi_addr_t mxl::lib::fabrics::ofi::AddressVector::insert |
( |
RawFabricAddress const & | addr | ) |
|
Insert an address into the address vector. User of this API are responsible for keeping track of inserted addresses to avoid duplicates.
Definition at line 54 of file AddressVector.cpp.
55 {
56 ::fi_addr_t fiAddr{FI_ADDR_UNSPEC};
57
58 if (
auto ret = ::fi_av_insert(
_raw, addr.raw(), 1, &fiAddr, 0,
nullptr); ret != 1)
59 {
60 throw Exception::internal(
"Failed to insert address into the address vector. {}", ::fi_strerror(ret));
61 }
63
64 return fiAddr;
65 }
std::string addrToString(RawFabricAddress const &addr) const
Convert a libfabric endpoint address into a human-readable string.
◆ open()
Create an AddressVector.
Definition at line 35 of file AddressVector.cpp.
36 {
38
39 auto fiAttr = attr.toRaw();
40
41 fiCall(::fi_av_open,
"Failed to open address vector", domain->raw(), &fiAttr, &
raw,
nullptr);
42
43
45 {
46 MakeSharedEnabler(fid_av* raw, std::shared_ptr<Domain> domain)
47 : AddressVector(
raw, std::move(domain))
48 {}
49 };
50
51 return std::make_shared<MakeSharedEnabler>(
raw, domain);
52 }
AddressVector(AddressVector const &)=delete
::fid_av * raw() noexcept
Mutable accessor of the underlying fi_av instance.
::fi_info * raw() noexcept
Returns the raw fi_info object managed by this FabricInfo instance.
◆ operator=() [1/2]
Definition at line 106 of file AddressVector.cpp.
107 {
109
111 other._raw = nullptr;
112 _domain = std::move(other._domain);
113
114 return *this;
115 }
◆ operator=() [2/2]
| void mxl::lib::fabrics::ofi::AddressVector::operator= |
( |
AddressVector const & | | ) |
|
|
delete |
◆ raw() [1/2]
| fid_av const * mxl::lib::fabrics::ofi::AddressVector::raw |
( |
| ) |
const |
|
nodiscardnoexcept |
Immutable accessor of the underlying fi_av instance.
Definition at line 133 of file AddressVector.cpp.
◆ raw() [2/2]
| fid_av * mxl::lib::fabrics::ofi::AddressVector::raw |
( |
| ) |
|
|
noexcept |
Mutable accessor of the underlying fi_av instance.
Definition at line 128 of file AddressVector.cpp.
◆ remove()
| void mxl::lib::fabrics::ofi::AddressVector::remove |
( |
::fi_addr_t | addr | ) |
|
|
noexcept |
Remove an address of the address vector.
Definition at line 67 of file AddressVector.cpp.
68 {
69 fiCall(::fi_av_remove,
"Failed to remove address from address vector",
_raw, &addr, 1, 0);
70 }
◆ _domain
| std::shared_ptr<Domain> mxl::lib::fabrics::ofi::AddressVector::_domain |
|
private |
◆ _raw
| fid_av* mxl::lib::fabrics::ofi::AddressVector::_raw |
|
private |
The documentation for this class was generated from the following files: