-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.dali-cassandra-triton
More file actions
168 lines (144 loc) · 5.9 KB
/
Dockerfile.dali-cassandra-triton
File metadata and controls
168 lines (144 loc) · 5.9 KB
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
# Starting from NVIDIA PyTorch NGC Container
# https://catalog.ngc.nvidia.com/orgs/nvidia/containers/tritonserver
FROM nvcr.io/nvidia/tritonserver:25.03-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 \
openjdk-11-jdk \
psutils \
python3 \
python3-pip \
rapidjson-dev \
source-highlight \
ssh \
sudo \
tmux \
unzip \
vim \
wget \
zip \
&& rm -rf /var/lib/apt/lists/*
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.48
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"
########################################################################
# 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 sed -i 's/ALL$/NOPASSWD:ALL/' /etc/sudoers
COPY . /home/ubuntu/cassandra-dali-plugin
COPY ./examples/common/private_data.template.py /home/ubuntu/cassandra-dali-plugin/examples/common/private_data.py
RUN chown -R triton-server:triton-server '/home/ubuntu/'
# 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/ubuntu/cassandra-dali-plugin
RUN /usr/bin/pip3 install .
# install triton client
RUN pip3 install tritonclient[all] IPython
# copy ssh keys to access cassandra container
COPY varia/ssh/ /home/ubuntu/.ssh/
RUN chown -R triton-server:triton-server '/home/ubuntu/.ssh' \
&& chmod 600 /home/ubuntu/.ssh/id_rsa
COPY varia/entrypoint-dali-cassandra.sh /tmp
RUN cd /home && ln -s ubuntu triton-server
USER triton-server
WORKDIR /home/ubuntu/cassandra-dali-plugin/examples/triton
RUN cd models/classification_resnet/1/ && python3 runme.py && cd -
ENTRYPOINT ["/tmp/entrypoint-dali-cassandra.sh"]