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
$ ./configure                          \
    --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>   \
    --enable-mt
$ 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

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.8.0-cp313-cp313-manylinux_2_28_x86_64.whl (40.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

nixl_cu12-0.8.0-cp313-cp313-manylinux_2_28_aarch64.whl (38.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

nixl_cu12-0.8.0-cp312-cp312-manylinux_2_28_x86_64.whl (40.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

nixl_cu12-0.8.0-cp312-cp312-manylinux_2_28_aarch64.whl (38.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

nixl_cu12-0.8.0-cp311-cp311-manylinux_2_28_x86_64.whl (40.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

nixl_cu12-0.8.0-cp311-cp311-manylinux_2_28_aarch64.whl (38.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

nixl_cu12-0.8.0-cp310-cp310-manylinux_2_28_x86_64.whl (40.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

nixl_cu12-0.8.0-cp310-cp310-manylinux_2_28_aarch64.whl (38.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

nixl_cu12-0.8.0-cp39-cp39-manylinux_2_28_x86_64.whl (40.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

nixl_cu12-0.8.0-cp39-cp39-manylinux_2_28_aarch64.whl (38.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ ARM64

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.8.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 425f0ac36fdd68ad3d68686daa9210350ef82c1a8500f01c5e21c129ac2d1540
MD5 a0c2e74542ecf3efd7069f893802e209
BLAKE2b-256 ffd4e20a0483dd2d63afd512c62ed020172f385fb3d7398ec2b5ea90dcf069e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.8.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2b57cc245bf26a748086462840736276d4b54994fbda25c928e04f6888f1f829
MD5 a0cd2f8459cf637ac31e5df5009731c6
BLAKE2b-256 24f4d37326d075073cc0c7464a0bb3a5d8ae93edd4d11ea563ad75428525b50e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.8.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b8a2c65dec361e3af88699be465edd935f82793cf0d51d48cd5c60509725058f
MD5 13731cc8280cef9c86ccb46eaf0c78bf
BLAKE2b-256 bb9f3f25e805e819a599fa5939d1dd9e449c87196596e6866cecfb6bada969a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.8.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 919e69e5c84def2c2954664e5d551359c27ec6d7295eaa3cb08531f076dab499
MD5 89c7b5a41a1deea6966ed169f9a05b8d
BLAKE2b-256 43e89ad3e08f9467f14f02b840a7fcba1400147cdc3160a8a9ed0fb6cd86b3b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.8.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7cfe0a1984fad97dfcc57862ac7bc3b40b66c3bca032ef76eacfa42cd9c27028
MD5 3b7f05e8f4613b5f0f8b594ada487297
BLAKE2b-256 f5a027053d28f82c5d259b6db604ae12aaa3180d9d425651f71b2a2364921816

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.8.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 29fa819d699fcf640ec45ca1984e295b98c987e4dd448bb92c7939ee3214cb4c
MD5 a14d871eb3ade6bd671a3e3687ba888c
BLAKE2b-256 15b61087beb13c35d5df3835ef7a38624a30c1a8a1ced3b9d5303abfd493d077

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.8.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0c996907e02d32169a220017df18625fca5ad4df3a05819eb293858e7208e6f4
MD5 ae23d73944416f9fa054345aff55f7a7
BLAKE2b-256 f794a691e691b55f7e0fe62a7dcebdbfb8c2586a0939eb7fa62a78eeffc7ba73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.8.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 21cf57f22aaa148f9fbbfa89d5d4bda09f6cd7e211ba149cf1a680a79a2470af
MD5 dfdfe35cc298a9ece0cb0618facd6fc4
BLAKE2b-256 3489b04ce0b04ab451600bf3a5aa36fc630a50582574ed172c665c523a314fe0

See more details on using hashes here.

File details

Details for the file nixl_cu12-0.8.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.8.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0a525dad573f4b94f3c7ed3b649c515709dd5ac00359171b9b5f514a77d3b68c
MD5 4988464123ca869363a524481160aa4c
BLAKE2b-256 6670e0a7eee14e478cf6e77d8d88d9a59993ffc8a52276f410b60aaebaf02dc4

See more details on using hashes here.

File details

Details for the file nixl_cu12-0.8.0-cp39-cp39-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl_cu12-0.8.0-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 297c48269f93ce3ded85640159d4e1dbb31dc6f98b5b4c1088d109c02fcb7b4c
MD5 ae642717b3fc98e8a8863d990f62cb40
BLAKE2b-256 3a1da856eeb393a4dd95dc084881944a9138a6c0536e23433aa7c0d1ae1911c7

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