metrale_gpu_sys/
lib.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3#![deny(warnings)]
4#![deny(clippy::all)]
5
6//! 2026-09-26: Low-level bindings: the RDMA verbs C shim with its rail
7//! handshake and wire codecs, NCCL (feature `nccl`), NVML and cuFile loaded
8//! with `dlopen`, and NVTX ranges (feature `nvtx`).
9//!
10//! `verbs` and `railset` are compiled only under `cfg(metrale_rdma_verbs)`,
11//! which build.rs emits when it compiles the shim. `env`, `handshake` and
12//! `wire` are always compiled, so their tests run without rdma-core.
13//!
14//! Owner: metrale-gpu-sys.
15//! Invariants: none beyond the types.
16
17pub mod env;
18pub mod handshake;
19pub mod wire;
20
21// 2026-09-26: Also compiled under `test`, so its tests run on hosts without
22// the shim.
23#[cfg(any(metrale_rdma_verbs, test))]
24mod rail_count;
25
26#[cfg(metrale_rdma_verbs)]
27pub mod verbs;
28
29#[cfg(metrale_rdma_verbs)]
30pub mod railset;
31
32#[cfg(metrale_rdma_verbs)]
33pub use railset::{Rail, RailSet, RailSpec};
34#[cfg(metrale_rdma_verbs)]
35pub use verbs::{Gid, MrKeys, Verbs};
36pub use wire::{
37    CacheServerParams, MODE_TCP, MODE_VERBS, RemoteQp, STATUS_ERR, STATUS_OK, VerbsClientParams,
38    VerbsServerParams,
39};
40
41/// 2026-09-26: Whether build.rs compiled the verbs shim, i.e. whether
42/// `cfg(metrale_rdma_verbs)` is set. Always compiled, so tests can assert it
43/// (tests/verbs_probe.rs, metrale-storage's rdma_verbs_probe_tests.rs).
44pub const fn verbs_enabled() -> bool {
45    cfg!(metrale_rdma_verbs)
46}
47
48pub mod cufile;
49#[cfg(feature = "nccl")]
50pub mod nccl;
51pub mod nvml;
52#[cfg(feature = "nvtx")]
53pub mod nvtx;