Skip to main content

NIXL Python API

Project description

NVIDIA 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.

License GitHub Release

Documentation and Resources

  • NIXL overview - Core concepts/architecture overview (docs/nixl.md)

  • 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/)

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

This installs both CUDA 12 and CUDA 13 backends. At runtime, the correct backend is selected automatically based on the CUDA version reported by PyTorch.

Building the wheels

The release wheels are built inside a manylinux container by contrib/build-container.sh, with the same parameters used by the release pipeline (.github/workflows/ci.yml, the build job). Keep the commands below in sync with that workflow.

Note: by default the contrib/Dockerfile.manylinux build below pulls an NVIDIA-internal INFINIA (DDN) libs image. To build the same wheels without the INFINIA plugin — works anywhere, no internal image required — add --no-infinia; see Building without INFINIA.

# CUDA 12, x86_64 — produces the cu12 manylinux_2_28 release wheels
# (NVIDIA-internal: pulls the INFINIA libs image)
./contrib/build-container.sh \
  --base-image nvcr.io/nvidia/cuda \
  --base-image-tag 12.9.1-devel-ubi8 \
  --cuda-version 12.9 \
  --wheel-base manylinux_2_28 \
  --python-versions "3.10,3.11,3.12,3.13,3.14" \
  --os ubuntu24 \
  --arch x86_64 \
  --dockerfile contrib/Dockerfile.manylinux \
  --tag nixl-wheel-build:cu12-x86_64

# CUDA 13:  --base-image-tag 13.0.1-devel-ubi8  --cuda-version 13.0
# aarch64:  --arch aarch64   (build on an arm64 host)

The wheels are written to /workspace/nixl/dist inside the image; extract them with:

cid=$(docker create nixl-wheel-build:cu12-x86_64)
docker cp "$cid:/workspace/nixl/dist" ./dist
docker rm "$cid"
ls dist/*.whl

Building without INFINIA

The INFINIA (DDN) plugin links against DDN's proprietary libred libraries, which are not publicly redistributable, so by default the manylinux build pulls an NVIDIA-internal image. To build the same wheels without INFINIA — no internal image required — add --no-infinia, which substitutes an empty INFINIA stage (meson then finds no red_client and drops the plugin):

./contrib/build-container.sh \
  --base-image nvcr.io/nvidia/cuda \
  --base-image-tag 12.9.1-devel-ubi8 \
  --cuda-version 12.9 \
  --wheel-base manylinux_2_28 \
  --python-versions "3.10,3.11,3.12,3.13,3.14" \
  --os ubuntu24 \
  --arch x86_64 \
  --dockerfile contrib/Dockerfile.manylinux \
  --no-infinia \
  --tag nixl-wheel-build:cu12-x86_64

Extract the wheels the same way (docker create / docker cp .../dist). This produces the full nixl wheel minus the INFINIA backend; all other plugins are unaffected.

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 was tested with UCX version 1.21.x.

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.21.x
$ ./autogen.sh
$ ./contrib/configure-release-mt       \
    --enable-shared                    \
    --disable-static                   \
    --disable-doxygen-doc              \
    --enable-optimizations             \
    --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 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)
  • disable_gds_backend: Disable GDS backend (default: false)
  • cudapath_inc, cudapath_lib: Custom CUDA paths
  • static_plugins: Comma-separated list of plugins to build statically
  • enable_plugins: Comma-separated list of plugins to build (e.g. -Denable_plugins=UCX,POSIX). Cannot be used with disable_plugins.
  • disable_plugins: Comma-separated list of plugins to exclude (e.g. -Ddisable_plugins=GDS). Cannot be used with enable_plugins.
  • wheel_variant: Override the Python wheel variant suffix (e.g. -Dwheel_variant=rocm yields nixl_rocm). Empty (default) = autodetect from the CUDA major version.

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. GPU-side ROCm/HIP build support for the benchmark suite lives in nixlbench — see PR #1647 for the use_rocm / rocm_path options there. When packaging a ROCm wheel, pass -Dwheel_variant=rocm so the wheel is named nixl_rocm.

Plugins on ROCm hosts (CUDA toolchain absent):

  • UCX — primary transport for AMD GPU memory (requires UCX built with --with-rocm).
  • POSIX, OBJ, AZURE_BLOB, HF3FS, MOONCAKE, GUSLI, UCCL — vendor-neutral; build unchanged.
  • GDS / GDS_MT, GPUNETIO, LIBFABRIC (with -DHAVE_CUDA) — skip automatically because their CUDA / cuFile / DOCA dependencies are not found.

Known gaps (will be addressed in follow-up PRs):

  • nixlbench (the NIXL benchmark tool) needs CUDA-driver-API → HIP translation work before it builds on ROCm. Use examples/cpp/nixl_etcd_example for transfer validation in the meantime.
  • LIBFABRIC plugin 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

This installs both CUDA 12 and CUDA 13 backends. At runtime, the correct backend is selected automatically based on the CUDA version reported by PyTorch.

Installation from source

Prerequisites:

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:

  1. Build NIXL binaries and install them
  2. Build and install the CUDA platform-specific package (nixl-cu12 or nixl-cu13)
  3. Build and install the nixl meta-package

For CUDA 12:

pip install .
meson setup build
ninja -C build install
pip install build/src/bindings/python/nixl-meta/nixl-*-py3-none-any.whl

For CUDA 13:

pip install .
./contrib/tomlutil.py --wheel-name nixl-cu13 pyproject.toml
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=true meson option to build rust bindings.
  • Use --buildtype=debug for 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 also includes a prebuilt python wheel in /workspace/dist if required for installing/distributing. Also, the wheel can be built with a separate script (see below).

Building the python wheel

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.

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 Example

NIXL includes an example demonstrating metadata exchange and data transfer using ETCD:

# Start an ETCD server if not already running
# For example:
# docker run -d -p 2379:2379 quay.io/coreos/etcd:v3.5.1

# 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/nixl_etcd_example

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nixl_cu13-1.3.1-cp314-cp314-manylinux_2_28_x86_64.whl (66.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

nixl_cu13-1.3.1-cp314-cp314-manylinux_2_28_aarch64.whl (64.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

nixl_cu13-1.3.1-cp313-cp313-manylinux_2_28_x86_64.whl (66.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

nixl_cu13-1.3.1-cp313-cp313-manylinux_2_28_aarch64.whl (64.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

nixl_cu13-1.3.1-cp312-cp312-manylinux_2_28_x86_64.whl (66.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

nixl_cu13-1.3.1-cp312-cp312-manylinux_2_28_aarch64.whl (64.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

nixl_cu13-1.3.1-cp311-cp311-manylinux_2_28_x86_64.whl (66.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

nixl_cu13-1.3.1-cp311-cp311-manylinux_2_28_aarch64.whl (64.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

nixl_cu13-1.3.1-cp310-cp310-manylinux_2_28_x86_64.whl (66.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

nixl_cu13-1.3.1-cp310-cp310-manylinux_2_28_aarch64.whl (64.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

File details

Details for the file nixl_cu13-1.3.1-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl_cu13-1.3.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e65c2ff8fe9c242e28efa218d16e5fb3a84d38e792f3f35f9bab724b043660d1
MD5 4dab5d49e4865dcbc8184215a00a036d
BLAKE2b-256 4810e299be68d957b1ce1f19e56fcf6dd8d8ddb03d1b89eb4f2f3d551c3f92e1

See more details on using hashes here.

File details

Details for the file nixl_cu13-1.3.1-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl_cu13-1.3.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 81e4b84d96e6f2d69559cbb8f5a65d3a78909228dd4f7531d258770d1c8a2b9f
MD5 016c569e0ed94af2f51a2b959fe3227f
BLAKE2b-256 4097f1a0aa7f6ae11c16c5e71b0253d9787d8848b020ac7be6f478dcc7444129

See more details on using hashes here.

File details

Details for the file nixl_cu13-1.3.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl_cu13-1.3.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2595d9ce5f2bcdcc60e715352676d5ac74ba09ec7a297ab0387aabfff310577f
MD5 26aca0b630bc8bb8b7aba648e2f0fd8e
BLAKE2b-256 44d3ec8f364903c8fa91496581465774b1ed4c05c5c162921f6756e3162fed88

See more details on using hashes here.

File details

Details for the file nixl_cu13-1.3.1-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl_cu13-1.3.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 468853dff5554f35301a56362a88b648708af27d20d3a4799f836097058413ca
MD5 33af526bbb4e3de32e4df331ed98fa4b
BLAKE2b-256 b5626751b7fdb5f7f258fcd5e58d67cdf3595475a7b3808633752f71b31fd652

See more details on using hashes here.

File details

Details for the file nixl_cu13-1.3.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl_cu13-1.3.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 62c874d58871f45cdd2ce049c3513db72717965e998aa84033055e91a644e372
MD5 7dcc5c1be4d25122f1bac898919729b2
BLAKE2b-256 f6678e68e715bb0a48fe63d3eddd3b8e3428a459b20185908c156daa2f63def3

See more details on using hashes here.

File details

Details for the file nixl_cu13-1.3.1-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl_cu13-1.3.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0671bf75a81e3662e8108b619a1616926e27422b093270d64d0256198f9a35fb
MD5 39d44789ceda3bb4faf048c1ef99008f
BLAKE2b-256 0a7e3832d30e53a8e3dee50a704a4af27c96e50b566564ed32bad6ae3d5cd17b

See more details on using hashes here.

File details

Details for the file nixl_cu13-1.3.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl_cu13-1.3.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7753db8806a099857fb332e0d03c32827657269a281c17e2f53679729427fdad
MD5 b13d38e67c5436d959b85f66ad5f0434
BLAKE2b-256 fe98ff06cf004e571bc0d4200d74df311642fdada1b44d68637762633a662bf8

See more details on using hashes here.

File details

Details for the file nixl_cu13-1.3.1-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl_cu13-1.3.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dd23c592cef4a8abe131d3d2ac130d5299f725dbfb4325475ee9748d64605314
MD5 822c99c846dd6b87a6a51cb1e8b1e12c
BLAKE2b-256 4c351532fbc60f75741a8a8ac86d776a81d6eafcd787c52920a3f6f6a99b7dec

See more details on using hashes here.

File details

Details for the file nixl_cu13-1.3.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl_cu13-1.3.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4663bff0eea59362bc1a7e0b5aa6faa78648bf774702ff0c78f706759a23af03
MD5 759bdae46245b846a02aebd518354a4c
BLAKE2b-256 9f2d5100553f7ddbfe49a371cfc7433b11d54f878505de0b4368dd52a7e2d997

See more details on using hashes here.

File details

Details for the file nixl_cu13-1.3.1-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl_cu13-1.3.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9b6bfae407b0ec768f53e79e8985b74aad5e51a458993ceb4edf4ddcc19eb551
MD5 eaebcdce67805a8bd972fbb9c0b769d3
BLAKE2b-256 e0e34aa8476ee3357a157e68fd08be45535dfb1d9e30908d8c36b4070cfea34a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page