1#![allow(clippy::undocumented_unsafe_blocks)]
11
12use local_memory::KeepaliveLocalMemory;
13use serde::Deserialize;
14use serde::Serialize;
15
16#[macro_use]
17mod macros;
18
19mod action;
20pub mod backend;
21pub mod config;
22pub mod device_selection;
23pub mod efa;
24pub mod local_memory;
25mod rdma_components;
26mod rdma_manager_actor;
27mod rdma_runtime;
28
29pub use backend::ibverbs::primitives::*;
30
31pub fn rdma_supported() -> bool {
36 ibverbs_supported() || hyperactor_config::global::get(config::RDMA_ALLOW_TCP_FALLBACK)
37}
38pub use action::RdmaAction;
39pub use backend::ibverbs::mlx_domain::CudaSegmentScanner;
42pub use backend::ibverbs::mlx_domain::ScannedSegment;
43pub use backend::ibverbs::mlx_domain::register_cuda_segment_scanner;
44pub use rdma_components::RdmaRemoteBuffer;
45pub use rdma_components::*;
46pub use rdma_manager_actor::*;
47pub use rdmaxcel_sys;
49pub use test_utils::is_cuda_available;
50
51#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
53pub enum RdmaOpType {
54 ReadIntoLocal,
55 WriteFromLocal,
56}
57
58#[derive(Debug)]
60pub struct RdmaOp {
61 pub op_type: RdmaOpType,
62 pub local: KeepaliveLocalMemory,
63 pub remote: RdmaRemoteBuffer,
64}
65
66#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
71pub enum RdmaTransportLevel {
72 Tcp,
74 Nic,
76 Memory,
78}
79
80pub fn print_device_info_if_debug_enabled(context: *mut rdmaxcel_sys::ibv_context) {
83 if std::env::var("MONARCH_DEBUG_RDMA").is_ok() {
84 unsafe {
85 rdmaxcel_sys::rdmaxcel_print_device_info(context);
86 }
87 }
88}
89
90pub fn print_device_info(context: *mut rdmaxcel_sys::ibv_context) {
92 unsafe {
93 rdmaxcel_sys::rdmaxcel_print_device_info(context);
94 }
95}
96
97mod test_utils;