forked from triton-inference-server/server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.QA
268 lines (241 loc) · 12.8 KB
/
Dockerfile.QA
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Multistage build.
#
ARG BASE_IMAGE=tensorrtserver
ARG BUILD_IMAGE=tensorrtserver_build
ARG CBE_IMAGE=tensorrtserver_cbe
ARG CLIENT_IMAGE=tensorrtserver_client
############################################################################
## Build test utilities and custom backends in the BUILD_IMAGE since
## it has already been configured correctly and has some existing
## build artifacts. Copy artifacts into QA area.
############################################################################
FROM ${BUILD_IMAGE} AS build
# Ensure apt-get won't prompt for selecting options
ENV DEBIAN_FRONTEND=noninteractive
# image_preprocess custom backend requires opencv
RUN apt-get update && apt-get install -y --no-install-recommends \
libopencv-dev \
libopencv-core-dev
WORKDIR /workspace
RUN cd builddir && \
make -j16 trtis-test-utils trtis-custom-backends
# Update the qa/ directory with test executables, models, etc.
WORKDIR /workspace
RUN mkdir -p qa/common && \
mkdir qa/L0_simple_example/models && \
cp -r docs/examples/model_repository/simple qa/L0_simple_example/models/. && \
mkdir qa/L0_backend_release/simple_models && \
cp -r docs/examples/model_repository/simple qa/L0_backend_release/simple_models/. && \
mkdir qa/L0_simple_callback_example/models && \
cp -r docs/examples/model_repository/simple qa/L0_simple_callback_example/models/. && \
mkdir qa/L0_simple_string_example/models && \
cp -r docs/examples/model_repository/simple_string qa/L0_simple_string_example/models/. && \
mkdir qa/L0_simple_shared_memory_example/models && \
cp -r docs/examples/model_repository/simple qa/L0_simple_shared_memory_example/models/. && \
cp -r docs/examples/model_repository/simple_string qa/L0_simple_shared_memory_example/models/. && \
mkdir qa/L0_simple_cuda_shared_memory_example/models && \
cp -r docs/examples/model_repository/simple qa/L0_simple_cuda_shared_memory_example/models/. && \
cp -r docs/examples/model_repository/simple_string qa/L0_simple_cuda_shared_memory_example/models/. && \
mkdir qa/L0_shared_memory/models && \
cp -r docs/examples/model_repository/simple qa/L0_shared_memory/models/. && \
mkdir qa/L0_cuda_shared_memory/models && \
cp -r docs/examples/model_repository/simple qa/L0_cuda_shared_memory/models/. && \
mkdir qa/L0_cmdline_trace/models && \
cp -r docs/examples/model_repository/simple qa/L0_cmdline_trace/models/. && \
cp /opt/tensorrtserver/bin/simple qa/L0_simple_lib/. && \
cp /opt/tensorrtserver/bin/memory_alloc qa/L0_io/.
RUN cp /workspace/builddir/trtis-test-utils/install/bin/caffe2plan qa/common/.
RUN mkdir -p qa/custom_models/custom_int32_int32_int32/1 && \
cp builddir/trtis-custom-backends/install/lib/libaddsub.so \
qa/custom_models/custom_int32_int32_int32/1/. && \
mkdir -p qa/custom_models/custom_nobatch_int32_int32_int32/1 && \
cp builddir/trtis-custom-backends/install/lib/libaddsub.so \
qa/custom_models/custom_nobatch_int32_int32_int32/1/. && \
mkdir -p qa/custom_models/custom_float32_float32_float32/1 && \
cp builddir/trtis-custom-backends/install/lib/libaddsub.so \
qa/custom_models/custom_float32_float32_float32/1/. && \
mkdir -p qa/custom_models/custom_nobatch_float32_float32_float32/1 && \
cp builddir/trtis-custom-backends/install/lib/libaddsub.so \
qa/custom_models/custom_nobatch_float32_float32_float32/1/. && \
mkdir -p qa/L0_simple_custom_example/models/simple/1 && \
cp builddir/trtis-custom-backends/install/lib/libaddsub.so \
qa/L0_simple_custom_example/models/simple/1/. && \
mkdir -p qa/L0_simple_ensemble/models/simple/1 && \
cp builddir/trtis-custom-backends/install/lib/libaddsub.so \
qa/L0_simple_ensemble/models/simple/1/. && \
mkdir -p qa/L0_simple_ensemble/models/simple/2 && \
cp builddir/trtis-custom-backends/install/lib/libaddsub.so \
qa/L0_simple_ensemble/models/simple/2/. && \
mkdir -p qa/L0_multiple_ports/models/simple/1 && \
cp builddir/trtis-custom-backends/install/lib/libaddsub.so \
qa/L0_multiple_ports/models/simple/1/.
RUN mkdir -p qa/L0_custom_image_preprocess/models/image_preprocess_nhwc_224x224x3/1 && \
cp builddir/trtis-custom-backends/install/lib/libimagepreprocess.so \
qa/L0_custom_image_preprocess/models/image_preprocess_nhwc_224x224x3/1/.
RUN mkdir -p qa/L0_custom_param/models/param/1 && \
cp builddir/trtis-custom-backends/install/lib/libparam.so \
qa/L0_custom_param/models/param/1/.
RUN mkdir -p qa/L0_simple_sequence_example/models/simple_sequence/1 && \
cp builddir/trtis-custom-backends/install/lib/libsequence.so \
qa/L0_simple_sequence_example/models/simple_sequence/1/. && \
mkdir -p qa/L0_simple_sequence_example/models_dyna/simple_sequence/1 && \
cp builddir/trtis-custom-backends/install/lib/libdyna_sequence.so \
qa/L0_simple_sequence_example/models_dyna/simple_sequence/1/. && \
mkdir -p qa/L0_backend_release/simple_seq_models/simple_sequence/1 && \
cp builddir/trtis-custom-backends/install/lib/libsequence.so \
qa/L0_backend_release/simple_seq_models/simple_sequence/1/. && \
mkdir -p qa/custom_models/custom_sequence_int32/1 && \
cp builddir/trtis-custom-backends/install/lib/libsequence.so \
qa/custom_models/custom_sequence_int32/1/. && \
mkdir -p qa/custom_models/custom_dyna_sequence_int32/1 && \
cp builddir/trtis-custom-backends/install/lib/libdyna_sequence.so \
qa/custom_models/custom_dyna_sequence_int32/1/.
RUN cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_infer/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_infer_variable/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_infer_reshape/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_infer_zero/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_sequence_batcher/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_savedmodel_shape/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_simple_perf/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_perf_custom/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_simple_dbatch_perf/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_perf_nomodel/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_perf_client/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_large_payload/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_model_config/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_simple_lib/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_pinned_memory/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_io/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_warmup/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_cmdline_trace/. && \
cp builddir/trtis-custom-backends/install/lib/libidentity.so \
qa/L0_batcher/. && \
mkdir -p qa/L0_infer_shm && \
cp -r qa/L0_infer/. qa/L0_infer_shm && \
mkdir -p qa/L0_infer_cudashm && \
cp -r qa/L0_infer/. qa/L0_infer_cudashm && \
mkdir -p qa/L0_trt_shape_tensors_shm && \
cp -r qa/L0_trt_shape_tensors/. qa/L0_trt_shape_tensors_shm && \
mkdir -p qa/L0_trt_shape_tensors_cudashm && \
cp -r qa/L0_trt_shape_tensors/. qa/L0_trt_shape_tensors_cudashm && \
mkdir -p qa/L0_batcher_shm && \
cp -r qa/L0_batcher/. qa/L0_batcher_shm && \
mkdir -p qa/L0_batcher_cudashm && \
cp -r qa/L0_batcher/. qa/L0_batcher_cudashm && \
mkdir -p qa/L0_sequence_batcher_shm && \
cp -r qa/L0_sequence_batcher/. qa/L0_sequence_batcher_shm && \
mkdir -p qa/L0_sequence_batcher_cudashm && \
cp -r qa/L0_sequence_batcher/. qa/L0_sequence_batcher_cudashm
# Generating the docs requires the docs source and the source code so
# copy that into L0_docs so that it is available when that test runs.
RUN cp VERSION qa/L0_docs/. && \
cp README.rst qa/L0_docs/. && \
cp -r docs qa/L0_docs/. && \
cp -r src qa/L0_docs/.
############################################################################
## Copy artifacts from client container
############################################################################
FROM ${CLIENT_IMAGE} AS client
WORKDIR /workspace
COPY --from=build /workspace/qa/ qa/
RUN mkdir -p qa/clients && mkdir -p qa/pkgs && \
cp install/bin/* qa/clients/. && \
cp install/lib/librequest.so qa/clients/. && \
cp install/python/*.py qa/clients/. && \
cp install/python/tensorrtserver*.whl qa/pkgs/.
############################################################################
## Copy artifacts from custom backend container
############################################################################
FROM ${CBE_IMAGE} AS cbe
WORKDIR /workspace
COPY --from=client /workspace/qa/ qa/
RUN (cd qa/L0_custom_backend && tar xzf /workspace/*.custombackend.tar.gz)
############################################################################
## Create CI enabled image
############################################################################
FROM $BASE_IMAGE
# Ensure apt-get won't prompt for selecting options
ENV DEBIAN_FRONTEND=noninteractive
# install platform specific packages
RUN if [ $(cat /etc/os-release | grep 'VERSION_ID="16.04"' | wc -l) -ne 0 ]; then \
apt-get update && \
apt-get install -y --no-install-recommends \
libpng12-dev; \
elif [ $(cat /etc/os-release | grep 'VERSION_ID="18.04"' | wc -l) -ne 0 ]; then \
apt-get update && \
apt-get install -y --no-install-recommends \
libpng-dev; \
else \
echo "Ubuntu version must be either 16.04 or 18.04" && \
exit 1; \
fi
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
jmeter \
jmeter-http \
libopencv-dev \
libopencv-core-dev \
libzmq3-dev \
python3-dev \
python3-pip \
python3-protobuf \
swig && \
rm -rf /var/lib/apt/lists/*
# CI/QA expects "python" executable (not python3).
RUN rm -f /usr/bin/python && \
ln -s /usr/bin/python3 /usr/bin/python
RUN pip3 install --upgrade numpy pillow future grpcio requests gsutil awscli six
# CI expects tests in /opt/tensorrtserver/qa. The tensorrt-server
# (1000) user should own all artifacts in case CI is run using
# tensorrt-server user.
WORKDIR /opt/tensorrtserver
COPY --chown=1000:1000 --from=cbe /workspace/qa/ qa/
# Remove CI tests that are meant to run only on build image and
# install the tensorrtserver python client APIs.
RUN rm -fr qa/L0_copyrights qa/L0_build_variants && \
pip3 install --upgrade qa/pkgs/tensorrtserver*.whl
ENV LD_LIBRARY_PATH /opt/tensorrtserver/qa/clients:${LD_LIBRARY_PATH}