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.

Prerequisites for source build (Linux)

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

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.1.0-cp314-cp314-manylinux_2_28_x86_64.whl (36.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

nixl_cu13-1.1.0-cp314-cp314-manylinux_2_28_aarch64.whl (35.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

nixl_cu13-1.1.0-cp313-cp313-manylinux_2_28_x86_64.whl (36.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

nixl_cu13-1.1.0-cp313-cp313-manylinux_2_28_aarch64.whl (35.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

nixl_cu13-1.1.0-cp312-cp312-manylinux_2_28_x86_64.whl (36.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

nixl_cu13-1.1.0-cp312-cp312-manylinux_2_28_aarch64.whl (35.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

nixl_cu13-1.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (36.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

nixl_cu13-1.1.0-cp311-cp311-manylinux_2_28_aarch64.whl (35.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

nixl_cu13-1.1.0-cp310-cp310-manylinux_2_28_x86_64.whl (36.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

nixl_cu13-1.1.0-cp310-cp310-manylinux_2_28_aarch64.whl (35.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

File details

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

File metadata

File hashes

Hashes for nixl_cu13-1.1.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 90c27cfdae0932f8ecb96ce29474249dd25d7f7712b9f43821cdb57699888fcb
MD5 e77e41426ae3c2cfb712a82d41b3d692
BLAKE2b-256 83e4eeea0ccc500540ce14e759d713df0c28a280c4f87f47681e074d935080a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-1.1.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 52b1e33ed9613df277d957cf1282cda14fbdf7b73006d8f45904cc68619e7af9
MD5 71a0002f512ec2ae93b9c23856862a00
BLAKE2b-256 fd091f1a1a4cb8560ae44ff0ecb2813b93bdce87de615683af63fb4c2bd2c7ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-1.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1991d7899603907099f3e3ac3bf59f950de194bfe8d92c01ef9f06ce1639efa4
MD5 c710a2af6104082cda83e31eaab307e8
BLAKE2b-256 fffd2540266b4257dc2330ff8dcd469e07b4e55d15c3b48cb773ca882923da37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-1.1.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1c4e8142eff7cabe6107b3b65bc7a09da27ed585efb7972e45b1faabe74726c7
MD5 f659f181ecf47254942550cfd3c27be5
BLAKE2b-256 62bb1d1f52de1551918f44f6c112584526cbf4347c8475d27c41de783f6d95da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-1.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 60cc00b12871d8c7d78c2385ad9380070424d5b07d3fe01680f222d6c4f1f428
MD5 667451dda05def60c4c0d1b307c643a2
BLAKE2b-256 13ada3ee9b2cad49e42b2b215d07f55afe0ad38d671d72b6cbd573c98d5a75ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-1.1.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4e6031798b0a123d1821db698b1f9b3a1534c821af860ee0ef23601638c50d8f
MD5 f7630150fd5534ffcd6b5833b7e6fdcf
BLAKE2b-256 b5de2a56dba6b9d1e5bc5f7ef8a1cbe3969054548bb7e0cdb10b5a8f56e31790

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-1.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6549dcb4f405f70903534a0770970ab95ed9185a8b16522db1ab4e2d0cc60b37
MD5 af1e67a3dda42d0c51a89446df7460f5
BLAKE2b-256 a1f1b55c8972a43cdc68027325e78ef504d69c5deb26e548041d0879d1292bda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-1.1.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e8edf4b0d6a7549d8555fe1a99193aebd522b7737c405c3f8760f432d82e11df
MD5 e7c9b1e29e74eff64a9d6ba2b4dc69a4
BLAKE2b-256 70ffce46627e3691894250ff609aa051c97968a232d599cbfdd4ef267d9bea7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-1.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3f623b77fd59199afd71edadebb79ab394ec5e035873efe8a9bc8b4716b34e73
MD5 36dcaa817d56c3014be9bdc25a7ae57b
BLAKE2b-256 f6789fab20dbbaa0d3a1dde5351933b83f46cb11d5dd2b5800aaeb3b15d91b7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-1.1.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 67149f7d2e3d471ca91499e5437d7b718e4e3e7a27f3b5b917f94b8992a4ed5a
MD5 f613e7179ddcc77204b93ceb61a7e26a
BLAKE2b-256 4065c9f7bbd18862620c691b15d41a182867a8d43889dd99b145671f10e958fc

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