Tentang
Pustaka Transfer Inferensi NVIDIA (NIXL)
Alat pengembanganPertumbuhan bintang terukur
- dalam 24 jam
- +2
- dalam 7 hari
- +11
- dalam 15 hari
- +27
- dalam 1 bulan
- +40
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliNVIDIA Inference Xfer Library (NIXL)
NVIDIA Inference Xfer Library (NIXL) is targeted for accelerating point to point communications in AI inference frameworks such as NVIDIA Dynamo, while providing an abstraction over various types of memory (e.g., CPU and GPU) and storage (e.g., file, block and object store) through a modular plug-in architecture.
Documentation and Resources
NIXL overview - Core concepts/architecture overview (
docs/nixl.md)NIXL EP - Adaptive expert-parallel dispatch/combine with elasticity (
nixl.runtime.ep)Python API - Python API usage and examples (
docs/python_api.md)Backend guide - Backend/plugin development guide (
docs/BackendGuide.md)Telemetry - Observability and telemetry details (
docs/telemetry.md)Doxygen guide - API/class diagrams overview (
docs/doxygen/nixl_doxygen.md)Doxygen images - Diagram assets (
docs/doxygen/)NIXLBench docs - Benchmark usage guide (
benchmark/nixlbench/README.md)KVBench docs - KVBench workflows and tutorials (
benchmark/kvbench/docs/)Use cases - NIXL usage examples and integrations (
docs/uses.md)AI agent skills - Agent guidance for NIXL docs and installation (
skills/)
Supported Platforms
NIXL is supported on a Linux environment only. It is tested on Ubuntu (22.04/24.04) and Fedora. macOS and Windows are not currently supported; use a Linux host or container/VM.
Pre-build Distributions
PyPI Wheel
The nixl python API and libraries, including UCX, are available directly through PyPI. For example, if you have a GPU running on a Linux host, container, or VM, you can do the following install:
Install with:
pip install nixl
Prerequisites for source build (Linux)
NIXL requires a C++20 compatible compiler (GCC >= 11 or Clang >= 14).
Ubuntu:
sudo apt install build-essential cmake pkg-config
Fedora:
sudo dnf install gcc-c++ cmake pkg-config
Python
pip3 install meson ninja pybind11 tomlkit
UCX
NIXL builds use UCX version 1.24.x by default.
GDRCopy is available on Github and is necessary for maximum performance, but UCX and NIXL will work without it.
git clone https://github.com/openucx/ucx.git
cd ucx
git checkout v1.24.x
./autogen.sh
./contrib/configure-release-mt \
--enable-shared \
--disable-static \
--disable-doxygen-doc \
--enable-optimizations \
--without-avx \
--enable-cma \
--enable-devel-headers \
--with-cuda=<cuda install> \
--with-verbs \
--with-dm \
--with-gdrcopy=<gdrcopy install>
make -j
make -j install-strip
ldconfig
ETCD (Optional)
NIXL can use ETCD for metadata distribution and coordination between nodes in distributed environments. To use ETCD with NIXL:
ETCD Server and Client
sudo apt install etcd etcd-server etcd-client
# Or use Docker
docker run -d -p 2379:2379 \
--name etcd-server \
-e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 \
-e ETCD_ADVERTISE_CLIENT_URLS=http://0.0.0.0:2379 \
quay.io/coreos/etcd:v3.5.1
ETCD CPP API
Installed from https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3
sudo apt install libgrpc-dev libgrpc++-dev libprotobuf-dev protobuf-compiler-grpc
sudo apt install libcpprest-dev
git clone https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git
cd etcd-cpp-apiv3
mkdir build && cd build
cmake ..
make -j$(nproc) && make install
Additional plugins
Some plugins may have additional build requirements, see them here:
Getting started
Build & install
meson setup <name_of_build_dir>
cd <name_of_build_dir>
ninja
ninja install
Build Options
Release build (default)
meson setup <name_of_build_dir>
Debug build
meson setup <name_of_build_dir> --buildtype=debug
NIXL-specific build options
# Example with custom options
meson setup <name_of_build_dir> \
-Dbuild_docs=true \ # Build Doxygen documentation
-Ducx_path=/path/to/ucx \ # Custom UCX installation path
-Dinstall_headers=true \ # Install development headers
-Ddisable_gds_backend=false # Enable GDS backend
Common build options:
build_docs: Build Doxygen documentation (default: false)ucx_path: Path to UCX installation (default: system path)install_headers: Install development headers (default: true for direct Meson builds; disabled for Python wheels)disable_gds_backend: Disable GDS backend (default: false)cudapath_inc,cudapath_lib: Custom CUDA pathsstatic_plugins: Comma-separated list of plugins to build staticallyenable_plugins: Comma-separated list of plugins to build (e.g.-Denable_plugins=UCX,POSIX). Cannot be used withdisable_plugins.disable_plugins: Comma-separated list of plugins to exclude (e.g.-Ddisable_plugins=GDS). Cannot be used withenable_plugins.wheel_variant: Override the suffix of the Python package name,nixl_<variant>(e.g.-Dwheel_variant=rocm10_2yieldsnixl_rocm10_2). Not needed for a normal build: left empty (the default), the build names the package itself,nixl_cu13for a CUDA build andnixl_rocm<X>_<Y>for a build withrocm_pathset and no CUDA.
Building for AMD ROCm
NIXL itself builds vendor-neutrally; CPU-side hardware detection
(hwInfo::numAmdGpus) discovers AMD GPUs via PCI vendor 0x1002 whether or
not a ROCm toolchain is present. ROCm is requested by setting -Drocm_path;
Meson then links HIP when amdhip64 is found under that prefix. An empty
rocm_path means ROCm is not used. HIP is detected independently of CUDA,
so the NVIDIA and AMD plugin stacks can be built together when both toolchains
are present.
benchmark/nixlbench is a separate Meson project and is the exception: a
single translation unit cannot include CUDA and HIP headers together, so one
build targets one stack. Use -Dnixlbench_gpu=cuda|rocm to force a stack
(auto, the default, prefers CUDA); -Duse_rocm=true is a deprecated alias for
-Dnixlbench_gpu=rocm. A build with ROCm and without CUDA names its Python package after the
ROCm release, nixl_rocm<X>_<Y>, so that packages for different ROCm releases can be installed
side by side; pass -Dwheel_variant=<variant> to choose another name.
Building with ROCm support:
# For UCX unit tests with ROCm
meson setup build -Drocm_path=/opt/rocm
# Or specify a custom ROCm path
meson setup build -Drocm_path=/custom/path/to/rocm
Platforms using ROCm / HIP (ROCm-only or CUDA + ROCm co-installed):
UCX— primary transport for AMD GPU memory (requires UCX built with--with-rocm).POSIX,OBJ,AZURE_BLOB,HF3FS,GUSLI,UCCL— vendor-neutral; build unchanged.MOONCAKE— needs a Transfer Engine built with-DUSE_HIP=ONfor AMD GPU memory.AIS— AMD Infinity Storage (hipFile) plugin undersrc/plugins/rocm_ais/. HIP is detected independently of CUDA, so AIS can be built alongside CUDA plugins when ROCm and hipFile are present. Both are found underrocm_path, which must be set to enable ROCm. Seedisable_rocm_ais_backendinmeson_options.txt.GDS/GDS_MT,GPUNETIO,LIBFABRIC(with-DHAVE_CUDA) — on a ROCm-only host they skip automatically when CUDA / cuFile / DOCA are not found.
Known gaps (will be addressed in follow-up PRs):
nixlbench: NVSHMEM and the CUDA-driver VMM/fabric helpers remain NVIDIA-only; VRAM allocation prefers CUDA when both stacks are present.LIBFABRICplugin disabled on ROCm pending header refactor.- No NVSHMEM-equivalent backend yet (rocSHMEM analog is a candidate for a future plugin).
Environment Variables
There are a few environment variables that can be set to configure the build:
NIXL_NO_STUBS_FALLBACK: If not set or 0, build NIXL stub library if the library build fails
Building Documentation
If you have Doxygen installed, you can build the documentation:
# Configure with documentation enabled
meson setup <name_of_build_dir> -Dbuild_docs=true
cd <name_of_build_dir>
ninja
# Documentation will be generated in <name_of_build_dir>/html
# After installation (ninja install), documentation will be available in <prefix>/share/doc/nixl/
Python Interface
NIXL provides Python bindings through pybind11. For detailed Python API documentation, see docs/python_api.md.
The preferred way to install the Python bindings is through pip from PyPI:
pip install nixl
Installation from source
Prerequisites:
uv: https://docs.astral.sh/uv/getting-started/installation/tomlkit: https://pypi.org/project/tomlkit/PyTorch: https://pytorch.org/get-started/locally/
uv is always required even if you have another kind of Python virtual environment manager or if you are using a system-wide Python installation without using a virtual environment.
Example with uv Python virtual environment:
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:${PATH}"
uv venv .venv --python 3.12
source .venv/bin/activate
uv pip install tomlkit
Example with python-virtualenv:
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:${PATH}"
python3 -m venv .venv
source .venv/bin/activate
pip install tomlkit
Example with system-wide Python installation without using a virtual environment:
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:${PATH}"
pip install tomlkit
Then install PyTorch following the instructions on the PyTorch website: https://pytorch.org/get-started/locally/
After installing the prerequisites, you can build and install the NIXL binaries and the Python bindings from source. You have to:
- Build NIXL binaries and install them
- Build and install the CUDA platform-specific package
- Build and install the
nixlmeta-package
pip install .
meson setup build
ninja -C build install
pip install build/src/bindings/python/nixl-meta/nixl-*-py3-none-any.whl
To check if the installation is successful, you can run the following command:
python3 -c "import nixl; agent = nixl.nixl_agent('agent1')"
which should print:
2026-01-08 13:36:27 NIXL INFO _api.py:363 Backend UCX was instantiated
2026-01-08 13:36:27 NIXL INFO _api.py:253 Initialized NIXL agent: agent1
You can also run a complete Python example to test the installation:
python3 examples/python/expanded_two_peers.py --mode=target --use_cuda=true --ip=127.0.0.1 --port=4242 &
sleep 5
python3 examples/python/expanded_two_peers.py --mode=initiator --use_cuda=true --ip=127.0.0.1 --port=4242
For more Python examples, see examples/python/.
Rust Bindings
Build
- Use
-Drust=truemeson option to build rust bindings. - Use
--buildtype=debugfor a debug build (default is release). - Or build manually:
cargo build --release
Install
The bindings will be installed under nixl-sys in the configured installation prefix.
Can be done using ninja, from project build directory:
ninja install
Test
# Rust bindings tests
cargo test
Use in your project by adding to Cargo.toml:
[dependencies]
nixl-sys = { path = "path/to/nixl/bindings/rust" }
Other build options
See contrib/README.md for more build options.
Building Docker container
To build the docker container, first clone the current repository. Also make sure you are able to pull docker images to your machine before attempting to build the container.
Run the following from the root folder of the cloned NIXL repository:
./contrib/build-container.sh
By default, the container is built with Ubuntu 24.04. To build a container for Ubuntu 22.04 use the --os option as follows:
./contrib/build-container.sh --os ubuntu22
To see all the options supported by the container use:
./contrib/build-container.sh -h
The container has the NIXL python bindings preinstalled (built from source against the container's own PyTorch). For a redistributable python wheel, use the wheel build script below or install the published nixl package.
Building the python wheel
Python wheel builds set -Dinstall_headers=false in pyproject.toml,
so installing a wheel does not install the NIXL C++ development headers. This
overrides the default for direct Meson builds listed in Build Options.
For C++ development, follow Build & install with
install_headers enabled. Headers are installed under <prefix>/include
(/opt/nvidia/nvda_nixl/include by default); use Meson's --prefix option to
choose a different installation prefix.
The contrib folder also includes a script to build the python wheel with the UCX dependencies. Note, that UCX and other NIXL dependencies are required to be installed.
./contrib/build-wheel.sh
Running with ETCD
NIXL can use ETCD for metadata exchange between distributed nodes. This is especially useful in containerized or cloud-native environments.
The examples below require NIXL built with ETCD support. Install the ETCD CPP API prerequisites before building NIXL.
Environment Setup
To use ETCD with NIXL, set the following environment variables:
# Set ETCD endpoints (required) - replace localhost with the hostname of the etcd server
export NIXL_ETCD_ENDPOINTS="http://localhost:2379"
# Set ETCD namespace (optional, defaults to /nixl/agents/)
export NIXL_ETCD_NAMESPACE="/nixl/agents/"
Running the ETCD Examples
NIXL includes C++ and Python examples demonstrating metadata exchange and data transfer using ETCD:
# Start an ETCD server as described in "ETCD Server and Client" above
# Set the ETCD env variables as above
# Run the example. The two agents in the example will exchange metadata through ETCD
# and perform data transfers
./<nixl_build_path>/examples/cpp/nixl_etcd_example
To run the Python example from the repository root after installing the Python bindings:
python3 examples/python/nixl_etcd_example.py
nixlbench Benchmark
For more comprehensive testing, the nixlbench benchmarking tool supports ETCD for worker coordination:
# Build nixlbench (see benchmark/nixlbench/README.md for details)
cd benchmark/nixlbench
meson setup build && cd build && ninja
# Run benchmark with ETCD
./nixlbench --etcd-endpoints http://localhost:2379 --backend UCX --initiator_seg_type VRAM
Code Examples
Contributing
For contribution guidelines, see CONTRIBUTING.md (CONTRIBUTING.md).
Third-Party Components
This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.
NIXL Python wheels bundle NVIDIA modules (libuct_ib_mlx5_ext.so, libuct_ib_mlx5_gda.so, libuct_ib_mlx5_gdp.so) licensed under the NVIDIA Proprietary License (LicenseRef-NvidiaProprietary).
Jelajahi proyek terkait
Memuat…