MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
test_Region.cpp File Reference
#include <catch2/catch_test_macros.hpp>
#include "Region.hpp"
Include dependency graph for test_Region.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("ofi: Region constructors", "[ofi][Constructors]")
 TEST_CASE ("ofi: RegionGroup view and iovec conversion", "[ofi][RegionGroup]")

Function Documentation

◆ TEST_CASE() [1/2]

TEST_CASE ( "ofi: Region constructors" ,
"" [ofi][Constructors] )

Definition at line 10 of file test_Region.cpp.

10 : Region constructors", "[ofi][Constructors]")
11{
12 auto hostLoc = Region::Location::host();
13 REQUIRE(hostLoc.isHost());
14 REQUIRE(hostLoc.id() == 0);
15 REQUIRE(hostLoc.iface() == FI_HMEM_SYSTEM);
16 REQUIRE(hostLoc.toString() == "host");
17
18 auto cudaLoc = Region::Location::cuda(3);
19 REQUIRE_FALSE(cudaLoc.isHost());
20 REQUIRE(cudaLoc.id() == 3);
21 REQUIRE(cudaLoc.iface() == FI_HMEM_CUDA);
22 REQUIRE(cudaLoc.toString() == "cuda, id=3");
23}
Represent a memory region (unregistered).
Definition Region.hpp:24

◆ TEST_CASE() [2/2]

TEST_CASE ( "ofi: RegionGroup view and iovec conversion" ,
"" [ofi][RegionGroup] )

Definition at line 25 of file test_Region.cpp.

25 : RegionGroup view and iovec conversion", "[ofi][RegionGroup]")
26{
27 std::uint64_t dummyGrainIndex = 0;
28 std::uint16_t dummyValidSlices = 0;
29
30 auto r1 = Region{0x1000, 64, &dummyGrainIndex, &dummyValidSlices, Region::Location::host()};
31 auto r2 = Region{0x2000, 128, &dummyGrainIndex, &dummyValidSlices, Region::Location::host()};
32 auto group = RegionGroup({r1, r2});
33 REQUIRE(group.size() == 2);
34
35 auto const* iovecs = group.asIovec();
36 REQUIRE(iovecs[0].iov_base == reinterpret_cast<void*>(0x1000));
37 REQUIRE(iovecs[0].iov_len == 64);
38
39 REQUIRE(iovecs[1].iov_base == reinterpret_cast<void*>(0x2000));
40 REQUIRE(iovecs[1].iov_len == 128);
41}
Represent a group of memory regions.
Definition Region.hpp:136
FabricInfoView view() const noexcept
Return a non-owning view of the FabricInfo.