forked from fversaci/cassandra-dali-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.triton
187 lines (160 loc) · 6.71 KB
/
Dockerfile.triton
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Starting from NVIDIA PyTorch NGC Container
# https://catalog.ngc.nvidia.com/orgs/nvidia/containers/tritonserver
FROM nvcr.io/nvidia/tritonserver:24.08-py3
# install some useful tools
RUN \
export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -y -q \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update -y -q \
&& apt-get install -y \
aptitude \
autoconf \
autogen \
automake \
bash-completion \
bison \
build-essential \
cmake \
dnsutils \
elinks \
emacs-nox emacs-goodies-el \
fish \
flex \
git \
htop \
iperf3 \
iproute2 \
iputils-ping \
less \
libboost-all-dev \
libopencv-dev \
libtool \
mc \
nload \
nmon \
psutils \
python3 \
python3-pip \
rapidjson-dev \
source-highlight \
ssh \
sudo \
tmux \
unzip \
vim \
wget \
zip \
&& rm -rf /var/lib/apt/lists/*
# upgrade pip
RUN pip3 install -U pip
WORKDIR /opt
# CMake
RUN CMAKE_VERSION=3.18 && \
CMAKE_BUILD=3.18.6 && \
wget -nv https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_BUILD}.tar.gz && \
tar -xf cmake-${CMAKE_BUILD}.tar.gz && \
cd cmake-${CMAKE_BUILD} && \
./bootstrap --parallel=$(grep ^processor /proc/cpuinfo | wc -l) -- -DCMAKE_USE_OPENSSL=OFF && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" install && \
rm -rf /cmake-${CMAKE_BUILD}
RUN git clone --recursive https://github.com/triton-inference-server/dali_backend.git /dali
WORKDIR /dali
RUN rm -rf /opt/tritonserver/backends/dali
# use dali nightly build?
ARG DALI_DOWNLOAD_EXTRA_INDEX_URL #=https://developer.download.nvidia.com/compute/redist/nightly
ARG DALI_DOWNLOAD_PKG_NAME #=nvidia-dali-nightly-cuda120
ARG DALI_DOWNLOAD_VERSION=1.41
ARG DALI_DOWNLOAD_EXTRA_OPTIONS
ARG TRITON_BACKEND_API_VERSION="r22.07"
RUN set -ex && mkdir build_in_ci && cd build_in_ci && \
cmake \
-D CMAKE_INSTALL_PREFIX=/opt/tritonserver \
-D CMAKE_BUILD_TYPE=Release \
-D TRITON_BACKEND_API_VERSION=${TRITON_BACKEND_API_VERSION} \
${DALI_DOWNLOAD_PKG_NAME:+ \
-D DALI_DOWNLOAD_PKG_NAME=${DALI_DOWNLOAD_PKG_NAME}} \
${DALI_DOWNLOAD_EXTRA_INDEX_URL:+ \
-D DALI_EXTRA_INDEX_URL=${DALI_DOWNLOAD_EXTRA_INDEX_URL}} \
-D DALI_VERSION=${DALI_DOWNLOAD_VERSION} \
-D DALI_DOWNLOAD_EXTRA_OPTIONS="${DALI_DOWNLOAD_EXTRA_OPTIONS}" \
.. && \
make -j"$(grep ^processor /proc/cpuinfo | wc -l)" install
ENV LD_LIBRARY_PATH=/opt/tritonserver/lib:${LD_LIBRARY_PATH}
ENV PYTHONPATH=/opt/tritonserver/backends/dali/wheel/dali
########################################################################
# Cassandra C++ and Python drivers
########################################################################
# install cassandra C++ driver
RUN \
export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -y -q \
&& apt-get install -y libuv1-dev libssl-dev \
&& rm -rf /var/lib/apt/lists/*
ARG CASS_DRIVER_VER=2.17.0
RUN \
wget -nv "https://github.com/datastax/cpp-driver/archive/$CASS_DRIVER_VER.tar.gz" \
&& tar xfz $CASS_DRIVER_VER.tar.gz \
&& cd cpp-driver-$CASS_DRIVER_VER \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make -j \
&& make install
#install cassandra python driver + torch + other python libraries
RUN \
pip3 install --upgrade --no-cache matplotlib pandas clize \
opencv-python cassandra-driver pybind11 tqdm tifffile pyyaml torch
########################################################################
# Fix for error given by "from nvidia.dali.plugin.pytorch import DALIGenericIterator"
# - https://forums.developer.nvidia.com/t/issues-building-docker-image-from-ngc-container-nvcr-io-nvidia-pytorch-22-py3/209034
ENV PATH="${PATH}:/opt/hpcx/ompi/bin"
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/hpcx/ompi/lib:/opt/hpcx/ucx/lib:/opt/hpcx/ucc/lib"
# Install jdk
RUN \
export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -y -q \
&& apt-get install -y openjdk-11-jdk
########################################################################
# Cassandra server installation, to test examples
########################################################################
ARG CASS_V=5.0
RUN \
export CASS_VERS=$(curl 'https://archive.apache.org/dist/cassandra/' | grep -o "$CASS_V\.[[:digit:]]\+" | tail -n 1) \
&& cd /tmp && wget -nv "https://archive.apache.org/dist/cassandra/$CASS_VERS/apache-cassandra-$CASS_VERS-bin.tar.gz" \
&& cd / && tar xfz "/tmp/apache-cassandra-$CASS_VERS-bin.tar.gz" \
&& ln -s "apache-cassandra-$CASS_VERS" cassandra
EXPOSE 9042
########################################################################
# Download the Imagenette dataset
########################################################################
WORKDIR /tmp
RUN \
wget -nv 'https://s3.amazonaws.com/fast-ai-imageclas/imagenette2-320.tgz' \
&& tar xfz 'imagenette2-320.tgz' \
&& rm 'imagenette2-320.tgz'
RUN \
usermod -aG sudo -s /usr/bin/fish triton-server \
&& sed -i 's/ALL$/NOPASSWD:ALL/' /etc/sudoers \
&& chown -R triton-server:triton-server /apache-cassandra-$CASS_V*
COPY . /home/triton-server/cassandra-dali-plugin
COPY ./examples/common/private_data.template.py /home/triton-server/cassandra-dali-plugin/examples/common/private_data.py
RUN chown -R triton-server:triton-server '/home/triton-server/'
# increase write timeout to 20 seconds, listen to all interfaces,
# enable SSL and increase max direct memory available
RUN \
cp /home/triton-server/cassandra-dali-plugin/varia/keystore /cassandra/conf/ \
&& python3 /home/triton-server/cassandra-dali-plugin/varia/edit_cassandra_conf.py
# install DALI
RUN pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist \
--upgrade nvidia-dali-cuda120==$DALI_DOWNLOAD_VERSION
# RUN pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/nightly \
# --upgrade nvidia-dali-nightly-cuda120==$DALI_DOWNLOAD_VERSION
# install cassandra dali plugin
WORKDIR /home/triton-server/cassandra-dali-plugin
RUN /usr/bin/pip3 install .
# install triton client
RUN pip3 install tritonclient[all] IPython
WORKDIR /home/triton-server/cassandra-dali-plugin/examples/triton
USER triton-server