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

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

nixl_cu13-0.9.0-cp314-cp314-manylinux_2_28_aarch64.whl (42.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

nixl_cu13-0.9.0-cp313-cp313-manylinux_2_28_x86_64.whl (43.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

nixl_cu13-0.9.0-cp313-cp313-manylinux_2_28_aarch64.whl (42.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

nixl_cu13-0.9.0-cp312-cp312-manylinux_2_28_x86_64.whl (43.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

nixl_cu13-0.9.0-cp312-cp312-manylinux_2_28_aarch64.whl (42.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

nixl_cu13-0.9.0-cp311-cp311-manylinux_2_28_x86_64.whl (43.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

nixl_cu13-0.9.0-cp311-cp311-manylinux_2_28_aarch64.whl (42.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

nixl_cu13-0.9.0-cp310-cp310-manylinux_2_28_x86_64.whl (43.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

nixl_cu13-0.9.0-cp310-cp310-manylinux_2_28_aarch64.whl (42.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

File details

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

File metadata

File hashes

Hashes for nixl_cu13-0.9.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e07adf554e3f0c1345ca55dc0c25f7eef90d72e9f4e9b2de93c8a023fa0e9596
MD5 adb8158fa01a48c51993a83f1e6983b8
BLAKE2b-256 510f0e1eab7984f2ac4b84354f20f192302cbe7abb173c2f93fe8f3e68ae1b7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-0.9.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 72db01875c5275c79317940641d8c95536ec119b3d96d91031fae363cd33aefa
MD5 2f674918bf6f3b5ddda2bb32e3c94512
BLAKE2b-256 167aa7673972f292cea9fdf5e3a1826a5e3b692054061d45f8ab706481c0a34a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-0.9.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ad6c84af7453c793547a8d81151c14024ae9e8394c1a5c2bd25addf1d5d78dd2
MD5 90d74158734d9aaac0e09aa4ca37b000
BLAKE2b-256 7bfbee447e468b0636d580b76148305b6ab3421936f74daeec2cdf6dbf7efe1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-0.9.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 08512e2f0c72ef74572bbebd26cc3d689d2d26fab00bbcdffe7c0bc1e930cc4a
MD5 1d3c1dd067dfb1ffefd96d1d78334f6e
BLAKE2b-256 ae2b7f6d77844939ead2058445ce429427362a541f477ef6403a323375b34bbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-0.9.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ef0684442cf1d0f50e2958b29f1e4d956c38cfd2f85053b2b08f02eca63da8a6
MD5 52e0ba9652558da3dd561e582a82cf10
BLAKE2b-256 23f6fc1a043ec74a499b5bab49a4b45331d85fe463b6f43b0afd05f841fe8a35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-0.9.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4481c208e1a7ea32b271ed5d7be90d4d40694583b5fbc1374aa62d95d176eb7d
MD5 d5941d91e4209363077057a38f3ee7b9
BLAKE2b-256 e9135d478a1acb2a256e93cda5d31bcaf3eabe86a611bc63a2e011d79b5af016

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-0.9.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c63c03df5fe4bdd7b40f9df28ad1d11c04cf16b1330d88ed4e6620619f82dbec
MD5 0cd473f22c301470cfdc6dd0868a0c18
BLAKE2b-256 683fb63e1644256989ce72f59c01ee46e4c9c61eed951eb249b790cb50f8c8f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-0.9.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f123f6d43316eba50d4d01783afdf0cead50ff33c5c81fb2e4a07ffae114305f
MD5 f84f2a8f66035bb21ee7070afb94e9e7
BLAKE2b-256 440fb884180f61128e03173f7fd1007546bf033adda6fbd8cec7f6f472508a9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-0.9.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4691e477d5b95499b3c0f6d7d293741f6591ee0e23f4adbfcd2fa27e7f6dec2e
MD5 975753bb39d9d0e73a0e2c9be41deb42
BLAKE2b-256 abbd9105fe785c1347f6b844b4408c1466cd7f24bc780b8611f001b8838f8d6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu13-0.9.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b646a47afc152050b2e1e182ca3a2587747eca080f7b6ff5a3da03e9164b3aa9
MD5 30982c2fb710a97c14287bfe71fe9703
BLAKE2b-256 0f205bfd55ec1245da53fbcbdcd1fdc05796295ed81482931db293a2a3e71705

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