From 46c57579ffe428ec26f8441d87b89a29f8a565d8 Mon Sep 17 00:00:00 2001 From: Misha Chornyi Date: Mon, 1 Apr 2024 17:08:22 -0700 Subject: [PATCH 01/10] Remove conda from build --- build.py | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/build.py b/build.py index 2dcf84480c..dcc483ac1e 100755 --- a/build.py +++ b/build.py @@ -60,8 +60,7 @@ # ORT version, # ORT OpenVINO version (use None to disable OpenVINO in ORT), # Standalone OpenVINO version, -# DCGM version, -# Conda version +# DCGM version # ) # # Currently the OpenVINO versions used in ORT and standalone must @@ -77,7 +76,6 @@ "2023.3.0", # ORT OpenVINO "2023.3.0", # Standalone OpenVINO "3.2.6", # DCGM version - "py310_23.1.0-1", # Conda version "0.3.2", # vLLM version ) } @@ -868,38 +866,6 @@ def install_dcgm_libraries(dcgm_version, target_machine): dcgm_version, dcgm_version ) - -def install_miniconda(conda_version, target_machine): - if target_machine == "arm64": - # This branch used for the case when linux container builds on MacOS with ARM chip - # macos arm arch names "arm64" when in linux it's names "aarch64". - # So we just replace the architecture to able find right conda version for Linux - target_machine = "aarch64" - if conda_version == "": - fail( - "unable to determine default repo-tag, CONDA version not known for {}".format( - FLAGS.version - ) - ) - miniconda_url = f"https://repo.anaconda.com/miniconda/Miniconda3-{conda_version}-Linux-{target_machine}.sh" - if target_machine == "x86_64": - sha_sum = "32d73e1bc33fda089d7cd9ef4c1be542616bd8e437d1f77afeeaf7afdb019787" - else: - sha_sum = "80d6c306b015e1e3b01ea59dc66c676a81fa30279bc2da1f180a7ef7b2191d6e" - return f""" -RUN mkdir -p /opt/ -RUN wget "{miniconda_url}" -O miniconda.sh -q && \ - echo "{sha_sum}" "miniconda.sh" > shasum && \ - sha256sum -c ./shasum && \ - sh miniconda.sh -b -p /opt/conda && \ - rm miniconda.sh shasum && \ - find /opt/conda/ -follow -type f -name '*.a' -delete && \ - find /opt/conda/ -follow -type f -name '*.js.map' -delete && \ - /opt/conda/bin/conda clean -afy -ENV PATH ${{PATH}}:/opt/conda/bin -""" - - def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): df = """ ARG TRITON_VERSION={} @@ -1020,10 +986,6 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): ENTRYPOINT [] """ - # Install miniconda required for the DALI backend. - if target_platform() != "windows": - df += install_miniconda(argmap["CONDA_VERSION"], target_machine()) - with open(os.path.join(ddir, dockerfile_name), "w") as dfile: dfile.write(df) @@ -1278,8 +1240,6 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach """ if "vllm" in backends: - # [DLIS-5606] Build Conda environment for vLLM backend - # Remove Pip install once vLLM backend moves to Conda environment. df += """ # vLLM needed for vLLM backend RUN pip3 install vllm=={} From 5c5d85016e1c4ab3409a83115e71017f4b12bb41 Mon Sep 17 00:00:00 2001 From: Misha Chornyi Date: Mon, 1 Apr 2024 17:11:26 -0700 Subject: [PATCH 02/10] Escape slash symbol --- build.py | 164 +++++++++++++++++++++++++++---------------------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/build.py b/build.py index dcc483ac1e..34b56bbcc5 100755 --- a/build.py +++ b/build.py @@ -847,9 +847,9 @@ def install_dcgm_libraries(dcgm_version, target_machine): return """ ENV DCGM_VERSION {} # Install DCGM. Steps from https://developer.nvidia.com/dcgm#Downloads -RUN curl -o /tmp/cuda-keyring.deb \ - https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/sbsa/cuda-keyring_1.0-1_all.deb \ - && apt install /tmp/cuda-keyring.deb && rm /tmp/cuda-keyring.deb && \ +RUN curl -o /tmp/cuda-keyring.deb \\ + https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/sbsa/cuda-keyring_1.0-1_all.deb \\ + && apt install /tmp/cuda-keyring.deb && rm /tmp/cuda-keyring.deb && \\ apt-get update && apt-get install -y datacenter-gpu-manager=1:{} """.format( dcgm_version, dcgm_version @@ -858,9 +858,9 @@ def install_dcgm_libraries(dcgm_version, target_machine): return """ ENV DCGM_VERSION {} # Install DCGM. Steps from https://developer.nvidia.com/dcgm#Downloads -RUN curl -o /tmp/cuda-keyring.deb \ - https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \ - && apt install /tmp/cuda-keyring.deb && rm /tmp/cuda-keyring.deb && \ +RUN curl -o /tmp/cuda-keyring.deb \\ + https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \\ + && apt install /tmp/cuda-keyring.deb && rm /tmp/cuda-keyring.deb && \\ apt-get update && apt-get install -y datacenter-gpu-manager=1:{} """.format( dcgm_version, dcgm_version @@ -894,16 +894,16 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): ENV DEBIAN_FRONTEND=noninteractive # Install docker docker buildx -RUN apt-get update \ - && apt-get install -y ca-certificates curl gnupg \ - && install -m 0755 -d /etc/apt/keyrings \ - && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \ - && chmod a+r /etc/apt/keyrings/docker.gpg \ - && echo \ - "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ - "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ - tee /etc/apt/sources.list.d/docker.list > /dev/null \ - && apt-get update \ +RUN apt-get update \\ + && apt-get install -y ca-certificates curl gnupg \\ + && install -m 0755 -d /etc/apt/keyrings \\ + && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \\ + && chmod a+r /etc/apt/keyrings/docker.gpg \\ + && echo \\ + "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \\ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \\ + tee /etc/apt/sources.list.d/docker.list > /dev/null \\ + && apt-get update \\ && apt-get install -y docker.io docker-buildx-plugin # libcurl4-openSSL-dev is needed for GCS @@ -911,45 +911,45 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): # python3-pip and libarchive-dev is needed by python backend # libxml2-dev is needed for Azure Storage # scons is needed for armnn_tflite backend build dep -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - ca-certificates \ - autoconf \ - automake \ - build-essential \ - git \ - gperf \ - libre2-dev \ - libssl-dev \ - libtool \ - libcurl4-openssl-dev \ - libb64-dev \ - libgoogle-perftools-dev \ - patchelf \ - python3-dev \ - python3-pip \ - python3-setuptools \ - rapidjson-dev \ - scons \ - software-properties-common \ - pkg-config \ - unzip \ - wget \ - zlib1g-dev \ - libarchive-dev \ - libxml2-dev \ - libnuma-dev \ - wget \ +RUN apt-get update \\ + && apt-get install -y --no-install-recommends \\ + ca-certificates \\ + autoconf \\ + automake \\ + build-essential \\ + git \\ + gperf \\ + libre2-dev \\ + libssl-dev \\ + libtool \\ + libcurl4-openssl-dev \\ + libb64-dev \\ + libgoogle-perftools-dev \\ + patchelf \\ + python3-dev \\ + python3-pip \\ + python3-setuptools \\ + rapidjson-dev \\ + scons \\ + software-properties-common \\ + pkg-config \\ + unzip \\ + wget \\ + zlib1g-dev \\ + libarchive-dev \\ + libxml2-dev \\ + libnuma-dev \\ + wget \\ && rm -rf /var/lib/apt/lists/* -RUN pip3 install --upgrade pip && \ +RUN pip3 install --upgrade pip && \\ pip3 install --upgrade wheel setuptools docker # Install boost version >= 1.78 for boost::span # Current libboost-dev apt packages are < 1.78, so install from tar.gz -RUN wget -O /tmp/boost.tar.gz \ - https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz && \ - (cd /tmp && tar xzf boost.tar.gz) && \ +RUN wget -O /tmp/boost.tar.gz \\ + https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz && \\ + (cd /tmp && tar xzf boost.tar.gz) && \\ mv /tmp/boost_1_80_0/boost /usr/include/boost # Server build requires recent version of CMake (FetchContent required) @@ -1163,11 +1163,11 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach # non-root. Make sure that this user to given ID 1000. All server # artifacts copied below are assign to this user. ENV TRITON_SERVER_USER=triton-server -RUN userdel tensorrt-server > /dev/null 2>&1 || true && \ - if ! id -u $TRITON_SERVER_USER > /dev/null 2>&1 ; then \ - useradd $TRITON_SERVER_USER; \ - fi && \ - [ `id -u $TRITON_SERVER_USER` -eq 1000 ] && \ +RUN userdel tensorrt-server > /dev/null 2>&1 || true && \\ + if ! id -u $TRITON_SERVER_USER > /dev/null 2>&1 ; then \\ + useradd $TRITON_SERVER_USER; \\ + fi && \\ + [ `id -u $TRITON_SERVER_USER` -eq 1000 ] && \\ [ `id -g $TRITON_SERVER_USER` -eq 1000 ] # Ensure apt-get won't prompt for selecting options @@ -1175,22 +1175,22 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach # Common dependencies. FIXME (can any of these be conditional? For # example libcurl only needed for GCS?) -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - clang \ - curl \ - dirmngr \ - git \ - gperf \ - libb64-0d \ - libcurl4-openssl-dev \ - libgoogle-perftools-dev \ - libjemalloc-dev \ - libnuma-dev \ - libre2-9 \ - software-properties-common \ - wget \ - {backend_dependencies} \ +RUN apt-get update \\ + && apt-get install -y --no-install-recommends \\ + clang \\ + curl \\ + dirmngr \\ + git \\ + gperf \\ + libb64-0d \\ + libcurl4-openssl-dev \\ + libgoogle-perftools-dev \\ + libjemalloc-dev \\ + libnuma-dev \\ + libre2-9 \\ + software-properties-common \\ + wget \\ + {backend_dependencies} \\ && rm -rf /var/lib/apt/lists/* # Set TCMALLOC_RELEASE_RATE for users setting LD_PRELOAD with tcmalloc @@ -1216,9 +1216,9 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach df += install_dcgm_libraries(argmap["DCGM_VERSION"], target_machine) df += """ # Extra defensive wiring for CUDA Compat lib -RUN ln -sf ${_CUDA_COMPAT_PATH}/lib.real ${_CUDA_COMPAT_PATH}/lib \ - && echo ${_CUDA_COMPAT_PATH}/lib > /etc/ld.so.conf.d/00-cuda-compat.conf \ - && ldconfig \ +RUN ln -sf ${_CUDA_COMPAT_PATH}/lib.real ${_CUDA_COMPAT_PATH}/lib \\ + && echo ${_CUDA_COMPAT_PATH}/lib > /etc/ld.so.conf.d/00-cuda-compat.conf \\ + && ldconfig \\ && rm -f ${_CUDA_COMPAT_PATH}/lib """ else: @@ -1228,14 +1228,14 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach if "python" in backends: df += """ # python3, python3-pip and some pip installs required for the python backend -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - python3 libarchive-dev \ - python3-pip \ - libpython3-dev && \ - pip3 install --upgrade pip && \ - pip3 install --upgrade wheel setuptools && \ - pip3 install --upgrade numpy && \ +RUN apt-get update && \\ + apt-get install -y --no-install-recommends \\ + python3 libarchive-dev \\ + python3-pip \\ + libpython3-dev && \\ + pip3 install --upgrade pip && \\ + pip3 install --upgrade wheel setuptools && \\ + pip3 install --upgrade numpy && \\ rm -rf /var/lib/apt/lists/* """ @@ -1310,7 +1310,7 @@ def add_cpu_libs_to_linux_dockerfile(backends, target_machine): COPY --from=min_container /usr/lib/{libs_arch}-linux-gnu/libcudnn.so.9 /usr/lib/{libs_arch}-linux-gnu/libcudnn.so.9 # patchelf is needed to add deps of libcublasLt.so.12 to libtorch_cuda.so -RUN apt-get update && \ +RUN apt-get update && \\ apt-get install -y --no-install-recommends openmpi-bin patchelf ENV LD_LIBRARY_PATH /usr/local/cuda/targets/{cuda_arch}-linux/lib:/usr/local/cuda/lib64/stubs:${{LD_LIBRARY_PATH}} From 9833f05ffa03eff0e4bde7acb595bc535d56c7ba Mon Sep 17 00:00:00 2001 From: Misha Chornyi Date: Mon, 1 Apr 2024 17:14:38 -0700 Subject: [PATCH 03/10] Escape slash: align --- build.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.py b/build.py index 34b56bbcc5..db0fb9422c 100755 --- a/build.py +++ b/build.py @@ -859,9 +859,11 @@ def install_dcgm_libraries(dcgm_version, target_machine): ENV DCGM_VERSION {} # Install DCGM. Steps from https://developer.nvidia.com/dcgm#Downloads RUN curl -o /tmp/cuda-keyring.deb \\ - https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \\ - && apt install /tmp/cuda-keyring.deb && rm /tmp/cuda-keyring.deb && \\ - apt-get update && apt-get install -y datacenter-gpu-manager=1:{} + https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \\ + && apt install /tmp/cuda-keyring.deb \\ + && rm /tmp/cuda-keyring.deb \\ + && apt-get update \\ + && apt-get install -y datacenter-gpu-manager=1:{} """.format( dcgm_version, dcgm_version ) From a695e62bacd5a3d73fa6a01e92feee3b0e934cee Mon Sep 17 00:00:00 2001 From: Misha Chornyi Date: Mon, 1 Apr 2024 17:21:15 -0700 Subject: [PATCH 04/10] Escape slash: align --- build.py | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/build.py b/build.py index db0fb9422c..ed4085d9a2 100755 --- a/build.py +++ b/build.py @@ -950,9 +950,9 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): # Install boost version >= 1.78 for boost::span # Current libboost-dev apt packages are < 1.78, so install from tar.gz RUN wget -O /tmp/boost.tar.gz \\ - https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz && \\ - (cd /tmp && tar xzf boost.tar.gz) && \\ - mv /tmp/boost_1_80_0/boost /usr/include/boost + https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz \\ + && (cd /tmp && tar xzf boost.tar.gz) \\ + && mv /tmp/boost_1_80_0/boost /usr/include/boost # Server build requires recent version of CMake (FetchContent required) RUN apt update -q=2 \\ @@ -1165,12 +1165,12 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach # non-root. Make sure that this user to given ID 1000. All server # artifacts copied below are assign to this user. ENV TRITON_SERVER_USER=triton-server -RUN userdel tensorrt-server > /dev/null 2>&1 || true && \\ - if ! id -u $TRITON_SERVER_USER > /dev/null 2>&1 ; then \\ - useradd $TRITON_SERVER_USER; \\ - fi && \\ - [ `id -u $TRITON_SERVER_USER` -eq 1000 ] && \\ - [ `id -g $TRITON_SERVER_USER` -eq 1000 ] +RUN userdel tensorrt-server > /dev/null 2>&1 || true \\ + && if ! id -u $TRITON_SERVER_USER > /dev/null 2>&1 ; then \\ + useradd $TRITON_SERVER_USER; \\ + fi \\ + && [ `id -u $TRITON_SERVER_USER` -eq 1000 ] \\ + && [ `id -g $TRITON_SERVER_USER` -eq 1000 ] # Ensure apt-get won't prompt for selecting options ENV DEBIAN_FRONTEND=noninteractive @@ -1219,9 +1219,9 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach df += """ # Extra defensive wiring for CUDA Compat lib RUN ln -sf ${_CUDA_COMPAT_PATH}/lib.real ${_CUDA_COMPAT_PATH}/lib \\ - && echo ${_CUDA_COMPAT_PATH}/lib > /etc/ld.so.conf.d/00-cuda-compat.conf \\ - && ldconfig \\ - && rm -f ${_CUDA_COMPAT_PATH}/lib + && echo ${_CUDA_COMPAT_PATH}/lib > /etc/ld.so.conf.d/00-cuda-compat.conf \\ + && ldconfig \\ + && rm -f ${_CUDA_COMPAT_PATH}/lib """ else: df += add_cpu_libs_to_linux_dockerfile(backends, target_machine) @@ -1230,15 +1230,16 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach if "python" in backends: df += """ # python3, python3-pip and some pip installs required for the python backend -RUN apt-get update && \\ - apt-get install -y --no-install-recommends \\ - python3 libarchive-dev \\ - python3-pip \\ - libpython3-dev && \\ - pip3 install --upgrade pip && \\ - pip3 install --upgrade wheel setuptools && \\ - pip3 install --upgrade numpy && \\ - rm -rf /var/lib/apt/lists/* +RUN apt-get update \\ + && apt-get install -y --no-install-recommends \\ + python3 \\ + libarchive-dev \\ + python3-pip \\ + libpython3-dev \\ + && pip3 install --upgrade pip \\ + && pip3 install --upgrade wheel setuptools \\ + && pip3 install --upgrade numpy \\ + && rm -rf /var/lib/apt/lists/* """ if "vllm" in backends: From c67efe0884efee4ca19b1850965c25b2fde3e04b Mon Sep 17 00:00:00 2001 From: Misha Chornyi Date: Mon, 1 Apr 2024 17:22:16 -0700 Subject: [PATCH 05/10] Escape slash: align --- build.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index ed4085d9a2..ea972c5db7 100755 --- a/build.py +++ b/build.py @@ -944,8 +944,11 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): wget \\ && rm -rf /var/lib/apt/lists/* -RUN pip3 install --upgrade pip && \\ - pip3 install --upgrade wheel setuptools docker +RUN pip3 install --upgrade pip \\ + && pip3 install --upgrade \\ + wheel \\ + setuptools \\ + docker # Install boost version >= 1.78 for boost::span # Current libboost-dev apt packages are < 1.78, so install from tar.gz From 3917a9749cc880981e1e7dceac653fd7a497c538 Mon Sep 17 00:00:00 2001 From: Misha Chornyi Date: Mon, 1 Apr 2024 17:27:30 -0700 Subject: [PATCH 06/10] Escape slash: align --- build.py | 142 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 72 insertions(+), 70 deletions(-) diff --git a/build.py b/build.py index ea972c5db7..90f164e717 100755 --- a/build.py +++ b/build.py @@ -848,9 +848,11 @@ def install_dcgm_libraries(dcgm_version, target_machine): ENV DCGM_VERSION {} # Install DCGM. Steps from https://developer.nvidia.com/dcgm#Downloads RUN curl -o /tmp/cuda-keyring.deb \\ - https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/sbsa/cuda-keyring_1.0-1_all.deb \\ - && apt install /tmp/cuda-keyring.deb && rm /tmp/cuda-keyring.deb && \\ - apt-get update && apt-get install -y datacenter-gpu-manager=1:{} + https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/sbsa/cuda-keyring_1.0-1_all.deb \\ + && apt install /tmp/cuda-keyring.deb \\ + && rm /tmp/cuda-keyring.deb \\ + && apt-get update \\ + && apt-get install -y datacenter-gpu-manager=1:{} """.format( dcgm_version, dcgm_version ) @@ -859,11 +861,11 @@ def install_dcgm_libraries(dcgm_version, target_machine): ENV DCGM_VERSION {} # Install DCGM. Steps from https://developer.nvidia.com/dcgm#Downloads RUN curl -o /tmp/cuda-keyring.deb \\ - https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \\ - && apt install /tmp/cuda-keyring.deb \\ - && rm /tmp/cuda-keyring.deb \\ - && apt-get update \\ - && apt-get install -y datacenter-gpu-manager=1:{} + https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \\ + && apt install /tmp/cuda-keyring.deb \\ + && rm /tmp/cuda-keyring.deb \\ + && apt-get update \\ + && apt-get install -y datacenter-gpu-manager=1:{} """.format( dcgm_version, dcgm_version ) @@ -897,16 +899,16 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): # Install docker docker buildx RUN apt-get update \\ - && apt-get install -y ca-certificates curl gnupg \\ - && install -m 0755 -d /etc/apt/keyrings \\ - && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \\ - && chmod a+r /etc/apt/keyrings/docker.gpg \\ - && echo \\ - "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \\ - "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \\ - tee /etc/apt/sources.list.d/docker.list > /dev/null \\ - && apt-get update \\ - && apt-get install -y docker.io docker-buildx-plugin + && apt-get install -y ca-certificates curl gnupg \\ + && install -m 0755 -d /etc/apt/keyrings \\ + && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \\ + && chmod a+r /etc/apt/keyrings/docker.gpg \\ + && echo \\ + "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \\ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \\ + tee /etc/apt/sources.list.d/docker.list > /dev/null \\ + && apt-get update \\ + && apt-get install -y docker.io docker-buildx-plugin # libcurl4-openSSL-dev is needed for GCS # python3-dev is needed by Torchvision @@ -914,7 +916,7 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): # libxml2-dev is needed for Azure Storage # scons is needed for armnn_tflite backend build dep RUN apt-get update \\ - && apt-get install -y --no-install-recommends \\ + && apt-get install -y --no-install-recommends \\ ca-certificates \\ autoconf \\ automake \\ @@ -942,10 +944,10 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): libxml2-dev \\ libnuma-dev \\ wget \\ - && rm -rf /var/lib/apt/lists/* + && rm -rf /var/lib/apt/lists/* RUN pip3 install --upgrade pip \\ - && pip3 install --upgrade \\ + && pip3 install --upgrade \\ wheel \\ setuptools \\ docker @@ -953,18 +955,18 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): # Install boost version >= 1.78 for boost::span # Current libboost-dev apt packages are < 1.78, so install from tar.gz RUN wget -O /tmp/boost.tar.gz \\ - https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz \\ - && (cd /tmp && tar xzf boost.tar.gz) \\ - && mv /tmp/boost_1_80_0/boost /usr/include/boost + https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz \\ + && (cd /tmp && tar xzf boost.tar.gz) \\ + && mv /tmp/boost_1_80_0/boost /usr/include/boost # Server build requires recent version of CMake (FetchContent required) RUN apt update -q=2 \\ - && apt install -y gpg wget \\ - && wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \\ - && . /etc/os-release \\ - && echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $UBUNTU_CODENAME main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null \\ - && apt-get update -q=2 \\ - && apt-get install -y --no-install-recommends cmake=3.27.7* cmake-data=3.27.7* + && apt install -y gpg wget \\ + && wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \\ + && . /etc/os-release \\ + && echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $UBUNTU_CODENAME main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null \\ + && apt-get update -q=2 \\ + && apt-get install -y --no-install-recommends cmake=3.27.7* cmake-data=3.27.7* """ if FLAGS.enable_gpu: @@ -1090,13 +1092,13 @@ def create_dockerfile_linux( df += """ # Remove TRT contents that are not needed in runtime RUN ARCH="$(uname -i)" \\ - && rm -fr ${TRT_ROOT}/bin ${TRT_ROOT}/targets/${ARCH}-linux-gnu/bin ${TRT_ROOT}/data \\ - && rm -fr ${TRT_ROOT}/doc ${TRT_ROOT}/onnx_graphsurgeon ${TRT_ROOT}/python \\ - && rm -fr ${TRT_ROOT}/samples ${TRT_ROOT}/targets/${ARCH}-linux-gnu/samples + && rm -fr ${TRT_ROOT}/bin ${TRT_ROOT}/targets/${ARCH}-linux-gnu/bin ${TRT_ROOT}/data \\ + && rm -fr ${TRT_ROOT}/doc ${TRT_ROOT}/onnx_graphsurgeon ${TRT_ROOT}/python \\ + && rm -fr ${TRT_ROOT}/samples ${TRT_ROOT}/targets/${ARCH}-linux-gnu/samples # Install required packages for TRT-LLM models RUN python3 -m pip install --upgrade pip \\ - && pip3 install transformers + && pip3 install transformers # Uninstall unused nvidia packages RUN if pip freeze | grep -q "nvidia.*"; then \\ @@ -1106,7 +1108,7 @@ def create_dockerfile_linux( # Drop the static libs RUN ARCH="$(uname -i)" \\ - && rm -f ${TRT_ROOT}/targets/${ARCH}-linux-gnu/lib/libnvinfer*.a \\ + && rm -f ${TRT_ROOT}/targets/${ARCH}-linux-gnu/lib/libnvinfer*.a \\ ${TRT_ROOT}/targets/${ARCH}-linux-gnu/lib/libnvonnxparser_*.a ENV LD_LIBRARY_PATH=/usr/local/tensorrt/lib/:/opt/tritonserver/backends/tensorrtllm:$LD_LIBRARY_PATH @@ -1169,11 +1171,11 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach # artifacts copied below are assign to this user. ENV TRITON_SERVER_USER=triton-server RUN userdel tensorrt-server > /dev/null 2>&1 || true \\ - && if ! id -u $TRITON_SERVER_USER > /dev/null 2>&1 ; then \\ - useradd $TRITON_SERVER_USER; \\ - fi \\ - && [ `id -u $TRITON_SERVER_USER` -eq 1000 ] \\ - && [ `id -g $TRITON_SERVER_USER` -eq 1000 ] + && if ! id -u $TRITON_SERVER_USER > /dev/null 2>&1 ; then \\ + useradd $TRITON_SERVER_USER; \\ + fi \\ + && [ `id -u $TRITON_SERVER_USER` -eq 1000 ] \\ + && [ `id -g $TRITON_SERVER_USER` -eq 1000 ] # Ensure apt-get won't prompt for selecting options ENV DEBIAN_FRONTEND=noninteractive @@ -1181,22 +1183,22 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach # Common dependencies. FIXME (can any of these be conditional? For # example libcurl only needed for GCS?) RUN apt-get update \\ - && apt-get install -y --no-install-recommends \\ - clang \\ - curl \\ - dirmngr \\ - git \\ - gperf \\ - libb64-0d \\ - libcurl4-openssl-dev \\ - libgoogle-perftools-dev \\ - libjemalloc-dev \\ - libnuma-dev \\ - libre2-9 \\ - software-properties-common \\ - wget \\ - {backend_dependencies} \\ - && rm -rf /var/lib/apt/lists/* + && apt-get install -y --no-install-recommends \\ + clang \\ + curl \\ + dirmngr \\ + git \\ + gperf \\ + libb64-0d \\ + libcurl4-openssl-dev \\ + libgoogle-perftools-dev \\ + libjemalloc-dev \\ + libnuma-dev \\ + libre2-9 \\ + software-properties-common \\ + wget \\ + {backend_dependencies} \\ + && rm -rf /var/lib/apt/lists/* # Set TCMALLOC_RELEASE_RATE for users setting LD_PRELOAD with tcmalloc ENV TCMALLOC_RELEASE_RATE 200 @@ -1222,9 +1224,9 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach df += """ # Extra defensive wiring for CUDA Compat lib RUN ln -sf ${_CUDA_COMPAT_PATH}/lib.real ${_CUDA_COMPAT_PATH}/lib \\ - && echo ${_CUDA_COMPAT_PATH}/lib > /etc/ld.so.conf.d/00-cuda-compat.conf \\ - && ldconfig \\ - && rm -f ${_CUDA_COMPAT_PATH}/lib + && echo ${_CUDA_COMPAT_PATH}/lib > /etc/ld.so.conf.d/00-cuda-compat.conf \\ + && ldconfig \\ + && rm -f ${_CUDA_COMPAT_PATH}/lib """ else: df += add_cpu_libs_to_linux_dockerfile(backends, target_machine) @@ -1234,15 +1236,15 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach df += """ # python3, python3-pip and some pip installs required for the python backend RUN apt-get update \\ - && apt-get install -y --no-install-recommends \\ - python3 \\ - libarchive-dev \\ - python3-pip \\ - libpython3-dev \\ - && pip3 install --upgrade pip \\ - && pip3 install --upgrade wheel setuptools \\ - && pip3 install --upgrade numpy \\ - && rm -rf /var/lib/apt/lists/* + && apt-get install -y --no-install-recommends \\ + python3 \\ + libarchive-dev \\ + python3-pip \\ + libpython3-dev \\ + && pip3 install --upgrade pip \\ + && pip3 install --upgrade wheel setuptools \\ + && pip3 install --upgrade numpy \\ + && rm -rf /var/lib/apt/lists/* """ if "vllm" in backends: @@ -1316,8 +1318,8 @@ def add_cpu_libs_to_linux_dockerfile(backends, target_machine): COPY --from=min_container /usr/lib/{libs_arch}-linux-gnu/libcudnn.so.9 /usr/lib/{libs_arch}-linux-gnu/libcudnn.so.9 # patchelf is needed to add deps of libcublasLt.so.12 to libtorch_cuda.so -RUN apt-get update && \\ - apt-get install -y --no-install-recommends openmpi-bin patchelf +RUN apt-get update \\ + && apt-get install -y --no-install-recommends openmpi-bin patchelf ENV LD_LIBRARY_PATH /usr/local/cuda/targets/{cuda_arch}-linux/lib:/usr/local/cuda/lib64/stubs:${{LD_LIBRARY_PATH}} """.format( From 4ded78a72f53788120efd5ff426627ca78f12e27 Mon Sep 17 00:00:00 2001 From: Misha Chornyi Date: Mon, 1 Apr 2024 17:31:58 -0700 Subject: [PATCH 07/10] Install virtualenv --- build.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build.py b/build.py index 90f164e717..a2c6d83a9f 100755 --- a/build.py +++ b/build.py @@ -950,7 +950,8 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): && pip3 install --upgrade \\ wheel \\ setuptools \\ - docker + docker \\ + virtualenv # Install boost version >= 1.78 for boost::span # Current libboost-dev apt packages are < 1.78, so install from tar.gz @@ -1242,8 +1243,11 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach python3-pip \\ libpython3-dev \\ && pip3 install --upgrade pip \\ - && pip3 install --upgrade wheel setuptools \\ - && pip3 install --upgrade numpy \\ + && pip3 install --upgrade \\ + wheel \\ + setuptools \\ + numpy \\ + virtualenv \\ && rm -rf /var/lib/apt/lists/* """ From d0114f0db491487ff8a86a400dd483ed605bca29 Mon Sep 17 00:00:00 2001 From: Misha Chornyi Date: Tue, 2 Apr 2024 19:53:41 -0700 Subject: [PATCH 08/10] Fix vLLM flag --- build.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index a2c6d83a9f..4a9e0513d8 100755 --- a/build.py +++ b/build.py @@ -76,6 +76,7 @@ "2023.3.0", # ORT OpenVINO "2023.3.0", # Standalone OpenVINO "3.2.6", # DCGM version + "py310_23.1.0-1", # Conda version "0.3.2", # vLLM version ) } @@ -1256,7 +1257,7 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach # vLLM needed for vLLM backend RUN pip3 install vllm=={} """.format( - TRITON_VERSION_MAP[FLAGS.version][7] + TRITON_VERSION_MAP[FLAGS.version][6] ) df += """ From 3287a5ba30aa956c6d57e8fdea2b5cd0d4d48ace Mon Sep 17 00:00:00 2001 From: Misha Chornyi Date: Tue, 2 Apr 2024 19:56:14 -0700 Subject: [PATCH 09/10] remove conda flag --- build.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build.py b/build.py index 4a9e0513d8..a1ec6774b9 100755 --- a/build.py +++ b/build.py @@ -76,7 +76,6 @@ "2023.3.0", # ORT OpenVINO "2023.3.0", # Standalone OpenVINO "3.2.6", # DCGM version - "py310_23.1.0-1", # Conda version "0.3.2", # vLLM version ) } @@ -1418,9 +1417,6 @@ def create_build_dockerfiles( "DCGM_VERSION": "" if FLAGS.version is None or FLAGS.version not in TRITON_VERSION_MAP else TRITON_VERSION_MAP[FLAGS.version][5], - "CONDA_VERSION": "" - if FLAGS.version is None or FLAGS.version not in TRITON_VERSION_MAP - else TRITON_VERSION_MAP[FLAGS.version][6], } # For CPU-only image we need to copy some cuda libraries and dependencies From 9b2d3531b2645fa4a509999e24ef2a3eed5e8514 Mon Sep 17 00:00:00 2001 From: Misha Chornyi Date: Wed, 3 Apr 2024 10:07:28 -0700 Subject: [PATCH 10/10] Fix code style --- build.py | 1 + 1 file changed, 1 insertion(+) diff --git a/build.py b/build.py index a1ec6774b9..2626dd4986 100755 --- a/build.py +++ b/build.py @@ -870,6 +870,7 @@ def install_dcgm_libraries(dcgm_version, target_machine): dcgm_version, dcgm_version ) + def create_dockerfile_buildbase(ddir, dockerfile_name, argmap): df = """ ARG TRITON_VERSION={}