OpenVINO™ Toolkit - NVIDIA GPU plugin
OpenVINO™ NVIDIA GPU plugin is developed in order to enable deep neural networks inference on NVIDIA GPUs, using OpenVINO™ API. The plugin uses custom kernels and [cuBLAS, cuDNN, cuTENSOR libraries*] as a backend.
OpenVINO™ NVIDIA GPU plugin is supported and validated on the following platforms:
OS | GPU |
---|---|
Ubuntu* 20.04 (64-bit) | NVIDIA Quadro RTX 4000 |
OpenVINO™ NVIDIA GPU plugin is not included into Intel® Distribution of OpenVINO™. To use the plugin, it should be built from source code.
NVIDIA GPU plugin uses the following dependencies to be downloaded and installed separately. Upon downloading them the user should agree with license of each component:
- 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
-
Install NVIDIA 460 version of driver from NVIDIA download drivers
-
Install CUDA 11.2 from How to install CUDA
Do not forget to add
<path_to_cuda>/bin/
in PATH variable for exampleexport PATH="<path_to_cuda>/bin:$PATH"
-
Install cuDNN 8.1.0 from How to install cuDNN
-
Install cuTENSOR 1.3.0 from How to install cuTENSOR
In order to build the plugin, you must prebuild OpenVINO™ package from source using this guideline.
Afterwards plugin build procedure is as following:
- Clone
openvino_contrib
repository:
git clone --recurse-submodules --single-branch --branch=master https://github.com/openvinotoolkit/openvino_contrib.git
- Go to plugin directory:
cd openvino_contrib/modules/nvidia_plugin
git checkout develop
- Prepare a build folder:
mkdir build && cd build
-
Build plugin
First of all, switch OpenVINO™ to tag 2022.1.0 and then build it according the instruction How to build
Then build CUDA Plugin with one of 2 options:
-
Using
build.sh
Setup the following environment variables:
export OPENVINO_HOME=<OpenVINO source directory> export OPENVINO_CONTRIB=<OpenVINOContrib 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 nvidia_gpu -j `nproc`
If python available the CUDA Plugin could be compiled with setup.py script as following:
- Clone
openvino_contrib
repository:
git clone --recurse-submodules --single-branch --branch=master https://github.com/openvinotoolkit/openvino_contrib.git
- Go to plugin directory:
cd openvino_contrib/modules/nvidia_plugin
git checkout develop
- Setup
CUDACXX
environment variable to point to the CUDA nvcc compiler like the next (use yours path)
export CUDACXX=/usr/local/cuda-11.2/bin/nvcc
- Add the path to the cuda libraries to the
LD_LIBRARY_PATH
environment variable like the next (use yours path)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.2/bin/nvcc
- Run setup.py build command as follows.
export NVIDIA_PLUGIN_SRC_ROOT_DIR=</path/to/openvino_contrib>/modules/nvidia_plugin
python3 ${NVIDIA_PLUGIN_SRC_ROOT_DIR}/wheel/setup.py build
This will automatically download, build OpenVINO and build CUDA Plugin finally. The location of the resulting library file will be like the next.
${NVIDIA_PLUGIN_SRC_ROOT_DIR}/build/temp.linux-x86_64-3.6/deps/openvino/bin/intel64/Debug/lib/libopenvino_nvidia_gpu_plugin.so
To install CUDA Plugin as python package do all steps except last one from the Build with setup.py
section.
After that installation could be done by running setup.py install command as follows.
export OPENVINO_CONTRIB=</path/to/openvino_contrib>
python3 ${OPENVINO_CONTRIB}/modules/nvidia_plugin/wheel/setup.py install
This command will install dependent openvino package if needed and update it for using with NVIDIA GPU plugin.
First build docker container:
- Install
docker
:
./docker.sh install
su $USER # Relogin for current user
- Download all
*.deb
packages for CUDA and put them in one folder - Build docker container:
CUDA_PACKAGES_PATH=<path to CUDA pakcages> ./docker.sh build
In order to build openvino_nvidia_gpu_plugin in docker, follow the steps:
- Enter the docker container:
docker run --gpus all -it openvino/cudaplugin-2022.1 bin/bash
- Build the OpenVINO and openvino_nvidia_gpu_plugin according the steps described in ## How to build, except 3), 4), 5) steps (this packages already installed in image)
- Commit all your changes in container:
docker commit openvino/cudaplugin-2022.1 <name of new image>
The plugin supports the configuration parameters listed below. All parameters must be set before calling ov::Core::compile_model()
in order to take effect. When specifying key values as raw strings (that is, when using Python API), omit the KEY_
prefix.
Parameter name | Parameter values | Default | Description |
---|---|---|---|
NVIDIA_THROUGHPUT_STREAMS |
NVIDIA_THROUGHPUT_AUTO , or non negative integer values |
1 | Specifies number of CPU "execution" streams for the throughput mode. Upper bound for the number of inference requests that can be executed simultaneously. |
NVIDIA_OPERATION_BENCHMARK |
NVIDIA_YES , NVIDIA_NO |
NVIDIA_NO |
Specifies if operation level benchmark should be run for increasing performance of network |
During compilation of the openvino_nvidia_gpu_plugin, user could specify the following options:
-DCUDA_KERNEL_PRINT_LOG=ON
enables print logs from kernels (WARNING, be careful with this options, could print to many logs)-DENABLE_CUDNN_BACKEND_API
enables cuDNN backend support that could increase performance of convolutions by 20%-DCMAKE_CUDA_ARCHITECTURES=<arch_set>
e.g.-DCMAKE_CUDA_ARCHITECTURES=75
, (CMake documentation). This option overrides the default architectures (CUDA Compute Capabitities) listed inopenvino_contrib/modules/nvidia_plugin/CMakeLists.txt
. This option allows to build the plugin for specific architecture or architecture set. Building for the lesser amount of architectures can significally decrease the size oflibopenvino_nvidia_gpu_plugin.so
. To find out the compute capabitity of nVidia devices in your system, you may use the following command:
nvidia-smi --query-gpu=compute_cap --format=csv
The plugin supports IRv10 and higher. The list of supported layers and its limitations are defined in cuda_opset.md.
- FP32 – Supported
- FP16 – Supported and preferred
- U8 - Not supported
- U16 - Not supported
- I8 - Not supported
- I16 - Not supported
- FP32 - Supported
- FP16 - Supported
- U8 - Not supported
- U16 - Not supported
- I8 - Not supported
- I16 - Not supported
- FP32 – Supported
- FP16 - Not supported
- NCDHW – Not supported
- NCHW - Supported
- NHWC - Supported
- NC - Supported
OpenVINO™ NVIDIA GPU plugin is licensed under Apache License Version 2.0. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.
We welcome community contributions to openvino_contrib
repository.
If you have an idea how to improve the modules, please share it with us.
All guidelines for contributing to the repository can be found here.
* Other names and brands may be claimed as the property of others.