Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set(WITH_CPU ON CACHE INTERNAL "CPU backend is always enabled")
# --- BACKEND OPTIONS (Communication Protocols) ---
# =========================================================
option(WITH_OMPI "Enable OpenMPI backend" OFF)
option(WITH_IBV "Enable IBV backend" OFF)
option(WITH_MPICH "Enable MPICH backend" OFF)
option(WITH_NCCL "Enable NCCL backend" OFF)
option(WITH_MCCL "Enable MCCL backend" OFF)
Expand Down Expand Up @@ -117,6 +118,27 @@ if(AUTO_DETECT_BACKENDS)
message(STATUS "Auto-detected MPICH/Hydra environment.")
endif()

# Detect IBV dependencies and an available IBV device.
if(NOT WITH_IBV)
find_program(IBV_DEVINFO_PATH ibv_devinfo)
find_path(AUTO_IBVERBS_INCLUDE_DIR NAMES infiniband/verbs.h QUIET)
find_library(AUTO_IBVERBS_LIBRARY NAMES ibverbs QUIET)

if(IBV_DEVINFO_PATH AND AUTO_IBVERBS_INCLUDE_DIR AND
AUTO_IBVERBS_LIBRARY)
execute_process(
COMMAND ${IBV_DEVINFO_PATH}
RESULT_VARIABLE IBV_DEVINFO_RESULT
OUTPUT_QUIET
ERROR_QUIET
)
if(IBV_DEVINFO_RESULT EQUAL 0)
set(WITH_IBV ON)
message(STATUS "Auto-detected IBV environment.")
endif()
endif()
endif()

# Detect NCCL Dependencies
if(WITH_NVIDIA OR WITH_THEAD OR WITH_ILUVATAR OR WITH_HYGON)
infiniccl_probe_nccl(NCCL_FOUND)
Expand Down Expand Up @@ -167,7 +189,7 @@ if(AUTO_DETECT_BACKENDS)
endif()

# Fallback: If no backends are enabled or auto-detected, fall back to OpenMPI as the default bootstrap profile.
if(NOT WITH_OMPI AND NOT WITH_MPICH AND NOT WITH_NCCL AND NOT WITH_MCCL AND NOT WITH_CNCL AND NOT WITH_HCCL)
if(NOT WITH_OMPI AND NOT WITH_MPICH AND NOT WITH_NCCL AND NOT WITH_MCCL AND NOT WITH_CNCL AND NOT WITH_HCCL AND NOT WITH_IBV )
set(WITH_OMPI ON)
message(STATUS "No backend specified or detected. Defaulting to `WITH_OMPI=ON`")
endif()
Expand Down Expand Up @@ -219,6 +241,12 @@ if(WITH_OMPI OR WITH_MPICH)
find_package(MPI REQUIRED)
endif()

if(WITH_IBV)
find_path(IBVERBS_INCLUDE_DIR NAMES infiniband/verbs.h REQUIRED)
find_library(IBVERBS_LIBRARY NAMES ibverbs REQUIRED)
find_package(Threads REQUIRED)
endif()

if(WITH_NCCL)
infiniccl_configure_nccl(NCCL_INC NCCL_LIB NCCL_COMPILE_DEFINITIONS)
include_directories(${NCCL_INC})
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ cmake .. -DWITH_NVIDIA=ON -DWITH_OMPI=ON
| `WITH_CPU` | CPU support (always enabled) | `ON` (internal, not user‑settable) |
| **Backend (Communication) Options** |||
| `WITH_OMPI` | Enable OpenMPI backend | `ON` if no backend specified, otherwise `OFF` |
| `WITH_IBV` | Enable experimental IBV backend | `OFF` |
| `WITH_MPICH` | Enable MPICH backend | `OFF` |
| `WITH_NCCL` | Enable NCCL/RCCL backend | `OFF` |
| `WITH_MCCL` | Enable MCCL backend | `OFF` |
Expand Down Expand Up @@ -361,6 +362,7 @@ export LD_LIBRARY_PATH=${INFINI_INSTALL}/lib:$LD_LIBRARY_PATH
| Backend | Support Level | Required CMake Option | Dependencies |
|---------|---------------|----------------------|---------------|
| **OpenMPI** | Full | `WITH_OMPI=ON` | The default backend. Requires the OpenMPI development package.|
| **IBV** | Experimental | `WITH_IBV=ON` | Requires Linux and `libibverbs`. Two-rank synchronous Send/Recv with Host buffers, NVIDIA peer-memory (`WITH_NVIDIA=ON`, CUDA ≥ 11.3, compatible `nvidia-peermem`), or experimental MetaX DMA-BUF (`WITH_METAX=ON`, MACA/mxkw and explicit opt-in). Messages are limited by negotiated port and verbs scatter-gather limits.|
| **MPICH** | Full | `WITH_MPICH=ON` | Requires the MPICH development package.|
| **NCCL** | Partial | `WITH_NCCL=ON` | Requires NVIDIA, Iluvatar, or T-Head NCCL, or HYGON RCCL. Currently available when `WITH_NVIDIA=ON`, `WITH_ILUVATAR=ON`, `WITH_HYGON=ON` or `WITH_THEAD=ON`.|
| **MCCL** | Partial | `WITH_MCCL=ON` | Requires MetaX or Moore MCCL. Currently available when `WITH_METAX=ON` or `WITH_MOORE=ON`.|
Expand Down
10 changes: 10 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ foreach(source_file ${EXAMPLE_SOURCES})

target_link_libraries(${target_name} PRIVATE infiniccl)

if(target_name STREQUAL "ibv_send_recv" AND WITH_IBV)
if(WITH_NVIDIA AND WITH_METAX)
message(FATAL_ERROR "The IBV example requires one accelerator runtime per build.")
elseif(WITH_NVIDIA)
target_compile_definitions(${target_name} PRIVATE INFINICCL_WITH_NVIDIA_IBV)
elseif(WITH_METAX)
target_compile_definitions(${target_name} PRIVATE INFINICCL_WITH_METAX_IBV)
endif()
endif()

# Add runtime and backend dependencies for direct runtime/backend usage.
if(WITH_NVIDIA)
target_link_libraries(${target_name} PRIVATE CUDA::cudart)
Expand Down
Loading