forked from triton-inference-server/server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.QA
332 lines (300 loc) · 15.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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# 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=tritonserver
ARG BUILD_IMAGE=tritonserver_build
ARG CBE_IMAGE=tritonserver_cbe
ARG CLIENT_IMAGE=tritonserver_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 test-util custom-backend
# Update the qa/ directory with test executables, models, etc.
WORKDIR /workspace
RUN mkdir -p qa/common && \
cp -r /workspace/src/backends/backend/examples/models/repeat_int32 qa/L0_decoupled/models/ && \
cp -r /workspace/src/backends/backend/examples/models/square_int32 qa/L0_decoupled/models/ && \
mkdir qa/L0_simple_example/models && \
cp -r docs/examples/model_repository/simple qa/L0_simple_example/models/. && \
mkdir qa/L0_simple_go_client/models && \
cp -r docs/examples/model_repository/simple qa/L0_simple_go_client/models/. && \
mkdir -p qa/L0_simple_go_client/core && \
cp /workspace/src/core/*.proto qa/L0_simple_go_client/core/. && \
cp /workspace/src/clients/go/*.go qa/L0_simple_go_client/. && \
mkdir qa/L0_backend_release/simple_models && \
cp -r docs/examples/model_repository/simple qa/L0_backend_release/simple_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/. && \
cp -r /workspace/docs/examples/model_repository/simple qa/L0_client_timeout/models && \
cp -r /workspace/docs/examples/model_repository/simple qa/L0_grpc/models && \
cp -r /workspace/docs/examples/model_repository/simple_string qa/L0_grpc/models && \
cp -r /workspace/docs/examples/model_repository/inception_graphdef qa/L0_grpc/models && \
cp -r /workspace/docs/examples/model_repository/simple qa/L0_http/models && \
cp -r /workspace/docs/examples/model_repository/inception_graphdef qa/L0_http/models && \
cp -r /workspace/docs/examples/model_repository/simple_string qa/L0_http/models && \
mkdir qa/L0_https/models && \
cp -r docs/examples/model_repository/simple qa/L0_https/models/. && \
mkdir qa/L0_secure_grpc/models && \
cp -r docs/examples/model_repository/simple qa/L0_secure_grpc/models/. && \
cp -r /workspace/docs/examples/ensemble_model_repository qa/L0_perf_client/ && \
cp /opt/tritonserver/bin/simple qa/L0_simple_lib/. && \
cp /opt/tritonserver/bin/memory_alloc qa/L0_io/. && \
cp /workspace/builddir/test-util/install/bin/memory_test qa/L0_memory/.
# caffe2plan will not exist if the build was done without TensorRT enabled
RUN if [ -f /workspace/builddir/test-util/install/bin/caffe2plan ]; then \
cp /workspace/builddir/test-util/install/bin/caffe2plan qa/common/.; \
fi
RUN mkdir -p qa/custom_models/custom_int32_int32_int32/1 && \
cp builddir/custom-backend/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/custom-backend/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/custom-backend/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/custom-backend/install/lib/libaddsub.so \
qa/custom_models/custom_nobatch_float32_float32_float32/1/. && \
mkdir -p qa/L0_grpc/models/simple_custom/1 && \
cp builddir/custom-backend/install/lib/libaddsub.so \
qa/L0_grpc/models/simple_custom/1/. && \
mkdir -p qa/L0_http/models/simple_custom/1 && \
cp builddir/custom-backend/install/lib/libaddsub.so \
qa/L0_http/models/simple_custom/1/. && \
mkdir -p qa/L0_simple_ensemble/models/simple/1 && \
cp builddir/custom-backend/install/lib/libaddsub.so \
qa/L0_simple_ensemble/models/simple/1/. && \
mkdir -p qa/L0_simple_ensemble/models/simple/2 && \
cp builddir/custom-backend/install/lib/libaddsub.so \
qa/L0_simple_ensemble/models/simple/2/. && \
mkdir -p qa/L0_multiple_ports/models/simple/1 && \
cp builddir/custom-backend/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/custom-backend/install/lib/libimagepreprocess.so \
qa/L0_custom_image_preprocess/models/image_preprocess_nhwc_224x224x3/1/.
RUN mkdir -p qa/L0_perf_client/ensemble_model_repository/image_preprocess_nchw_3x224x224_inception/1 && \
cp builddir/custom-backend/install/lib/libimagepreprocess.so \
qa/L0_perf_client/ensemble_model_repository/image_preprocess_nchw_3x224x224_inception/1/.
RUN mkdir -p qa/L0_backend_identity/models && \
cp -r src/backends/backend/examples/models/identity_fp32 qa/L0_backend_identity/models/. && \
mkdir -p qa/L0_backend_identity/models/identity_fp32/1 && \
cp builddir/server/install/backends/libtriton_identity.so \
qa/L0_backend_identity/models/identity_fp32/1/.
RUN mkdir -p qa/L0_backend_release/simple_seq_models/simple_sequence/1 && \
cp builddir/custom-backend/install/lib/libsequence.so \
qa/L0_backend_release/simple_seq_models/simple_sequence/1/. && \
mkdir -p qa/L0_client_timeout/models/simple_sequence/1 && \
cp builddir/custom-backend/install/lib/libsequence.so \
qa/L0_client_timeout/models/simple_sequence/1/. && \
mkdir -p qa/L0_grpc/models/simple_sequence/1 && \
cp builddir/custom-backend/install/lib/libsequence.so \
qa/L0_grpc/models/simple_sequence/1/. && \
mkdir -p qa/L0_grpc/models_dyna/simple_sequence/1 && \
cp builddir/custom-backend/install/lib/libdyna_sequence.so \
qa/L0_grpc/models_dyna/simple_sequence/1/. && \
mkdir -p qa/L0_http/models/simple_sequence/1 && \
cp builddir/custom-backend/install/lib/libsequence.so \
qa/L0_http/models/simple_sequence/1/. && \
mkdir -p qa/L0_http/models_dyna/simple_sequence/1 && \
cp builddir/custom-backend/install/lib/libdyna_sequence.so \
qa/L0_http/models_dyna/simple_sequence/1/. && \
mkdir -p qa/custom_models/custom_sequence_int32/1 && \
cp builddir/custom-backend/install/lib/libsequence.so \
qa/custom_models/custom_sequence_int32/1/. && \
mkdir -p qa/custom_models/custom_dyna_sequence_int32/1 && \
cp builddir/custom-backend/install/lib/libdyna_sequence.so \
qa/custom_models/custom_dyna_sequence_int32/1/.
RUN cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_infer/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_infer_variable/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_infer_reshape/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_infer_zero/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_sequence_batcher/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_savedmodel_shape/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_perf_nomodel/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_perf_client/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_large_payload/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_model_config/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_model_queue/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_simple_lib/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_pinned_memory/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_io/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_warmup/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_cmdline_trace/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_batcher/. && \
cp builddir/custom-backend/install/lib/libidentity.so \
qa/L0_client_timeout/. && \
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 && \
mkdir -p qa/L0_perf_nomodel_shm && \
cp -r qa/L0_perf_nomodel/. qa/L0_perf_nomodel_shm && \
mkdir -p qa/L0_perf_nomodel_cudashm && \
cp -r qa/L0_perf_nomodel/. qa/L0_perf_nomodel_cudashm
RUN cp builddir/server/install/backends/libtriton_repeat.so \
qa/L0_model_config/.
RUN mkdir -p qa/L0_decoupled/models/repeat_int32/1 && \
cp builddir/server/install/backends/libtriton_repeat.so \
qa/L0_decoupled/models/repeat_int32/1/.
RUN mkdir -p qa/L0_decoupled/models/square_int32/1 && \
cp builddir/server/install/backends/libtriton_square.so \
qa/L0_decoupled/models/square_int32/1/.
RUN mkdir -p qa/L0_decoupled/models/identity_int32/1 && \
cp builddir/server/install/backends/libtriton_identity.so \
qa/L0_decoupled/models/identity_int32/1/.
RUN mkdir -p qa/L0_decoupled/models/custom_nobatch_int32_int32_int32/1 && \
cp builddir/custom-backend/install/lib/libaddsub.so \
qa/L0_decoupled/models/custom_nobatch_int32_int32_int32/1/.
RUN mkdir -p qa/L0_decoupled/models/simple_repeat/1 && \
mkdir -p qa/L0_decoupled/models/fan_repeat/1 && \
mkdir -p qa/L0_decoupled/models/sequence_repeat/1 && \
mkdir -p qa/L0_decoupled/models/repeat_square/1 && \
mkdir -p qa/L0_decoupled/models/nested_square/1
# 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/libgrpcclient.so qa/clients/. && \
cp install/lib/libhttpclient.so qa/clients/. && \
cp install/python/*.py qa/clients/. && \
cp install/python/triton*.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
# go client requires golang
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
libopencv-dev \
libopencv-core-dev \
libzmq3-dev \
python3-dev \
python3-pip \
python3-protobuf \
python3-setuptools \
swig \
golang-go \
nginx \
protobuf-compiler && \
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 wheel setuptools && \
pip3 install --upgrade numpy pillow future grpcio requests gsutil awscli six boofuzz
# need protoc-gen-go to generate go specific gRPC modules
RUN go get github.com/golang/protobuf/protoc-gen-go && \
go get google.golang.org/grpc
# CI expects tests in /opt/tritonserver/qa. The triton-server (1000)
# user should own all artifacts in case CI is run using triton-server
# user.
WORKDIR /opt/tritonserver
COPY --chown=1000:1000 --from=cbe /workspace/qa/ qa/
# Remove CI tests that are meant to run only on build image and
# install the tritonserver/triton python client APIs.
RUN rm -fr qa/L0_copyrights qa/L0_build_variants && \
pip3 install --upgrade qa/pkgs/triton*.whl
ENV LD_LIBRARY_PATH /opt/tritonserver/qa/clients:${LD_LIBRARY_PATH}
ENV GOPATH /root/go
ENV PATH $PATH:$GOPATH/bin