From b0648940324a949e7237931780e60f1fd37a8507 Mon Sep 17 00:00:00 2001 From: CoderHam Date: Thu, 7 Jan 2021 18:49:38 -0800 Subject: [PATCH] Additional pytorch build related cleanup --- build.py | 69 +++----------------------------------------------------- 1 file changed, 3 insertions(+), 66 deletions(-) diff --git a/build.py b/build.py index 32ab51bd40..1776a880c2 100755 --- a/build.py +++ b/build.py @@ -559,43 +559,6 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap, backends): apt-get update && \ apt-get install -y --no-install-recommends \ cmake-data=3.18.4-0kitware1ubuntu20.04.1 cmake=3.18.4-0kitware1ubuntu20.04.1 -''' - if 'pytorch' in backends: - df += ''' -# LibTorch and Torchvision headers and libraries -COPY --from=tritonserver_pytorch \ - /opt/conda/lib/python3.8/site-packages/torch/lib/libc10.so \ - /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch \ - /opt/conda/lib/python3.8/site-packages/torch/lib/libc10_cuda.so \ - /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/libmkl_core.so /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/libmkl_gnu_thread.so /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/libmkl_intel_lp64.so /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/libmkl_intel_thread.so /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/libmkl_def.so /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/libmkl_avx2.so /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/libmkl_vml_def.so /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/libmkl_rt.so /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/libiomp5.so /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/python3.8/site-packages/torch/include \ - /opt/tritonserver/include/torch -COPY --from=tritonserver_pytorch /opt/conda/lib/python3.8/site-packages/torch/lib/libtorch.so \ - /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so \ - /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/conda/lib/python3.8/site-packages/torch/lib/libtorch_cuda.so \ - /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/pytorch/vision/torchvision/csrc \ - /opt/tritonserver/include/torchvision/torchvision/ -COPY --from=tritonserver_pytorch /opt/pytorch/vision/build/libtorchvision.so \ - /opt/tritonserver/backends/pytorch/ -COPY --from=tritonserver_pytorch /opt/pytorch/pytorch/LICENSE \ - /opt/tritonserver/backends/pytorch/ -RUN cd /opt/tritonserver/backends/pytorch && \ - for i in `find . -mindepth 1 -maxdepth 1 -type f -name '*\.so*'`; do \ - patchelf --set-rpath '$ORIGIN' $i; \ - done ''' if 'onnxruntime' in backends: df += ''' @@ -815,10 +778,6 @@ def create_dockerfile(ddir, dockerfile_name, argmap, backends): COPY --chown=1000:1000 TRITON_VERSION . COPY --chown=1000:1000 --from=tritonserver_build /tmp/tritonbuild/install/bin/tritonserver bin/ COPY --chown=1000:1000 --from=tritonserver_build /tmp/tritonbuild/install/lib/libtritonserver.so lib/ -''' - if 'pytorch' in backends: - df += ''' -COPY --chown=1000:1000 --from=tritonserver_build /opt/tritonserver/backends/pytorch backends/pytorch ''' if 'onnxruntime' in backends: df += ''' @@ -889,16 +848,6 @@ def container_build(backends, images): base_image, } - # If building the pytorch backend then need to include pytorch in - # buildbase image. - if 'pytorch' in backends: - if 'pytorch' in images: - pytorch_image = images['pytorch'] - else: - pytorch_image = 'nvcr.io/nvidia/pytorch:{}-py3'.format( - FLAGS.upstream_container_version) - dockerfileargmap['PYTORCH_IMAGE'] = pytorch_image - # If building the ORT backend then need to include ORT in # buildbase image. if 'onnxruntime' in backends: @@ -912,11 +861,9 @@ def container_build(backends, images): FLAGS.version][3] cachefrommap = [ - 'tritonserver_pytorch', 'tritonserver_pytorch_cache0', - 'tritonserver_pytorch_cache1', 'tritonserver_onnx', - 'tritonserver_onnx_cache0', 'tritonserver_onnx_cache1', - 'tritonserver_buildbase', 'tritonserver_buildbase_cache0', - 'tritonserver_buildbase_cache1' + 'tritonserver_onnx', 'tritonserver_onnx_cache0', + 'tritonserver_onnx_cache1', 'tritonserver_buildbase', + 'tritonserver_buildbase_cache0', 'tritonserver_buildbase_cache1' ] cachefromargs = ['--cache-from={}'.format(k) for k in cachefrommap] @@ -937,16 +884,6 @@ def container_build(backends, images): # does caching with multi-stage images, we must build each # stage separately to make sure it is cached. - # PyTorch - if 'pytorch' in backends: - p = subprocess.Popen(commonargs + cachefromargs + [ - '-t', 'tritonserver_pytorch', '--target', - 'tritonserver_pytorch', '.' - ]) - p.wait() - fail_if(p.returncode != 0, - 'docker build tritonserver_pytorch failed') - # ONNX Runtime if 'onnxruntime' in backends: p = subprocess.Popen(commonargs + cachefromargs + [