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::*;
22pub use rdma_manager_actor::*;
23pub use test_utils::is_cuda_available;
24
25/// Print comprehensive RDMA device information for debugging.
26/// Controlled by MONARCH_DEBUG_RDMA environment variable.
27pub fn print_device_info_if_debug_enabled(context: *mut rdmaxcel_sys::ibv_context) {
28    if std::env::var("MONARCH_DEBUG_RDMA").is_ok() {
29        unsafe {
30            rdmaxcel_sys::rdmaxcel_print_device_info(context);
31        }
32    }
33}
34
35/// Print comprehensive RDMA device information for debugging (always prints).
36pub fn print_device_info(context: *mut rdmaxcel_sys::ibv_context) {
37    unsafe {
38        rdmaxcel_sys::rdmaxcel_print_device_info(context);
39    }
40}
41
42#[cfg(test)]
43mod rdma_manager_actor_tests;
44mod test_utils;