MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
test_ProviderConfig.cpp File Reference
#include <optional>
#include <catch2/catch_test_macros.hpp>
#include <rdma/fabric.h>
#include <mxl/fabrics.h>
#include "FabricInfo.hpp"
#include "Provider.hpp"
#include "ProviderConfig.hpp"
Include dependency graph for test_ProviderConfig.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("ofi: ProviderCapabilities::fromAPI preserves fields", "[ofi][ProviderConfig]")
 TEST_CASE ("ofi: ProviderConfig with nullopt caps accepts SHM fi_info entries", "[ofi][ProviderConfig]")
 TEST_CASE ("ofi: ProviderConfig with nullopt caps accepts TCP fi_info entries", "[ofi][ProviderConfig]")
 TEST_CASE ("ofi: ProviderConfig with nullopt caps produces zero libfabric caps", "[ofi][ProviderConfig]")
 TEST_CASE ("ofi: ProviderConfig with REMOTE_WRITE accepts matching fi_info entries", "[ofi][ProviderConfig]")
 TEST_CASE ("ofi: ProviderConfig::create dispatches to correct provider factory", "[ofi][ProviderConfig]")

Function Documentation

◆ TEST_CASE() [1/6]

TEST_CASE ( "ofi: ProviderCapabilities::fromAPI preserves fields" ,
"" [ofi][ProviderConfig] )

Definition at line 117 of file test_ProviderConfig.cpp.

117 : ProviderCapabilities::fromAPI preserves fields", "[ofi][ProviderConfig]")
118{
119 auto apiCaps = mxlFabricsInterfaceCaps{
120 .version = MXL_FABRICS_API_VERSION,
121 .flags = MXL_FABRICS_IFACE_CAP_REMOTE_WRITE | MXL_FABRICS_IFACE_CAP_BLOCKING_OPERATIONS,
122 .maxMessageSize = 65536,
123 };
124 auto caps = ProviderCapabilities::fromAPI(apiCaps);
125 REQUIRE(caps.interfaceCaps == (MXL_FABRICS_IFACE_CAP_REMOTE_WRITE | MXL_FABRICS_IFACE_CAP_BLOCKING_OPERATIONS));
126 REQUIRE(caps.maxMessageSize == 65536);
127}
static ProviderCapabilities fromAPI(::mxlFabricsInterfaceCaps)

◆ TEST_CASE() [2/6]

TEST_CASE ( "ofi: ProviderConfig with nullopt caps accepts SHM fi_info entries" ,
"" [ofi][ProviderConfig] )

Definition at line 39 of file test_ProviderConfig.cpp.

39 : ProviderConfig with nullopt caps accepts SHM fi_info entries", "[ofi][ProviderConfig]")
40{
41 auto config = ProviderConfig::shm(false, std::nullopt);
42
43 auto accepted = false;
44 for (auto info : FabricInfoList::get())
45 {
46 auto provider = providerFromString(info->fabric_attr->prov_name);
47 if (provider && (*provider == Provider::SHM))
48 {
49 if (config.isSupportedFabricInfo(info))
50 {
51 accepted = true;
52 break;
53 }
54 }
55 }
56 REQUIRE(accepted);
57}

◆ TEST_CASE() [3/6]

TEST_CASE ( "ofi: ProviderConfig with nullopt caps accepts TCP fi_info entries" ,
"" [ofi][ProviderConfig] )

Definition at line 59 of file test_ProviderConfig.cpp.

59 : ProviderConfig with nullopt caps accepts TCP fi_info entries", "[ofi][ProviderConfig]")
60{
61 auto config = ProviderConfig::tcp(false, std::nullopt);
62
63 auto accepted = false;
64 for (auto info : FabricInfoList::get())
65 {
66 auto provider = providerFromString(info->fabric_attr->prov_name);
67 if (provider && (*provider == Provider::TCP))
68 {
69 if (config.isSupportedFabricInfo(info))
70 {
71 accepted = true;
72 break;
73 }
74 }
75 }
76 REQUIRE(accepted);
77}

◆ TEST_CASE() [4/6]

TEST_CASE ( "ofi: ProviderConfig with nullopt caps produces zero libfabric caps" ,
"" [ofi][ProviderConfig] )

Definition at line 15 of file test_ProviderConfig.cpp.

15 : ProviderConfig with nullopt caps produces zero libfabric caps", "[ofi][ProviderConfig]")
16{
17 SECTION("TCP")
18 {
19 auto config = ProviderConfig::tcp(false, std::nullopt);
20 REQUIRE(config.getCaps() == 0);
21 }
22 SECTION("VERBS")
23 {
24 auto config = ProviderConfig::verbs(false, std::nullopt);
25 REQUIRE(config.getCaps() == 0);
26 }
27 SECTION("EFA")
28 {
29 auto config = ProviderConfig::efa(false, std::nullopt);
30 REQUIRE(config.getCaps() == 0);
31 }
32 SECTION("SHM")
33 {
34 auto config = ProviderConfig::shm(false, std::nullopt);
35 REQUIRE(config.getCaps() == 0);
36 }
37}

◆ TEST_CASE() [5/6]

TEST_CASE ( "ofi: ProviderConfig with REMOTE_WRITE accepts matching fi_info entries" ,
"" [ofi][ProviderConfig] )

Definition at line 79 of file test_ProviderConfig.cpp.

79 : ProviderConfig with REMOTE_WRITE accepts matching fi_info entries", "[ofi][ProviderConfig]")
80{
81 auto caps = ProviderCapabilities{.maxMessageSize = 0, .interfaceCaps = MXL_FABRICS_IFACE_CAP_REMOTE_WRITE};
82
83 SECTION("TCP")
84 {
85 auto config = ProviderConfig::tcp(false, caps);
86
87 auto accepted = false;
88 for (auto info : FabricInfoList::get())
89 {
90 auto provider = providerFromString(info->fabric_attr->prov_name);
91 if (provider && (*provider == Provider::TCP) && config.isSupportedFabricInfo(info))
92 {
93 accepted = true;
94 break;
95 }
96 }
97 REQUIRE(accepted);
98 }
99 SECTION("SHM")
100 {
101 auto config = ProviderConfig::shm(false, caps);
102
103 auto accepted = false;
104 for (auto info : FabricInfoList::get())
105 {
106 auto provider = providerFromString(info->fabric_attr->prov_name);
107 if (provider && (*provider == Provider::SHM) && config.isSupportedFabricInfo(info))
108 {
109 accepted = true;
110 break;
111 }
112 }
113 REQUIRE(accepted);
114 }
115}

◆ TEST_CASE() [6/6]

TEST_CASE ( "ofi: ProviderConfig::create dispatches to correct provider factory" ,
"" [ofi][ProviderConfig] )

Definition at line 129 of file test_ProviderConfig.cpp.

129 : ProviderConfig::create dispatches to correct provider factory", "[ofi][ProviderConfig]")
130{
131 SECTION("TCP")
132 {
133 auto config = ProviderConfig::create(Provider::TCP, false, std::nullopt);
134 REQUIRE(config.getProviderName() == "tcp");
135 REQUIRE(config.getEndpointType() == FI_EP_MSG);
136 }
137 SECTION("VERBS")
138 {
139 auto config = ProviderConfig::create(Provider::VERBS, false, std::nullopt);
140 REQUIRE(config.getProviderName() == "verbs");
141 REQUIRE(config.getEndpointType() == FI_EP_MSG);
142 }
143 SECTION("EFA")
144 {
145 auto config = ProviderConfig::create(Provider::EFA, false, std::nullopt);
146 REQUIRE(config.getProviderName() == "efa");
147 REQUIRE(config.getEndpointType() == FI_EP_RDM);
148 }
149 SECTION("SHM")
150 {
151 auto config = ProviderConfig::create(Provider::SHM, false, std::nullopt);
152 REQUIRE(config.getProviderName() == "shm");
153 REQUIRE(config.getEndpointType() == FI_EP_RDM);
154 }
155}
static ProviderConfig create(Provider provider, bool isTarget, std::optional< ProviderCapabilities > capabilities)