Represent the location of a memory region.
More...
#include <Region.hpp>
|
| class | Cuda |
| | Represent a CUDA device memory location variant. More...
|
| class | Host |
| | Represent a host memory location variant. More...
|
|
| std::uint64_t | id () const noexcept |
| | Return the device id. For host location 0 is returned.
|
| ::fi_hmem_iface | iface () const noexcept |
| | Convert the current location to libfabric "iface" representation.
|
| bool | isHost () const noexcept |
| | Return true if the memory location is on host.
|
| std::string | toString () const noexcept |
| | Generate a string representation of the memory location.
|
|
| static Location | cuda (int deviceId) noexcept |
| | specify a CUDA device memory location.
|
| static Location | host () noexcept |
| | specify a host memory location.
|
Represent the location of a memory region.
Definition at line 28 of file Region.hpp.
◆ Inner
◆ Location()
| mxl::lib::fabrics::ofi::Region::Location::Location |
( |
Inner | inner | ) |
|
|
inlineprivate |
◆ cuda()
specify a CUDA device memory location.
- Parameters
-
| deviceId | The CUDA device id. |
Definition at line 28 of file Region.cpp.
29 {
30 return {Region::Location::Cuda{deviceId}};
31 }
◆ host()
specify a host memory location.
Definition at line 23 of file Region.cpp.
24 {
25 return {Region::Location::Host{}};
26 }
◆ id()
| std::uint64_t mxl::lib::fabrics::ofi::Region::Location::id |
( |
| ) |
const |
|
nodiscardnoexcept |
Return the device id. For host location 0 is returned.
Definition at line 33 of file Region.cpp.
34 {
35 return std::visit(
36 overloaded{
38 [](
Host const&) -> std::uint64_t {
return 0; },
39 [](
Cuda const&
cuda) -> std::uint64_t
40 {
41 return static_cast<std::uint64_t
>(
cuda._deviceId);
42 }
43 },
45 }
static Exception invalidState(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INVALID_STATE exception.
Represent a CUDA device memory location variant.
Represent a host memory location variant.
static Location cuda(int deviceId) noexcept
specify a CUDA device memory location.
◆ iface()
| fi_hmem_iface mxl::lib::fabrics::ofi::Region::Location::iface |
( |
| ) |
const |
|
nodiscardnoexcept |
Convert the current location to libfabric "iface" representation.
Definition at line 47 of file Region.cpp.
48 {
49 return std::visit(
50 overloaded{
52 [](
Host const&) -> ::fi_hmem_iface {
return FI_HMEM_SYSTEM; },
53 [](
Cuda const&) -> ::fi_hmem_iface
54 {
55 return FI_HMEM_CUDA;
56 }
57 },
59 }
◆ isHost()
| bool mxl::lib::fabrics::ofi::Region::Location::isHost |
( |
| ) |
const |
|
nodiscardnoexcept |
Return true if the memory location is on host.
Definition at line 61 of file Region.cpp.
62 {
63 return std::holds_alternative<Host>(
_inner);
64 }
◆ toString()
| std::string mxl::lib::fabrics::ofi::Region::Location::toString |
( |
| ) |
const |
|
nodiscardnoexcept |
Generate a string representation of the memory location.
Definition at line 66 of file Region.cpp.
67 {
68 return std::visit(
69 overloaded{
71 [](Location::Host const&) -> std::string { return "host"; },
72 [&](Location::Cuda const&) -> std::string { return fmt::format("cuda, id={}", id()); },
73 },
75 }
◆ _inner
| Inner mxl::lib::fabrics::ofi::Region::Location::_inner |
|
private |
The documentation for this class was generated from the following files: