網頁

2021年12月16日 星期四

Ubuntu 安裝 DeepStream

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install python3-pip
$ cd /usr/bin
$ sudo ln -s python3 python

一般顯卡參考 dGPU Setup for Ubuntu 段落
依據文件要求安裝 NVIDIA driver 470.63.01
但是據上次安裝經驗不要使用 NVIDIA-Linux-x86_64-470.63.01.run
$ ubuntu-drivers devices
$ sudo apt-get install nvidia-driver-470
$ sudo reboot

依據文件說明安裝 CUDA Toolkit 11.4 Update 1
$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
$ sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
$ sudo apt-get update
$ sudo apt-get -y install cuda

依據文件安裝 TensorRT 8.0.1
$ echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda-repo.list
$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
$ sudo apt-key add 7fa2af80.pub
$ sudo apt-get update
依據鏈結下載 TensorRT 8.0.1 GA for Ubuntu 18.04 and CUDA 11.3 DEB
$ sudo dpkg -i nv-tensorrt-repo-ubuntu1804-cuda11.3-trt8.0.1.6-ga-20210626_1-1_amd64.deb
$ sudo apt-key add /var/nv-tensorrt-repo-ubuntu1804-cuda11.3-trt8.0.1.6-ga-20210626/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get install -y libnvinfer8=8.0.1-1+cuda11.3 
$ sudo apt-get install -y libnvinfer-plugin8=8.0.1-1+cuda11.3 
$ sudo apt-get install -y libnvparsers8=8.0.1-1+cuda11.3 
$ sudo apt-get install -y libnvonnxparsers8=8.0.1-1+cuda11.3 
$ sudo apt-get install -y libnvinfer-bin=8.0.1-1+cuda11.3 
$ sudo apt-get install -y libnvinfer-dev=8.0.1-1+cuda11.3 
$ sudo apt-get install -y libnvinfer-plugin-dev=8.0.1-1+cuda11.3 
$ sudo apt-get install -y libnvparsers-dev=8.0.1-1+cuda11.3 
$ sudo apt-get install -y libnvonnxparsers-dev=8.0.1-1+cuda11.3 
$ sudo apt-get install -y libnvinfer-samples=8.0.1-1+cuda11.3 
$ sudo apt-get install -y libnvinfer-doc=8.0.1-1+cuda11.3

安裝 librdkafka
$ git clone https://github.com/edenhill/librdkafka.git
$ cd librdkafka/
$ git reset --hard 7101c2310341ab3f4675fc565f64f0967e135a6a
$ .configure
$ make
$ sudo make install
$ sudo mkdir -p /opt/nvidia/deepstream/deepstream-6.0/lib
$ sudo cp /usr/local/lib/librdkafka* /opt/nvidia/deepstream/deepstream-6.0/lib

$ sudo apt-get install ./deepstream-6.0_6.0.0-1_amd64.deb
$ rm ${HOME}/.cache/gstreamer-1.0/registry.x86_64.bin
$ cd /opt/nvidia/deepstream/deepstream-6.0/samples/configs/deepstream-app/
$ deepstream-app -c source4_1080p_dec_infer-resnet_tracker_sgie_tiled_display_int8.txt

安裝 Docker
$ sudo apt-get update
$ sudo apt-get install -y ca-certificates
$ sudo apt-get install -y curl
$ sudo apt-get install -y gnupg
$ sudo apt-get install -y lsb-release
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$ echo \
$   "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$   $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
$ sudo docker run hello-world
$ sudo docker docker image list
$ sudo docker image rm hello-world

安裝 Nvidia Container Toolkit
$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
   && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
   && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
$ curl -s -L https://nvidia.github.io/nvidia-container-runtime/experimental/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
$ sudo apt-get update
$ sudo apt-get install -y nvidia-docker2
$ sudo systemctl restart docker
$ sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi

在 Docker 內,執行 deepstream-app
參考 Docker Containers 下載 docker image
$ docker pull nvcr.io/nvidia/deepstream:6.0-samples
參考 Nvidia NGC DeepStream 執行程式
$ xhost +
$ sudo docker run --gpus '"'device=0'"' -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -w /opt/nvidia/deepstream/deepstream-6.0 nvcr.io/nvidia/deepstream:6.0-samples
# cd samples/configs/deepstream-app
# deepstream-app -c source4_1080p_dec_infer-resnet_tracker_sgie_tiled_display_int8.txt



沒有留言:

張貼留言