1#![allow(clippy::undocumented_unsafe_blocks)]
11
12use std::sync::Arc;
13
14use local_memory::RdmaLocalMemory;
15use serde::Deserialize;
16use serde::Serialize;
17
18#[macro_use]
19mod macros;
20
21pub mod backend;
22pub mod config;
23pub mod device_selection;
24pub mod efa;
25pub mod local_memory;
26mod rdma_components;
27mod rdma_manager_actor;
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 rdma_components::RdmaRemoteBuffer;
39pub use rdma_components::SegmentScannerFn;
40pub use rdma_components::register_segment_scanner;
42pub use rdma_components::*;
43pub use rdma_manager_actor::*;
44pub use rdmaxcel_sys;
46pub use test_utils::is_cuda_available;
47
48#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
50pub enum RdmaOpType {
51 ReadIntoLocal,
52 WriteFromLocal,
53}
54
55#[derive(Debug)]
57pub struct RdmaOp {
58 pub op_type: RdmaOpType,
59 pub local: Arc<dyn RdmaLocalMemory>,
60 pub remote: RdmaRemoteBuffer,
61}
62
63#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
68pub enum RdmaTransportLevel {
69 Tcp,
71 Nic,
73 Memory,
75}
76
77pub fn print_device_info_if_debug_enabled(context: *mut rdmaxcel_sys::ibv_context) {
80 if std::env::var("MONARCH_DEBUG_RDMA").is_ok() {
81 unsafe {
82 rdmaxcel_sys::rdmaxcel_print_device_info(context);
83 }
84 }
85}
86
87pub fn print_device_info(context: *mut rdmaxcel_sys::ibv_context) {
89 unsafe {
90 rdmaxcel_sys::rdmaxcel_print_device_info(context);
91 }
92}
93
94mod test_utils;