Skip to content

How to build NVIDIA GPU Plugin

Ilya Lavrenov edited this page Dec 5, 2022 · 1 revision

Contents

Introduction

OpenVINO™ NVIDIA GPU plugin is not included into Intel® Distribution of OpenVINO™. To use the plugin, it should be built from source code.

Building for Linux

How to build

In order to build the plugin, you must prebuild OpenVINO™ package from source using this guideline.

Afterwards plugin build procedure is as following:

  1. Install one of the following compilers with support of C++17:
  • Install gcc-7 compiler
sudo apt-get update
sudo apt-get install gcc-7 g++7
  • Install clang-8 compiler
sudo apt-get update
sudo apt-get install clang-8 clang++8
  1. Install NVIDIA 460 version of driver from NVIDIA download drivers

  2. Install CUDA 11.2 from How to install CUDA

    Do not forget to add <path_to_cuda>/bin/ in PATH variable for example export PATH="<path_to_cuda>/bin:$PATH"

  3. Install cuDNN 8.1.0 from How to install cuDNN

  4. Install cuTENSOR 1.3.0 from How to install cuTENSOR

  5. Clone openvino_contrib repository:

git clone --recurse-submodules --single-branch --branch=master https://github.com/openvinotoolkit/openvino_contrib.git 
  1. Go to plugin directory:
cd openvino_contrib/modules/nvidia_plugin
git checkout develop
  1. Prepare a build folder:
mkdir build && cd build
  1. Build plugin

    First of all, switch OpenVINO™ to tag 2021.4 and then build it according the instruction How to build

    Then build NVIDIA GPU Plugin with one of 2 options:

  • Using build.sh

    Setup the following environment variables:

    export OPENVINO_HOME=<OpenVINO source directory>
    export OPENVINO_CONTRIB=<OpenVINO Contrib packages source directory>
    export OPENVINO_BUILD_PATH=<OpenVINO build directory>

    Then run one of the following commands:

    # Run cmake configuration (if necessary) and then build
    ../build.sh --build
    
    # Run cmake configuration
    ../build.sh --setup
    
    # For old build delete old configuration, generate new one and then build
    ../build.sh --rebuild
  • Using OpenVINODeveloperPackage

    Run the following command:

    cmake -DOpenVINODeveloperPackage_DIR=<path to OpenVINO package build folder> -DCMAKE_BUILD_TYPE=Release ..
    cmake --build . --target openvino_nvidia_gpu_plugin -j `nproc`

Docker support

Build docker container

First build docker container:

  1. Install docker:
./docker.sh install
su $USER # Relogin for current user
  1. Download all *.deb packages for CUDA and put them in one folder
  2. Build docker container:
CUDA_PACKAGES_PATH=<path to CUDA packages> ./docker.sh build

Build NVIDIA GPU Plugin in docker container

In order to build NVIDIA GPU Plugin in docker, follow the steps:

  1. Enter the docker container:
docker run --gpus all -it openvino/cudaplugin bin/bash
  1. Build the OpenVINO and NVIDIA GPU Plugin according the steps described in ## How to build, except 3), 4), 5) steps (this packages already installed in image)
  2. Commit all your changes in container:
docker commit openvino/cudaplugin <name of new image>