mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 09:45:22 +03:00
Initial WIP dockerfile and scripts to add tensorrt support
This commit is contained in:
parent
6e519e0071
commit
aecea31163
28
Dockerfile
28
Dockerfile
@ -71,6 +71,15 @@ WORKDIR /rootfs/usr/local/go2rtc/bin
|
||||
RUN wget -qO go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/v0.1-rc.5/go2rtc_linux_${TARGETARCH}" \
|
||||
&& chmod +x go2rtc
|
||||
|
||||
|
||||
####
|
||||
#
|
||||
# OpenVino Support
|
||||
#
|
||||
# 1. Download and convert a model from Intel's Public Open Model Zoo
|
||||
# 2. Build libUSB without udev to handle NCS2 enumeration
|
||||
#
|
||||
####
|
||||
# Download and Convert OpenVino model
|
||||
FROM base_amd64 AS ov-converter
|
||||
ARG DEBIAN_FRONTEND
|
||||
@ -115,6 +124,25 @@ RUN /bin/mkdir -p '/usr/local/lib' && \
|
||||
/usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \
|
||||
ldconfig
|
||||
|
||||
####
|
||||
#
|
||||
# TensorRT Support
|
||||
#
|
||||
# 1. Build the pycuda wheel for cp39-x86_64
|
||||
# 2. Download and convert a model for the tensorRT runtime
|
||||
#
|
||||
####
|
||||
# Build CUDA Python Bindings for Python 3.9
|
||||
# FROM wget as pycuda-build
|
||||
# ARG DEBIAN_FRONTEND
|
||||
|
||||
# RUN --mount=type=bind,source=docker/build_pycuda.sh,target=/build/build_pycuda.sh \
|
||||
# /build/build_pycuda.sh
|
||||
|
||||
# Download and Convert TensorRT Model
|
||||
FROM base_amd64 as tensorrt-converter
|
||||
## TODO
|
||||
|
||||
|
||||
|
||||
FROM wget AS models
|
||||
|
||||
54
docker/build_pycuda.sh
Executable file
54
docker/build_pycuda.sh
Executable file
@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
"${CUDA_LIB_VERSION:=11.8}"
|
||||
"${CUDA_PKG_VERSION:=11-8}"
|
||||
"${CUDNN_VERSION:=8.6.0.84}"
|
||||
"${TENSORRT_VERSION:=7.2.2}"
|
||||
|
||||
# Add NVidia Repo
|
||||
# wget -q -O - https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/3bf863cc.pub | apt-key add -
|
||||
# echo "deb https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/ /" | tee /etc/apt/sources.list.d/nvidia-cuda.list
|
||||
wget https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/cuda-keyring_1.0-1_all.deb
|
||||
dpkg -i cuda-keyring_1.0-1_all.deb
|
||||
add-apt-repository contrib
|
||||
apt-get -qq update
|
||||
|
||||
# Utilities
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential python3.9-dev python3-pip tar
|
||||
|
||||
python3 -m pip install --upgrade setuptools pip wheel numpy
|
||||
|
||||
# CUDA Base
|
||||
apt-get install -y --no-install-recommends \
|
||||
cuda-cudart-${CUDA_PKG_VERSION} \
|
||||
cuda-compat-${CUDA_PKG_VERSION} \
|
||||
cuda-cupti-${CUDA_PKG_VERSION} && \
|
||||
ln -s cuda-${CUDA_LIB_VERSION} /usr/local/cuda
|
||||
|
||||
# CUDA Runtime
|
||||
apt-get install -y --no-install-recommends \
|
||||
cuda-libraries-${CUDA_PKG_VERSION} \
|
||||
libnpp-${CUDA_PKG_VERSION} \
|
||||
cuda-nvtx-${CUDA_PKG_VERSION} \
|
||||
libcublas-${CUDA_PKG_VERSION}
|
||||
|
||||
# cuDNN Runtime
|
||||
apt-get install -y --no-install-recommends \
|
||||
libcudnn8
|
||||
|
||||
# Download pycuda source
|
||||
wget https://github.com/inducer/pycuda/archive/refs/tags/v2022.2.tar.gz -O pycuda-v2022.2.tar.gz
|
||||
tar xfz pycuda-v2022.2.tar.gz
|
||||
|
||||
# Build pycuda wheel
|
||||
cd pycuda-v2022.2
|
||||
python setup.py build
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
38
docker/install_tensorrt.sh
Executable file
38
docker/install_tensorrt.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
"${CUDA_LIB_VERSION:=11.8}"
|
||||
"${CUDA_PKG_VERSION:=11-8}"
|
||||
"${CUDNN_VERSION:=8.6.0.84}"
|
||||
"${TENSORRT_VERSION:=7.2.2}"
|
||||
|
||||
# Add NVidia Repo
|
||||
# wget -q -O - https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/3bf863cc.pub | apt-key add -
|
||||
# echo "deb https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/ /" | tee /etc/apt/sources.list.d/nvidia-cuda.list
|
||||
wget https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/cuda-keyring_1.0-1_all.deb
|
||||
dpkg -i cuda-keyring_1.0-1_all.deb
|
||||
add-apt-repository contrib
|
||||
apt-get -qq update
|
||||
|
||||
# CUDA Base
|
||||
apt-get install -y --no-install-recommends \
|
||||
cuda-cudart-${CUDA_PKG_VERSION} \
|
||||
cuda-compat-${CUDA_PKG_VERSION} \
|
||||
cuda-cupti-${CUDA_PKG_VERSION} && \
|
||||
ln -s cuda-${CUDA_LIB_VERSION} /usr/local/cuda
|
||||
|
||||
# CUDA Runtime
|
||||
apt-get install -y --no-install-recommends \
|
||||
cuda-libraries-${CUDA_PKG_VERSION} \
|
||||
libnpp-${CUDA_PKG_VERSION} \
|
||||
cuda-nvtx-${CUDA_PKG_VERSION} \
|
||||
libcublas-${CUDA_PKG_VERSION}
|
||||
|
||||
# cuDNN Runtime
|
||||
apt-get install -y --no-install-recommends \
|
||||
libcudnn8
|
||||
|
||||
# TensorRT Runtime
|
||||
apt-get install -y --no-install-recommends \
|
||||
libvinfer
|
||||
@ -24,3 +24,7 @@ zeroconf == 0.39.4
|
||||
openvino @ https://github.com/NateMeyer/openvino-wheels/releases/download/multi-arch_2022.2.0/openvino-2022.2.0-000-cp39-cp39-manylinux_2_31_x86_64.whl; platform_machine == 'x86_64'
|
||||
openvino @ https://github.com/NateMeyer/openvino-wheels/releases/download/multi-arch_2022.2.0/openvino-2022.2.0-000-cp39-cp39-linux_aarch64.whl; platform_machine == 'aarch64'
|
||||
openvino @ https://github.com/NateMeyer/openvino-wheels/releases/download/multi-arch_2022.2.0/openvino-2022.2.0-000-cp39-cp39-linux_armv7l.whl; platform_machine == 'armv7l'
|
||||
tensorrt == 8.5.*; platform_machine == 'x86_64'
|
||||
nvidia-cuda-runtime-cu11 == 11.8.*; platform_machine == 'x86_64'
|
||||
nvidia-cublas-cu11 == 11.11.*; platform_machine == 'x86_64'
|
||||
nvidia-cudnn-cu11 == 8.7.*; platform_machine == 'x86_64'
|
||||
Loading…
Reference in New Issue
Block a user