Abstract

This NVIDIA Data Loading Library (DALI) 0.12.0 Installation Guide provides the installation requirements and step-by-step instructions for installing DALI as a beta release. The guide demonstrates how to get compatible MXNet, TensorFlow, and PyTorch frameworks, and install DALI from a binary or GitHub installation. This guide also provides a sample for running a DALI-accelerated pre-configured ResNet-50 model on MXNet, TensorFlow, or PyTorch for image classification training.

For previously released DALI documentation, see DALI Archives.

1. Overview

Deep learning applications require complex, multi-stage pre-processing data pipelines. Such data pipelines involve compute-intensive operations that are carried out on the CPU. For example, tasks such as: load data from disk, decode, crop, random resize, color and spatial augmentations and format conversions, are mainly carried out on the CPUs, limiting the performance and scalability of training and inference.

In addition, the deep learning frameworks have multiple data pre-processing implementations, resulting in challenges such as portability of training and inference workflows, and code maintainability.

NVIDIA Data Loading Library (DALI) is a collection of highly optimized building blocks, and an execution engine, to accelerate the pre-processing of the input data for deep learning applications. DALI provides both the performance and the flexibility of accelerating different data pipelines as a single library. This single library can then be easily integrated into different deep learning training and inference applications.

Highlights of DALI are:
  • Full data pipeline—accelerated from reading disk to getting ready for training/inference.
  • Flexibility through configurable graphs and custom operators.
  • Support for image classification and segmentation workloads.
  • Ease of integration through direct framework plugins and open source bindings.
  • Portable training workflows with multiple input formats - JPEG, PNG (fallback to CPU), TIFF (fallback to CPU), BMP (fallback to CPU), raw formats, LMDB, RecordIO, TFRecord.
  • Extensible for user specific needs through open source license.

2. DALI And NGC

DALI is pre-installed in the NVIDIA GPU Cloud TensorFlow, PyTorch, and MXNet containers in version 18.07 and later.

3. Installing DALI

DALI can be installed either directly using a pre-built binary or by compiling the sources from GitHub.

3.1. Installing Prebuilt DALI Packages

3.1.1. Prerequisites

Ensure you meet the following minimum requirements:

3.1.2. Binary Installation

  • To install the CUDA 9.0-based DALI build using pip, execute:
    $ pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/cuda/9.0 nvidia-dali
  • To install the CUDA 10-based DALI build using pip, execute:
    $ pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/cuda/10.0 nvidia-dali
Note: Starting with DALI 0.6.1 the nvidia-dali package no longer contains prebuilt versions of the DALI TensorFlow plugin, so you need to install the DALI TensorFlow plugin for the currently installed version of TensorFlow.
  • To install the DALI TensorFlow plugin for the CUDA 9.0-based DALI build, execute:
    pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/cuda/9.0 nvidia-dali-tf-plugin 
  • To install the DALI TensorFlow plugin for the CUDA 10-based DALI build, execute:
    pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/cuda/10.0 nvidia-dali-tf-plugin 
Note: Installing the nvidia-dali-tf-plugin package will install nvidia-dali and its dependencies if these dependencies are not already installed.
Note: The package tensorflow-gpu must be installed before attempting to install nvidia-dali-tf-plugin.
Note: The package nvidia-dali-tf-plugin strictly requires that nvidia-dali be of the exact corresponding version. Thus, installing the latest version of nvidia-dali-tf-plugin will replace any older nvidia-dali versions that are already installed, with the latest version of nvidia-dali. To work with older versions of DALI, provide the version explicitly to the pip install command, as below:
OLDER_VERSION=0.6.1
pip install --extra-index-url https://developer.download.nvidia.com/compute/redist nvidia-dali-tf-plugin==$OLDER_VERSION

3.2. Compiling DALI From Source (Bare metal)

3.2.1. Prerequisites

Ensure that you meet the below minimum requirements:

3.2.2. GitHub Installation

  1. Download the DALI source package from GitHub.
    git clone --recursive https://github.com/NVIDIA/dali
    cd dali
    
  2. Create the build directory.
    mkdir build
    cd build
    
  3. Compile DALI.
    1. To build DALI without LMDB support, issue the following command:
      cmake ..
      make -j"$(nproc)"
    2. To build DALI with LMDB support, issue the following command:
      cmake -DBUILD_LMDB=ON ..
      make -j"$(nproc)"
    3. To build DALI using Clang, issue the following command:
      CAUTION:
      This build is experimental, meaning it is not maintained and tested like the default configuration, therefore, it's not guaranteed to work. We recommend using GCC for production builds.
      cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang  ..
      make -j"$(nproc)"

3.2.2.1. CMake Build Parameters

You can use the following optional CMake build parameters when configuring DALI:
BUILD_PYTHON
Use this parameter to build Python bindings. The default is ON.
BUILD_TEST
Use this parameter to include building the test suite. The default is ON.
BUILD_BENCHMARK
Use this parameter to include building benchmarks. The default is ON.
BUILD_LMDB
Use this parameter to build with support for LMDB. The default is OFF.
BUILD_NVTX
Use this parameter to build with NVTX profiling enabled. The default is OFF.
BUILD_TENSORFLOW
Use this parameter to build the TensorFlow plugin. The default is OFF.
WERROR
Treats all build warnings as errors. The default is OFF.
BUILD_JPEG_TURBO(unofficial)
Use this parameter to build with libjpeg-turbo. The default is ON.2
BUILD_NVJPEG(unofficial)
Use this parameter to build with nvJPEG. The default is ON.3

3.2.3. Installing Python Bindings

Issue the pip install dali/python command to install Python bindings.

3.3. Compiling DALI from Source (Docker)

  1. Ensure you installed the below prerequisites:
    • Linux x64
    • Docker. Follow the Docker installation guide here.
  2. Building Docker Image.
    Change directory (cd) into Docker directory and run ./build.sh. If needed, set the following environment variables:
    • PYVER - Python version. Default is 2.7.
    • CUDA_VERSION - CUDA toolkit version. Default is 10.
    • NVIDIA_BUILD_ID - Custom ID of the build. Default is 1234.
    • CREATE_RUNNER - Create Docker image with cuDNN, CUDA and DALI installed inside. It will create the Docker_run_cuda image, which needs to be run using nvidia-docker and DALI wheel in the wheelhouse directory under DALI/`. Default is NO.
    • CREATE_WHL - Create a wheel also. Default is YES.

4. Executing ResNet-50 Input Pipeline

After you’ve installed DALI, you can run a pre-configured, ResNet-50 model accelerated by DALI, on MXNet, PyTorch, and TensorFlow frameworks for image classification training. Each of the following samples offload image loading and augmentation operations onto GPUs.

You can use Python toolchain from the command shell or Jupyter notebook to start the ResNet-50 training session.

The DALI integrated ResNet-50 Python samples are located:

5. FFmpeg

This software uses code of FFmpeg licensed under the LGPLv2.1 and its source can be downloaded here.

FFmpeg was compiled using the following command line:
./configure \ 
	--prefix=/usr/local \
	--disable-static \ 
	--disable-all \ 
	--disable-autodetect \ 
	--disable-iconv \ 
	--enable-shared \
	--enable-avformat \ 
	--enable-avcodec \ 
	--enable-avfilter \ 
	--enable-protocol=file \
	--enable-demuxer=mov,matroska \ 
	--enable-bsf=h264_mp4toannexb,hevc_mp4toannexb 
./make 

6. Uninstalling DALI

Uninstall DALI.
pip uninstall -y nvidia-dali

Notices

Notice

THE INFORMATION IN THIS GUIDE AND ALL OTHER INFORMATION CONTAINED IN NVIDIA DOCUMENTATION REFERENCED IN THIS GUIDE IS PROVIDED “AS IS.” NVIDIA MAKES NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO THE INFORMATION FOR THE PRODUCT, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. Notwithstanding any damages that customer might incur for any reason whatsoever, NVIDIA’s aggregate and cumulative liability towards customer for the product described in this guide shall be limited in accordance with the NVIDIA terms and conditions of sale for the product.

THE NVIDIA PRODUCT DESCRIBED IN THIS GUIDE IS NOT FAULT TOLERANT AND IS NOT DESIGNED, MANUFACTURED OR INTENDED FOR USE IN CONNECTION WITH THE DESIGN, CONSTRUCTION, MAINTENANCE, AND/OR OPERATION OF ANY SYSTEM WHERE THE USE OR A FAILURE OF SUCH SYSTEM COULD RESULT IN A SITUATION THAT THREATENS THE SAFETY OF HUMAN LIFE OR SEVERE PHYSICAL HARM OR PROPERTY DAMAGE (INCLUDING, FOR EXAMPLE, USE IN CONNECTION WITH ANY NUCLEAR, AVIONICS, LIFE SUPPORT OR OTHER LIFE CRITICAL APPLICATION). NVIDIA EXPRESSLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR SUCH HIGH RISK USES. NVIDIA SHALL NOT BE LIABLE TO CUSTOMER OR ANY THIRD PARTY, IN WHOLE OR IN PART, FOR ANY CLAIMS OR DAMAGES ARISING FROM SUCH HIGH RISK USES.

NVIDIA makes no representation or warranty that the product described in this guide will be suitable for any specified use without further testing or modification. Testing of all parameters of each product is not necessarily performed by NVIDIA. It is customer’s sole responsibility to ensure the product is suitable and fit for the application planned by customer and to do the necessary testing for the application in order to avoid a default of the application or the product. Weaknesses in customer’s product designs may affect the quality and reliability of the NVIDIA product and may result in additional or different conditions and/or requirements beyond those contained in this guide. NVIDIA does not accept any liability related to any default, damage, costs or problem which may be based on or attributable to: (i) the use of the NVIDIA product in any manner that is contrary to this guide, or (ii) customer product designs.

Other than the right for customer to use the information in this guide with the product, no other license, either expressed or implied, is hereby granted by NVIDIA under this guide. Reproduction of information in this guide is permissible only if reproduction is approved by NVIDIA in writing, is reproduced without alteration, and is accompanied by all associated conditions, limitations, and notices.

Trademarks

NVIDIA, the NVIDIA logo, and cuBLAS, CUDA, cuDNN, cuFFT, cuSPARSE, DALI, DIGITS, DGX, DGX-1, Jetson, Kepler, NVIDIA Maxwell, NCCL, NVLink, Pascal, Tegra, TensorRT, and Tesla are trademarks and/or registered trademarks of NVIDIA Corporation in the Unites States and other countries. Other company and product names may be trademarks of the respective companies with which they are associated.

1 Items marked unofficial are community contributions that are believed to work but not officially tested or maintained by NVIDIA.
2 Items marked unofficial are community contributions that are believed to work but not officially tested or maintained by NVIDIA.
3 Items marked unofficial are community contributions that are believed to work but not officially tested or maintained by NVIDIA.