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

Pre-build Distributions

PyPI Wheel

The nixl python API and libraries, including UCX, are available directly through PyPI.

It can be installed for CUDA 12 with:

pip install nixl[cu12]

For CUDA 13 with:

pip install nixl[cu13]

For backwards compatibility, pip install nixl installs automatically nixl[cu12], continuing to work seamlessly for CUDA 12 users without requiring changes to downstream project dependencies.

If both nixl-cu12 and nixl-cu13 are installed at the same time in an environment, nixl-cu13 takes precedence.

Prerequisites for source build

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[cu12]

Or for CUDA 13 with:

pip install nixl[cu13]

To build and install the Python bindings from source, you have to build and install separately the platform-specific package and the nixl meta-package:

On CUDA 12:

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

On CUDA 13:

pip install .
./contrib/tomlutil.py --wheel-name nixl-cu13 pyproject.toml
meson setup build
ninja -C build
pip install build/src/bindings/python/nixl-meta/nixl-*-py3-none-any.whl

For 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

Examples

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_cu12-0.9.0-cp314-cp314-manylinux_2_28_x86_64.whl (43.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

nixl_cu12-0.9.0-cp314-cp314-manylinux_2_28_aarch64.whl (42.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

nixl_cu12-0.9.0-cp313-cp313-manylinux_2_28_x86_64.whl (43.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

nixl_cu12-0.9.0-cp313-cp313-manylinux_2_28_aarch64.whl (42.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

nixl_cu12-0.9.0-cp312-cp312-manylinux_2_28_x86_64.whl (43.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

nixl_cu12-0.9.0-cp312-cp312-manylinux_2_28_aarch64.whl (42.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

nixl_cu12-0.9.0-cp311-cp311-manylinux_2_28_x86_64.whl (43.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

nixl_cu12-0.9.0-cp311-cp311-manylinux_2_28_aarch64.whl (42.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

nixl_cu12-0.9.0-cp310-cp310-manylinux_2_28_x86_64.whl (43.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

nixl_cu12-0.9.0-cp310-cp310-manylinux_2_28_aarch64.whl (42.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

File details

Details for the file nixl_cu12-0.9.0-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.9.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f2cf4c5f76a97e33b16c9c10e98421b31915c1c09eb25da02989dfae6afc6220
MD5 f6723af06e5aa87976ac7017ff86b2d8
BLAKE2b-256 3400cffe27dc3aaae77fa04dbdf7247e18fa0eb9908011cbf260654f21c14847

See more details on using hashes here.

File details

Details for the file nixl_cu12-0.9.0-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.9.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c530dc737f4039778b773cdb62febeeb39e75b9119ba6b76e2b70fd4d3bbc0b9
MD5 da6866cd9c96d90c157ca4f8a84e0ef6
BLAKE2b-256 11379f9ca9bf94a511a78f068046b21710a1cb821649b370d7d4db629f32a6ae

See more details on using hashes here.

File details

Details for the file nixl_cu12-0.9.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.9.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4118a1b67ee23e56bc49ec628f05133938d79086791495d486e74a8bef603f96
MD5 e6d2496fc51867a954cd0e2b7beedaee
BLAKE2b-256 632ce18226951a93badd4213656a606eb68aaf35f850e7910d868c2c19975a34

See more details on using hashes here.

File details

Details for the file nixl_cu12-0.9.0-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.9.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8b572ab47486efb802e79c2e0084bd1022d08f607bb29c15fdfbf5179efc03ae
MD5 594a09bf87125fb2e73cadb9997ace56
BLAKE2b-256 84b93480adb6af8a313c19547d89995b3ea344646150572bc95fd77bf70ac31b

See more details on using hashes here.

File details

Details for the file nixl_cu12-0.9.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.9.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c51e114f0b08d1ed308e2cc48389a70e295c13ed62603e08c6b59d7e39eea001
MD5 370430918b8d7ec2141f1bf029c64627
BLAKE2b-256 6edfcf09bee9c99c1fbb4809ed6e185aaffd2b0e86979c8419effba1d044375f

See more details on using hashes here.

File details

Details for the file nixl_cu12-0.9.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.9.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 94d2cbbebb8aaa6d3b89feb40046dc1a264e46e86626003c70e533a42ac6aa90
MD5 8abbf33e1df0758c62a77a1fd1a3edc6
BLAKE2b-256 77e059eafdda5cdeee1119e92cac22eb4a6f8a5e3b6c484bf0f7575835cb6e08

See more details on using hashes here.

File details

Details for the file nixl_cu12-0.9.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.9.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ea75aa30f63743adb9d56eb642cf9ba792d5c13e27208feec0bdeaf09666ad75
MD5 7dfbd7b5605439d14afbdcd61ced916b
BLAKE2b-256 fa6481b721b23a5e0bd13546a36953fd5c123a63d23a6322aeba47f2514e35ea

See more details on using hashes here.

File details

Details for the file nixl_cu12-0.9.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.9.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9835f98898c04601fd9ebf2ae9d003d877c6f2eb8d84bf6f2c2b84ea76bf9fa2
MD5 3ec090739a891e2d043b0bda0c21087a
BLAKE2b-256 d27f7a5148a5044fb8150d49fd47195052f3172b619337e1c79f5bb76cefac57

See more details on using hashes here.

File details

Details for the file nixl_cu12-0.9.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.9.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0b8a645a008a074398975a4df63a603ef00abccc961129c6a5d43e831c53800b
MD5 4b6d6d963161d1fcc8989aaa8b93dd6b
BLAKE2b-256 933d2acf5812cb796540551fab992f369f4853e72d0ec0e13745f5f2e408e1fa

See more details on using hashes here.

File details

Details for the file nixl_cu12-0.9.0-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.9.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6c3b63c7d409299b86a25121d3926abf2616c5bf0cb1271f81f217d3db5d3232
MD5 d3253e5d8d6e4920496e7255e815e289
BLAKE2b-256 79bd84e1329ec64f0cddcdab831987804f158c93d6255f878ec9b28f13198f5b

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