Skip to content

Commit

Permalink
Merge pull request #8 from NVIDIA-AI-IOT/dev/ds/ds6.4
Browse files Browse the repository at this point in the history
update for DS 6.4 dockerfiles
  • Loading branch information
nv-ad authored Dec 19, 2023
2 parents c845121 + 2e84f36 commit 800dd7e
Show file tree
Hide file tree
Showing 30 changed files with 889 additions and 487 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down
183 changes: 153 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# DeepStream 6.3 Open Source Dockerfiles Guide
# DeepStream 6.4 Open Source Dockerfiles Guide

The documentation here is intended to help customers build the Open Source DeepStream Dockerfiles.
This information is useful for both x86 systems with dGPU setup and on NVIDIA Jetson devices.

## 1 Additional Installations to use all DeepStreamSDK Features within the docker container.

With DS 6.3, DeepStream docker containers do not package libraries necessary for certain multimedia operations like audio data parsing, CPU decode, and CPU encode. This change could affect processing certain video streams/files like mp4 that include audio tracks.
Since DS 6.3, deepStream docker containers do not package libraries necessary for certain multimedia operations like audio data parsing, CPU decode, and CPU encode. This change could affect processing certain video streams/files like mp4 that include audio tracks.

Please run the below script inside the docker images to install additional packages that might be necessary to use all of the DeepStreamSDK features :

Expand All @@ -25,7 +25,7 @@ Please refer to the Prerequisites section at DeepStream NGC page [NVIDIA NGC](ht
1) Please download the [DeepStreamSDK release](https://developer.nvidia.com/deepstream-getting-started) x86 tarball and place it locally
in the ``$ROOT/x86_64`` folder of this repository.

``cp deepstream_sdk_v6.3.0_x86_64.tbz2 x86_64/ ``
``cp deepstream_sdk_v6.4.0_x86_64.tbz2 x86_64/ ``

2) `image_url` is the desired docker name:TAG

Expand All @@ -43,23 +43,33 @@ Refer to [Section 2.1.3 x86 Build Command](#213-x86-Build-Command) for sample co
Note: These packages (uff-converter-tf and graphsurgeon-tf) are now included by default.


#### 2.1.2.2 For x86 samples docker the TensorRT 8.5.3.1 install is required for the Docker builds
#### 2.1.2.2 For x86 samples docker the TensorRT 8.6.1 and CuDNN 8.9.4 install is required for the Docker builds

Download file link: [nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_amd64.deb](https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.5.3/local_repos/nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_amd64.deb) from TensorRT download page.
Download file link: [nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-12.0_1.0-1_amd64.deb](https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.6.1/local_repos/nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-12.0_1.0-1_amd64.deb) from TensorRT download page.
Note: You may have to login to [developer.nvidia.com](https://developer.nvidia.com/) to download the file.
Quick Steps:
$ROOT is the root directory of this git repo.
``cd $ROOT/x86_64``

``cp nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_amd64.deb x86_64/ ``
``cp nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-12.0_1.0-1_amd64.deb x86_64/ ``

Also the CuDNN file.

Download file link: [cudnn-local-repo-ubuntu2204-8.9.4.25_1.0-1_amd64.deb](https://developer.nvidia.com/downloads/compute/cudnn/secure/8.9.4/local_installers/12.x/cudnn-local-repo-ubuntu2204-8.9.4.25_1.0-1_amd64.deb) from TensorRT download page.
Note: You may have to login to [developer.nvidia.com](https://developer.nvidia.com/) to download the file.
Quick Steps:
$ROOT is the root directory of this git repo.
``cd $ROOT/x86_64``

``cp cudnn-local-repo-ubuntu2204-8.9.4.25_1.0-1_amd64.deb x86_64/ ``

#### 2.1.2.3 Important Notes on docker image size optimization

:warning: NOTE: Docker ADD image size workaround by using wget instead :warning:

Docker ADD method is used by default for ease to building the x86 Dockers. Docker ADD also increases the image size by approximately 2GB.

To workaround this problem you can host the nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_amd64.deb on a server and pull it in during the docker build using wget. This section of code is commented out by default.
To workaround this problem you can host the nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-12.0_1.0-1_amd64.deb a server and pull it in during the docker build using wget. This section of code is commented out by default.

To use this wget method you can uncomment this code section of the code in the dockerfile. Then also add the complete URL to the file.

Expand All @@ -73,9 +83,9 @@ The commented out this code section in the dockerfile that starts with this.
### 2.1.3 x86 Build Command

```
sudo image_url=deepstream:6.3.0-triton-local \
ds_pkg=deepstream_sdk_v6.3.0_x86_64.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.3.0.0_x86_64/ \
sudo image_url=deepstream:6.4.0-triton-local \
ds_pkg=deepstream_sdk_v6.4.0_x86_64.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.4.0.0_x86_64/ \
base_image=dgpu-any-custom-base-image make -f Makefile_x86_triton triton-devel -C x86_64/
```

Expand All @@ -84,19 +94,19 @@ sudo image_url=deepstream:6.3.0-triton-local \
### 2.2.1 Instructions for Building x86 DS Triton docker image

```
sudo image_url=deepstream:6.3.0-triton-local \
ds_pkg=deepstream_sdk_v6.3.0_x86_64.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.3.0.0_x86_64/ \
sudo image_url=deepstream:6.4.0-triton-local \
ds_pkg=deepstream_sdk_v6.4.0_x86_64.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.4.0.0_x86_64/ \
base_image=dgpu-any-custom-base-image make -f Makefile_x86_triton triton-devel -C x86_64/
There is an example build script is called $ROOT/buildx86.sh with the same contents.
```
### 2.2.2 Instructions for Building x86 DS samples docker image

```
sudo image_url=deepstream:6.3.0-samples-local \
ds_pkg=deepstream_sdk_v6.3.0_x86_64.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.3.0.0_x86_64/ \
sudo image_url=deepstream:6.4.0-samples-local \
ds_pkg=deepstream_sdk_v6.4.0_x86_64.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.4.0.0_x86_64/ \
base_image=dgpu-any-custom-base-image make -f Makefile runtime -C x86_64/
```

Expand All @@ -113,21 +123,21 @@ Please refer to the Prerequisites section at DeepStream NGC page [NVIDIA NGC](ht
Download DeepStreamSDK tarball from [DeepStreamSDK release](https://developer.nvidia.com/deepstream-getting-started) Jetson tarball and place it locally
in the ``$ROOT/jetson`` folder of this repository.

``cp deepstream_sdk_v6.3.0_jetson.tbz2 jetson/ ``
``cp deepstream_sdk_v6.4.0_jetson.tbz2 jetson/ ``

## 3.1.1 Jetson needs VPI 2.3.9 pre-requisites.
## 3.1.1 Jetson needs VPI 3.0.10 pre-requisites.

The following VPI 2.3.9 *.deb (vpi-dev-2.3.9-aarch64-l4t.deb, vpi-lib-2.3.9-aarch64-l4t.deb) files are required from [JetPack 5.1.2](https://developer.nvidia.com/embedded/jetpack). These need to be copied into the Jetson folder so they can be used by the build.
The following VPI 3.0.10 *.deb (vpi-dev-3.0.10-aarch64-l4t.deb, vpi-lib-3.0.10-aarch64-l4t.deb) files are required from [JetPack 6.0 DP](https://developer.nvidia.com/embedded/jetpack). These need to be copied into the Jetson folder so they can be used by the build.

``cp vpi-dev-2.3.9-aarch64-l4t.deb jetson/ ``
``cp vpi-lib-2.3.9-aarch64-l4t.deb jetson/ ``
``cp vpi-dev-3.0.10-aarch64-l4t.deb jetson/ ``
``cp vpi-lib-3.0.10-aarch64-l4t.deb jetson/ ``

## 3.1.2 Jetson build command

```
sudo image_url=deepstream-l4t:6.3.0-triton-local \
ds_pkg=deepstream_sdk_v6.3.0_jetson.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.3.0_jetson \
sudo image_url=deepstream-l4t:6.4.0-triton-local \
ds_pkg=deepstream_sdk_v6.4.0_jetson.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.4.0_jetson \
base_image=jetson-any-custom-base-image make -f Makefile triton -C jetson/
There is an example build script is called $ROOT/buildjet.sh with the same contents.
Expand All @@ -139,16 +149,129 @@ sudo image_url=deepstream-l4t:6.3.0-triton-local \
### 3.2.1 Instructions for building Jetson DS triton docker image

```
sudo image_url=deepstream-l4t:6.3.0-triton-local \
ds_pkg=deepstream_sdk_v6.3.0_jetson.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.3.0_jetson \
sudo image_url=deepstream-l4t:6.4.0-triton-local \
ds_pkg=deepstream_sdk_v6.4.0_jetson.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.4.0_jetson \
base_image=jetson-any-custom-base-image make -f Makefile triton -C jetson/
```
### 3.2.2 Instructions for building Jetson DS samples docker image

```
sudo image_url=deepstream-l4t:6.3.0-samples-local \
ds_pkg=deepstream_sdk_v6.3.0_jetson.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.3.0_jetson \
sudo image_url=deepstream-l4t:6.4.0-samples-local \
ds_pkg=deepstream_sdk_v6.4.0_jetson.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.4.0_jetson \
base_image=jetson-any-custom-base-image make -f Makefile runtime -C jetson/
```
## 4 Triton Migration Guide

### 4.1 Changing triton version in DS 6.4 x86+dGPU docker image

Steps:

1. Open Triton Docker file:

```
x86_64/trtserver_base_devel/Dockerfile
```

2. Edit the FROM command in Dockerfile.

Change the FROM command to use the desired Triton version.

Current: Triton 23.08
```
FROM nvcr.io/nvidia/tritonserver:23.08-py3
```

Example Migration to: Triton 23.11
```
FROM nvcr.io/nvidia/tritonserver:23.11-py3
```

3. Edit the Triton client libraries URL in Dockerfile.

Client libraries are available for download from [Triton Inference Server Releases page](https://github.com/triton-inference-server/server/releases).

Current: Triton 23.08
```
wget https://github.com/triton-inference-server/server/releases/download/v2.37.0/v2.37.0_ubuntu2204.clients.tar.gz
```

Example Migration to: Triton 23.11
```
wget https://github.com/triton-inference-server/server/releases/download/v2.40.0/v2.40.0_ubuntu2204.clients.tar.gz
```

4. Build the DS x86 triton docker following instructions [here](#221-instructions-for-building-x86-ds-triton-docker-image).

### 4.2 Changing triton version in DS 6.4 Jetson (iGPU) docker image

Steps:

1. Open Triton Docker file:

```
jetson/ubuntu_base_devel/Dockerfile
```

2. Edit the FROM command in Dockerfile.

Change the FROM command to use the desired Triton version.

Current: Triton 23.11

```
FROM nvcr.io/nvidia/tritonserver:23.11-py3-igpu
```

**Note**: Newer version of Triton is unavailable to verify migration at the time of DS 6.4 release.

3. Edit the Triton client libraries URL in Dockerfile.

Client libraries are available for download from [Triton Inference Server Releases page](https://github.com/triton-inference-server/server/releases).

Current: Triton 23.08

```
wget https://github.com/triton-inference-server/server/releases/download/v2.40.0/tritonserver2.40.0-igpu.tar.gz
```

**Note**: Newer version of Triton is unavailable to verify migration at the time of DS 6.4 release.

4. Build the DS x86 triton docker following instructions [here](#321-instructions-for-building-jetson-ds-triton-docker-image).

### 4.3 API and ABI Compatibility Requirements

#### 4.3.1 Tritonserver lib upgrade

DeepStream 6.4 Triton Server API is based on Triton 23.08 (x86) and Triton 23.11 (Jetson) release.

Regarding API compatibility, if a customer wants to upgrade triton, they need to make sure:

a) new version's `tritonserver.h` is compatible with the:

[23.08 version of tritonserver.h for x86](https://github.com/triton-inference-server/core/blob/r23.08/include/triton/core/tritonserver.h),
[23.11 version of tritonserver.h for jetson](https://github.com/triton-inference-server/core/blob/r23.11/include/triton/core/tritonserver.h),
and

b) new version’s `model_config.proto` is compatible with:

[23.08 version for x86](https://github.com/triton-inference-server/common/blob/r23.08/protobuf/model_config.proto),
[23.11 version for jetson](https://github.com/triton-inference-server/common/blob/r23.11/protobuf/model_config.proto),

To build specific Tritonserver version libs, users can follow instructions at https://github.com/triton-inference-server/server/blob/master/docs/build.md.


#### 4.3.2 DeepStream Config file Requirement

Gst-nvinferserver plugin’s config file kept backward compatibility.
Triton model/backend’s config.pbtxt file must follow rules of 23.08’s ``model_config.proto`` for x86 and 23.11's ``model_config.proto`` for jetson.

### 4.4 Ubuntu Version Requirements

#### 4.4.1 Ubuntu 22.04

DeepStream 6.4 release package inherently support Ubuntu 22.04.

Thus, the only thing to consider is API/ABI compatibility between the new Triton version and the Triton version supported by current DS release.

6 changes: 3 additions & 3 deletions buildjet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# Example script to build Jetson triton docker on a Jetson device

sudo image_url=deepstream-l4t:6.3.0-triton-local \
ds_pkg=deepstream_sdk_v6.3.0_jetson.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.3.0_jetson \
sudo image_url=deepstream-l4t:6.4.0-triton-local \
ds_pkg=deepstream_sdk_v6.4.0_jetson.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.4.0_jetson \
base_image=jetson-any-custom-base-image make -f Makefile triton -C jetson/
6 changes: 3 additions & 3 deletions buildx86.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# Example script to build x86 docker (currently building a x86 triton docker).

sudo image_url=deepstream:6.3.0-triton-local \
ds_pkg=deepstream_sdk_v6.3.0_x86_64.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.3.0_x86_64/ \
sudo image_url=deepstream:6.4.0-triton-local \
ds_pkg=deepstream_sdk_v6.4.0_x86_64.tbz2 \
ds_pkg_dir=deepstream_sdk_v6.4.0_x86_64/ \
base_image=dgpu-any-custom-base-image make -f Makefile_x86_triton triton-devel -C x86_64/
44 changes: 26 additions & 18 deletions common/install_base.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
#
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
#
Expand All @@ -21,24 +22,32 @@
# DEALINGS IN THE SOFTWARE.


#

utils_install_librdkafka_from_source()
{
# @{ librdkafka from source; Bug 200630652
# @{ librdkafka from source;
apt install -y libssl-dev openssl libssl3

echo "Installing librdkafka: "

cd "/root/tmp"
apt-get update && apt-get install -y gcc g++ libssl-dev make python
git clone https://github.com/edenhill/librdkafka.git
git clone https://github.com/confluentinc/librdkafka.git
cd librdkafka
git reset --hard 063a9ae7a65cebdf1cc128da9815c05f91a2a996
git checkout tags/v2.2.0
./configure --enable-ssl
make -j$(nproc)
make install
cd "/root/tmp"
apt-get purge -y libssl-dev
rm -rf librdkafka
# @} librdkafka from source; Bug 200630652

echo "finished installing librdkafka:"
# @} librdkafka from source;


}


utils_install_libhiredis_from_source()
{
echo "Installing Dependencies for libhiredis: "
Expand All @@ -48,39 +57,38 @@ utils_install_libhiredis_from_source()
cd "/root/tmp"
git clone https://github.com/redis/hiredis.git
cd hiredis
git checkout tags/v1.0.2
git checkout tags/v1.2.0
make USE_SSL=1
cp libhiredis* /opt/nvidia/deepstream/deepstream/lib/
ln -sf /opt/nvidia/deepstream/deepstream/lib/libhiredis.so /opt/nvidia/deepstream/deepstream/lib/libhiredis.so.1.0.0
ln -sf /opt/nvidia/deepstream/deepstream/lib/libhiredis.so /opt/nvidia/deepstream/deepstream/lib/libhiredis.so.1.1.0
ldconfig
cd "/root/tmp"
apt-get purge -y libssl-dev
# apt-get purge -y libssl-dev
echo "finished installing libhiredis"

}

utils_install_libmosquitto_from_source()
{
echo "Installing Dependencies for libmosquitto: "
apt-get install -y libssl-dev
{
echo "Installing Dependencies: "
apt-get install -y libcjson-dev libssl-dev

echo "Installing libmosquitto: "
cd "/root/tmp"
wget https://mosquitto.org/files/source/mosquitto-1.6.15.tar.gz
tar -xvf mosquitto-1.6.15.tar.gz
cd mosquitto-1.6.15
wget https://mosquitto.org/files/source/mosquitto-2.0.15.tar.gz
tar -xvf mosquitto-2.0.15.tar.gz
cd mosquitto-2.0.15
make
make install
cd "/root/tmp"
apt-get purge -y libssl-dev
rm -rf mosquitto-1.6.15
rm -rf mosquitto-2.0.15
echo "finished installing libmosquitto"

}


#Throws an error and causes a build failure for all errors in the script
#Custom Message describes where the error was thrown
#Bug 200714632
set -o errtrace
trap "echo CUSTOM MESSAGE: ERROR occured in this file: $BASH_SOURCE}" ERR
set -o errexit
Expand Down
Loading

0 comments on commit 800dd7e

Please sign in to comment.