Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:NVIDIA DALI Docker Build

From Leeroopedia
Revision as of 15:53, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/NVIDIA_DALI_Docker_Build.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Build_System, Docker
Last Updated 2026-02-08 16:00 GMT

Overview

Shell script that orchestrates the complete Docker-based build process for NVIDIA DALI, producing Python wheel packages and optional runner images across multiple CUDA versions and architectures.

Description

This build script (docker/build.sh) is the primary single-click entry point for building DALI from source using Docker containers as isolated build environments. It manages a multi-stage Docker build pipeline that includes: building a base dependency image from a manylinux base, layering CUDA toolkit dependencies, compiling DALI itself, and optionally building TensorFlow plugin packages and runner images.

The script supports extensive configuration through environment variables covering CUDA version selection (12.0 through 13.1), Python version, architecture (x86_64 or others), CMake build type, and numerous feature flags controlling which DALI components to build (NVJPEG, OpenCV, LMDB, FFmpeg, etc.). It implements two build modes: an "in-host" mode (default) that mounts the source tree into the container and preserves build artifacts locally, and a "Docker-only" mode that builds entirely within Docker layers.

The script also handles NVIDIA Container Toolkit detection for GPU-accelerated builds, manages Docker image caching and conditional rebuilds, and orchestrates the TensorFlow plugin build process including manylinux compatibility. The final outputs are Python wheel files collected in a wheelhouse/ directory.

Usage

Use this script when building DALI distribution packages from source. It is intended for CI/CD pipelines and developer workflows that need reproducible, containerized builds. Export the desired environment variables before running the script from the docker/ directory.

Code Reference

Source Location

Signature

#!/bin/bash -xe

# Key environment variables and their defaults:
ARCH=${ARCH:-x86_64}
PYVER=${PYVER:-3.10}
CUDA_VERSION=${CUDA_VERSION:-13.1}
NVIDIA_BUILD_ID=${NVIDIA_BUILD_ID:-12345}
CREATE_WHL=${CREATE_WHL:-YES}
CREATE_RUNNER=${CREATE_RUNNER:-NO}
BUILD_TF_PLUGIN=${BUILD_TF_PLUGIN:-NO}
PREBUILD_TF_PLUGINS=${PREBUILD_TF_PLUGINS:-YES}
CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}
BUILD_INHOST=${BUILD_INHOST:-YES}
REBUILD_BUILDERS=${REBUILD_BUILDERS:-NO}

# Docker image naming convention:
# nvidia/dali:${ARCH}.deps
# nvidia/dali:cu${CUDA_VER}_${ARCH}.deps
# nvidia/dali:cu${CUDA_VER}_${ARCH}.build
# nvidia/dali:py${PYV}_cu${CUDA_VER}.run

Import

# Run from the docker/ directory
cd docker && ./build.sh

# Or with environment variables
CUDA_VERSION=12.8 CREATE_WHL=YES ./docker/build.sh

I/O Contract

Inputs

Name Type Required Description
CUDA_VERSION env var No CUDA version to build against (default: 13.1). Accepts 12.0-12.9, 13.0, 13.1
PYVER env var No Python version for runner image (default: 3.10)
ARCH env var No Target architecture (default: x86_64)
CMAKE_BUILD_TYPE env var No CMake build type: Release or Debug (default: Release)
BUILD_INHOST env var No Whether to build in-host with volume mounts (default: YES)
CREATE_WHL env var No Whether to produce wheel packages (default: YES)
CREATE_RUNNER env var No Whether to produce a runner Docker image (default: NO)
BUILD_TF_PLUGIN env var No Whether to build the TensorFlow plugin (default: NO)
REBUILD_BUILDERS env var No Force rebuild of builder images (default: NO)
NVIDIA_BUILD_ID env var No Build identifier for tagging (default: 12345)

Outputs

Name Type Description
wheelhouse/*.whl files DALI Python wheel packages for the specified CUDA version
Docker images images Builder and optional runner Docker images tagged with CUDA and architecture info
dali_tf_sdist/*.tar.gz files TensorFlow plugin source distribution (when BUILD_TF_PLUGIN=YES)

Usage Examples

Basic CUDA 12.8 build

# Build DALI wheels for CUDA 12.8
cd /path/to/DALI
CUDA_VERSION=12.8 docker/build.sh
ls wheelhouse/  # Contains nvidia_dali*.whl

Full build with TF plugin and runner image

# Build everything: wheels, TF plugin, and runner image
CUDA_VERSION=13.0 \
CREATE_WHL=YES \
BUILD_TF_PLUGIN=YES \
CREATE_RUNNER=YES \
PYVER=3.11 \
docker/build.sh

Debug build without host mounting

CMAKE_BUILD_TYPE=Debug \
BUILD_INHOST=NO \
CUDA_VERSION=12.5 \
docker/build.sh

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment