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

NIXL supports several build options that can be specified during the meson setup phase:

# Basic build setup with default options
$ meson setup <name_of_build_dir>

# Setup with custom options (example)
$ 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 .

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-0.6.1-cp312-cp312-manylinux_2_28_x86_64.whl (23.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

nixl-0.6.1-cp312-cp312-manylinux_2_28_aarch64.whl (22.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

nixl-0.6.1-cp311-cp311-manylinux_2_28_x86_64.whl (23.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

nixl-0.6.1-cp311-cp311-manylinux_2_28_aarch64.whl (22.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

nixl-0.6.1-cp310-cp310-manylinux_2_28_x86_64.whl (23.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

nixl-0.6.1-cp310-cp310-manylinux_2_28_aarch64.whl (22.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

nixl-0.6.1-cp39-cp39-manylinux_2_28_x86_64.whl (23.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

nixl-0.6.1-cp39-cp39-manylinux_2_28_aarch64.whl (22.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ ARM64

File details

Details for the file nixl-0.6.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl-0.6.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8507c73d9bc044dd921edbef81ebae3e0750584a70a63ea90e5ade79233535d2
MD5 e2c46d4aefb170aa4c70970a62cc32ea
BLAKE2b-256 0a3523e3e9ec86fe5512842926a1d6a6c2b9f55b5fc995a516ce215c4da72d72

See more details on using hashes here.

File details

Details for the file nixl-0.6.1-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl-0.6.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 77eab96bef382bfb91b9d6222e5581e49b193fcf573b38dcaa7a296822a2894e
MD5 0d2cad00172854f48debdfbdb4b3e3ef
BLAKE2b-256 54c2e1679421bed63ba5d59d9573cfa64d64fcc6769e6844f9de5df7f62d4fc0

See more details on using hashes here.

File details

Details for the file nixl-0.6.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl-0.6.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 831affb62a6ff6199e41ffdccaab3430cb61bf3ca71e597ca214d2db26620955
MD5 224efeee2fbd161c71a63054ef60a75e
BLAKE2b-256 cdf4baaecd3d5b370f68acbe6d41037fc040a2667c89b7309ece81ca063c2308

See more details on using hashes here.

File details

Details for the file nixl-0.6.1-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl-0.6.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2a9f29718e5dde20ee9e6e5fb25411d1950ab84733e0d4fceb8bb6ccf555a1e5
MD5 072ddc9a1f93d8f73ecbfc4f60aef651
BLAKE2b-256 40066a20c8981535a60b126fbed80b29cf3b812fdb7e5c2f66ba8733fe8b3cb3

See more details on using hashes here.

File details

Details for the file nixl-0.6.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nixl-0.6.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 24e9e98a72839d762bedb8faca010c5878aa0b2d5624a1590d6a588aab1d223e
MD5 b974c25cbf73340a3c02af52b216e592
BLAKE2b-256 546cffff2649d9193373ab4a8e760e49f4b22494fca318fcd0e10da2e2d9bee1

See more details on using hashes here.

File details

Details for the file nixl-0.6.1-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl-0.6.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f562139f23609336e5254b96e07b20b3298cca81ddc7549fa2da6dd788a80564
MD5 70d9f3200f85e0d3b3423b0cb5636c8d
BLAKE2b-256 5dca0373a37612f48a8a712d535db147807dd9fa02e97a03ae3f9106223d2650

See more details on using hashes here.

File details

Details for the file nixl-0.6.1-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: nixl-0.6.1-cp39-cp39-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 23.3 MB
  • Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.18

File hashes

Hashes for nixl-0.6.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7abbaccc88f0330d38e5344efa4a0768fe523e9a0083b785ea60da858d73b265
MD5 6a0885cbd6773631e301cf446dfd8b05
BLAKE2b-256 2b09d6e4fa4db19093ca5b3fa611f1328782647d9fda691e652d8cc962493167

See more details on using hashes here.

File details

Details for the file nixl-0.6.1-cp39-cp39-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nixl-0.6.1-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d28c348371045962b109d5ebf1ab054017fd9c89a6d9167902c62dc793465e2d
MD5 df0d04b5b7db577dfdd56cd9b29054b0
BLAKE2b-256 4fea4cb3b01ff424c165c72e759ab043b4a8faa6272d3f7e39b75eb8667fb620

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