Skip to content

Commit 9a14950

Browse files
authored
Add cu102 docker build script (#371)
* refact: downgrade cuda driver requirement for docker image * feat: add a Python2/3 compatible and dependency-free dependency checker for container execution * refact: detailed instructions for nvidia-docker installation * refact: add command to test docker compatibility * refact: update model md5 * fix: put upperbound of thread allocation * refact: default model made to be TinyVGG-V2 * feat: update CUDA driver requirements and put check script on README * refact: mark logger as noexcept * feat: add cuda10.2 + CUDNN8 + TRT8 image compilation script
1 parent 9b5d128 commit 9a14950

File tree

2 files changed

+67
-2
lines changed

2 files changed

+67
-2
lines changed

Dockerfile.cu102.bk

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Dockerfile
2+
3+
# docker build .
4+
5+
# Based on CUDA10.0 & CuDNN7
6+
FROM nvidia/cuda:10.2-cudnn8-devel-ubuntu18.04
7+
8+
# Set apt-get to automatically retry if a package download fails
9+
RUN echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/99AcquireRetries
10+
11+
# apt update
12+
RUN apt update --allow-unauthenticated
13+
14+
# Install Non-GPU Dependencies.
15+
RUN version="8.0.0-1+cuda10.2" ; \
16+
apt install -y \
17+
libnvinfer8=${version} libnvonnxparsers8=${version} libnvparsers8=${version} \
18+
libnvinfer-plugin8=${version} libnvinfer-dev=${version} libnvonnxparsers-dev=${version} \
19+
libnvparsers-dev=${version} libnvinfer-plugin-dev=${version} && \
20+
apt-mark hold \
21+
libnvinfer8 libnvonnxparsers8 libnvparsers8 libnvinfer-plugin8 libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev libnvinfer-plugin-dev
22+
# && apt install -yt python-libnvinfer=${version} python3-libnvinfer=${version} && apt-mark hold python-libnvinfer python3-libnvinfer
23+
24+
# Install OpenCV Dependencies
25+
RUN apt install -y software-properties-common || apt install -y software-properties-common && \
26+
add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" && \
27+
APT_DEPS="git cmake wget zip libgtk-3-dev libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev x264 v4l-utils python3-dev python3-pip libcanberra-gtk-module libcanberra-gtk3-module" && \
28+
apt install -y $APT_DEPS || apt install -y $APT_DEPS && \
29+
python3 -m pip install numpy
30+
31+
# Compile OpenCV
32+
RUN wget https://github.com/opencv/opencv/archive/refs/tags/4.4.0.zip && unzip 4.4.0.zip && \
33+
cd opencv-4.4.0 && mkdir build && cd build && \
34+
cmake .. -DCMAKE_BUILD_TYPE=Release \
35+
-DCMAKE_INSTALL_PREFIX=/usr/local \
36+
-DWITH_TBB=ON \
37+
-DWITH_V4L=ON \
38+
-DBUILD_TESTS=OFF \
39+
-DBUILD_OPENCV_PYTHON3=OFF && \
40+
make -j && make install
41+
42+
# Install HyperPose Dependencies
43+
RUN apt install -y python3-dev python3-pip subversion libgflags-dev
44+
45+
COPY . /hyperpose
46+
47+
# Get models: we first see if there's existing models here. If not install it throught network.
48+
# NOTE: if you cannot install the models due to network issues:
49+
# 1 Manually install ONNX and UFF models through: https://drive.google.com/drive/folders/1w9EjMkrjxOmMw3Rf6fXXkiv_ge7M99jR
50+
# 2 Put all models into `${GIT_DIR}/pre_installed_models`
51+
# 3 Re-build this docker image.
52+
RUN ( [ `find /hyperpose/pre_installed_models -regex '.*\.\(onnx\|uff\)' | wc -l` > 0 ] && \
53+
mkdir -p /hyperpose/data && mv /hyperpose/pre_installed_models/ /hyperpose/data/models ) || \
54+
for file in $(find /hyperpose/scripts -type f -iname 'download-*-model.sh'); do sh $file; done
55+
56+
# Install test data.
57+
RUN /hyperpose/scripts/download-test-data.sh
58+
59+
# Build Repo
60+
RUN cd hyperpose && mkdir build && cd build && \
61+
cmake .. -DCMAKE_BUILD_TYPE=Release && make -j
62+
63+
WORKDIR /hyperpose/build
64+
65+
ENTRYPOINT ["./hyperpose-cli"]

src/logger.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
class Logger : public nvinfer1::ILogger {
1212
std::fstream fs{"tensorrt.log", std::ios::out};
1313

14-
void log_with(std::ostream &os, std::string_view prefix, std::string_view msg) const {
14+
static void log_with(std::ostream &os, std::string_view prefix, std::string_view msg) {
1515
os << prefix << msg << std::endl;
1616
}
1717

1818
public:
19-
void log(Severity severity, const char* msg) override {
19+
void log(Severity severity, const char* msg) noexcept override {
2020

2121
switch (severity) {
2222
case Severity::kINTERNAL_ERROR:

0 commit comments

Comments
 (0)