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:

pip install nixl

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

UCX

NIXL was tested with UCX version 1.19.0.

GDRCopy is available on Github and is necessary for maximum performance, but UCX and NIXL will work without it.

$ wget https://github.com/openucx/ucx/releases/download/v1.19.0/ucx-1.19.0.tar.gz
$ tar xzf ucx-1.19.0.tar.gz
$ cd ucx-1.19.0
$ ./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

$ meson setup <name_of_build_dir> --buildtype=release

Debug build (default)

$ meson setup <name_of_build_dir>

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:

pip install nixl

Or build from source:

# From the root nixl directory
pip install .
pip install <name_of_build_dir>/src/bindings/python/nixl-meta/nixl-*.whl

For Python examples, see examples/python/.

Rust Bindings

Build

  • Use -Drust=true meson option to build rust bindings.
  • Use -Ddebug=false for a release build.
  • 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.7.1-cp312-cp312-manylinux_2_28_x86_64.whl (23.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

nixl_cu12-0.7.1-cp312-cp312-manylinux_2_28_aarch64.whl (22.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

nixl_cu12-0.7.1-cp311-cp311-manylinux_2_28_x86_64.whl (23.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

nixl_cu12-0.7.1-cp311-cp311-manylinux_2_28_aarch64.whl (22.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

nixl_cu12-0.7.1-cp310-cp310-manylinux_2_28_x86_64.whl (23.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

nixl_cu12-0.7.1-cp310-cp310-manylinux_2_28_aarch64.whl (22.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

nixl_cu12-0.7.1-cp39-cp39-manylinux_2_28_x86_64.whl (23.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

nixl_cu12-0.7.1-cp39-cp39-manylinux_2_28_aarch64.whl (22.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ ARM64

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.7.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 759e29c9f75f35bcd0ff425c6ae116cae89aa05b08dad5d7ba9d2a01d2bd9711
MD5 80870563e2a684e5c81012d3884cd343
BLAKE2b-256 65606a2a48f38e9a79c07ec26a5a01cc6d81e2ff6034335eef106ec6273ffb0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.7.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 27426b763e3cc7d70b7abd507f9f25a47b8db61132e4a91152bf9feb05d2a93b
MD5 ad101043453f36b950a2d79d7ca9e6fa
BLAKE2b-256 5fbe21c66735c790d890d20106cfe7bf694efc0456c56d3c46e2010994787155

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.7.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 80de662356c1af0ca7f046b33189412a6231bb050f82228ea2eed79dbc83ce14
MD5 75d37c9b58bbccf42bd802c09de19837
BLAKE2b-256 6898d1803b7d66f066728384b5c2ea4026cab692d0141a89ca199636f20413c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.7.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 12d42b2a356763bc047ce1504d57e2f857d9fe08cf462ada5800cc7a3f5669ed
MD5 a9c9c66205c9621cfab9f14221571075
BLAKE2b-256 431527de16c4e03a8147f28055bd08a9010045521eba6c6bf82671bfd70c31fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.7.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8e1b7ec54cd53a6f0abd697655ab6c46c1025d4b4afc074b4367afba89d96e01
MD5 b93a7891641417311253f9eed5203152
BLAKE2b-256 f510c865e32ede3b6280b282e423af662891af4849b8712e886428ee33dfbc31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.7.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c3cc49d55979a7f1bb7cf569a189479af488ae65b1879f5afc90fd8be30bfa90
MD5 4da7afb63dda9441d704f1a7db67cc86
BLAKE2b-256 68efb1ff98ca04e27c1725534862252029385c05d163035a0ed5cb3014ccd5b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.7.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a2c2e636c337fa4ff978f966c223852d554949c6c9ddad287cbb363bde294da5
MD5 69831f5de1c882491794aa08bcf07945
BLAKE2b-256 a3d5b32e6d4e5282b6d622699f552c90fcd239a6a1762a544b07715cb491a2f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nixl_cu12-0.7.1-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 86a01baf15a28ce8c02a4c18d7167f906555118df14e6107bb45e3e9a40a9bc0
MD5 307ab466f42e592ef043a0b388653698
BLAKE2b-256 6c0dbb69182b9a4cadfc83d41a0a5bebc86fc582a03b3936f48f170e81cafc9d

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