monarch_rdma/
lib.rs

1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9// RDMA requires frequent unsafe code blocks
10#![allow(clippy::undocumented_unsafe_blocks)]
11
12pub mod device_selection;
13mod ibverbs_primitives;
14mod rdma_components;
15mod rdma_manager_actor;
16
17#[macro_use]
18mod macros;
19
20pub use ibverbs_primitives::*;
21pub use rdma_components::SegmentScannerFn;
22// Re-export segment scanner types for extension crate
23pub use rdma_components::register_segment_scanner;
24pub use rdma_components::*;
25pub use rdma_manager_actor::*;
26// Re-export rdmaxcel_sys for extension crate to access types
27pub use rdmaxcel_sys;
28pub use test_utils::is_cuda_available;
29
30/// Print comprehensive RDMA device information for debugging.
31/// Controlled by MONARCH_DEBUG_RDMA environment variable.
32pub fn print_device_info_if_debug_enabled(context: *mut rdmaxcel_sys::ibv_context) {
33    if std::env::var("MONARCH_DEBUG_RDMA").is_ok() {
34        unsafe {
35            rdmaxcel_sys::rdmaxcel_print_device_info(context);
36        }
37    }
38}
39
40/// Print comprehensive RDMA device information for debugging (always prints).
41pub fn print_device_info(context: *mut rdmaxcel_sys::ibv_context) {
42    unsafe {
43        rdmaxcel_sys::rdmaxcel_print_device_info(context);
44    }
45}
46
47#[cfg(test)]
48mod rdma_manager_actor_tests;
49mod test_utils;