Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Environment:NVIDIA DALI CMake Build Environment

From Leeroopedia


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

Overview

CMake >= 3.25.2, C++20 compiler, and CUDA toolkit environment for building DALI from source and developing custom DALI operators.

Description

This environment provides the complete build toolchain required to compile DALI from source or develop custom DALI operator plugins. DALI requires C++20 (with CUDA C++20 support), CMake >= 3.25.2, and a CUDA-capable compiler. The build system uses CMake to orchestrate compilation of the core C++ library (`dali_core`), kernel library (`dali_kernels`), operator library (`dali_operators`), and Python bindings. Custom operator plugins are built as separate shared libraries (`.so`) that are loaded at runtime via `dlopen`.

Usage

Use this environment when building DALI from source or developing custom DALI operators. This is the mandatory prerequisite for the CMake_Plugin_Build, Operator_Base_Class, Schema_Register_Macros, and RunImpl_CUDA_Kernel implementations.

System Requirements

Category Requirement Notes
OS Linux (manylinux_2_28 compatible) Docker builds use `quay.io/pypa/manylinux_2_28_x86_64`
Hardware NVIDIA GPU Required for CUDA compilation and testing
CMake >= 3.25.2 Hard requirement from CMakeLists.txt
C++ Compiler C++20 support required GCC 10+ or Clang 14+
CUDA Toolkit 12.0+ CUDA C++20 standard (`CMAKE_CUDA_STANDARD 20`)
Disk 20GB+ SSD Full build requires significant space

Dependencies

System Packages

  • `cmake` >= 3.25.2
  • CUDA Toolkit >= 12.0 (NVCC compiler)
  • C++20-capable compiler (GCC 10+, Clang 14+)
  • `protobuf` = 6.31.1 (static build, for TFRecord support)
  • `libprotobuf-static` = 6.31.1
  • `libvorbis` = 1.3.7

Optional Build Dependencies

  • `nvidia-nvimagecodec` (GPU image codec library)
  • `libnvcomp` (GPU compression library)
  • `dali-opencv` (custom OpenCV 4.13.0 static build)
  • `dali-ffmpeg` (custom FFmpeg 8.0.1 build)
  • `jpeg-turbo` (libjpeg-turbo 3.1.12)

Python Packages (for bindings)

  • `setuptools`
  • `astunparse` >= 1.6.0
  • `gast` >= 0.3.3
  • `dm-tree` >= 0.1.8
  • `packaging`
  • `nvtx`
  • `makefun`
  • `black` = 25.12.0 (code formatting)
  • `bandit` (security linting)

Credentials

No credentials required for building. The following build environment variables control features:

  • `CUDA_TARGET_ARCHS`: Comma-separated CUDA architectures to compile for.
  • `CMAKE_BUILD_TYPE`: Build type (`Release`, `Debug`, `RelWithDebInfo`).
  • `BUILD_TEST`: Enable/disable test compilation.
  • `BUILD_NVJPEG`: Enable nvJPEG support.
  • `BUILD_NVDEC`: Enable NVDEC video decoding.
  • `BUILD_LMDB`: Enable LMDB database reading.
  • `WITH_DYNAMIC_CUDA_TOOLKIT`: Dynamic vs static CUDA linking.

Quick Install

# Install build dependencies
apt-get install -y cmake gcc-10 g++-10

# Install CUDA Toolkit
# (Follow NVIDIA CUDA installation guide for your distribution)

# Clone and build DALI
git clone https://github.com/NVIDIA/DALI.git
cd DALI
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release \
      -DBUILD_TEST=OFF \
      -DCUDA_TARGET_ARCHS="70;80;90" \
      ..
make -j$(nproc)

# For custom operator plugin
cmake -DCMAKE_PREFIX_PATH=$(python -c "import nvidia.dali as d; print(d.sysconfig.get_lib_dir())") ..

Code Evidence

CMake version requirement from `CMakeLists.txt:15`:

cmake_minimum_required(VERSION 3.25.2)

C++ and CUDA standard from `CMakeLists.txt:380-385`:

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CUDA_STANDARD 20)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)

Custom operator CMake pattern from `docs/examples/custom_operations/custom_operator/naive_histogram/CMakeLists.txt:1-37`:

cmake_minimum_required(VERSION 3.25.2)
project(naive_histogram LANGUAGES CUDA CXX)
# find_package(DALI) to locate headers and libraries
# target_link_libraries links against dali::dali)

Protobuf dependency from `cmake/Dependencies.cmake:114-135`:

find_package(protobuf REQUIRED CONFIG)
find_package(Protobuf 3.6.1 REQUIRED)

Common Errors

Error Message Cause Solution
`CMake Error: CMake 3.25.2 or higher is required` CMake too old Update CMake: `pip install cmake>=3.25.2`
`error: 'std::format' is not a member of 'std'` Compiler lacks C++20 support Use GCC >= 10 or Clang >= 14
`nvcc fatal: Unsupported gpu architecture 'compute_XX'` CUDA arch not supported by toolkit Update `CUDA_TARGET_ARCHS` to match installed CUDA version
`cannot find -lprotobuf` Protobuf not installed `conda install libprotobuf-static=6.31.1`

Compatibility Notes

  • C++ Standard: C++20 is required for both CPU and CUDA code. C standard is C11.
  • CUDA 13.x: With CUDA 13, Volta (sm_70) is no longer supported, but Turing (sm_75) is still supported. The build system automatically adjusts.
  • Static vs Dynamic Linking: DALI can link CUDA libraries statically or dynamically. Dynamic linking (`WITH_DYNAMIC_CUDA_TOOLKIT=ON`) is default for pip packages.
  • Docker Build: The recommended build method is via `docker/build.sh`, which uses manylinux_2_28 base images for maximum compatibility.

Related Pages

Page Connections

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