From eaf9f95ac1f8c5d97761e5ceabbac0e08fdbd479 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 15 Jun 2023 18:21:43 +0200 Subject: [PATCH 01/38] try to build 2.12 --- Makefile | 4 ++-- docker/Dockerfile | 2 +- scripts/.common.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 77ad298..e00695f 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,8 @@ DEFAULT_ARCH := $(shell dpkg --print-architecture) ARCH := $(if $(ARCH),$(ARCH),$(DEFAULT_ARCH)) # defaults -DEFAULT_TF_VERSION := 2.11.0 -TF_VERSIONS := 2.11.0 2.10.1 2.10.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.3 2.5.2 2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.3 2.2.2 2.2.1 2.2.0 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 +DEFAULT_TF_VERSION := 2.12.0 +TF_VERSIONS := 2.12.0 2.11.0 2.10.1 2.10.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.3 2.5.2 2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.3 2.2.2 2.2.1 2.2.0 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 DEFAULT_JOBS := $(shell nproc) DEFAULT_GPU := 1 ifeq ($(ARCH), arm64) diff --git a/docker/Dockerfile b/docker/Dockerfile index af86fd3..af88a1e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -80,7 +80,7 @@ RUN mkdir bazel-bin/tensorflow/lib && \ WORKDIR / RUN apt-get install -y autoconf automake libtool curl make g++ unzip && \ PROTOBUF_URL=$(grep -Eho "https://github.com/protocolbuffers/protobuf/archive/.*\.(zip|tar.gz)" tensorflow/tensorflow/workspace*.bzl) && \ - PROTOBUF_VERSION=$(echo $PROTOBUF_URL | grep -Eo "(.?\..?\..?|[0-9a-f]{40})") && \ + PROTOBUF_VERSION=$(echo $PROTOBUF_URL | grep -Eo "([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|[0-9a-f]{40})") && \ wget -q $PROTOBUF_URL -O protobuf.archive && \ (unzip -q protobuf.archive || tar -xzf protobuf.archive) && \ rm protobuf.archive && \ diff --git a/scripts/.common.sh b/scripts/.common.sh index a91ede8..df9e16a 100644 --- a/scripts/.common.sh +++ b/scripts/.common.sh @@ -21,7 +21,7 @@ set -e set -o pipefail -DEFAULT_TF_VERSION="2.11.0" +DEFAULT_TF_VERSION="2.12.0" DEFAULT_JOBS=$(nproc) DEFAULT_GPU=1 DEFAULT_ARCH=$(dpkg --print-architecture) From 131acd4f57ed65bbfd9ccbee72db481c9ef1ba2d Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 8 Aug 2023 10:28:32 +0200 Subject: [PATCH 02/38] explicitly add devel dockerfile for 2.13.0 devel dockerfiles are not part of the tf repo anymore --- docker/.Dockerfiles/.gitignore | 3 + .../2.13.0/dockerfiles/devel-gpu.Dockerfile | 151 ++++++++++++++++++ docker/.gitignore | 1 - 3 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 docker/.Dockerfiles/.gitignore create mode 100644 docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile diff --git a/docker/.Dockerfiles/.gitignore b/docker/.Dockerfiles/.gitignore new file mode 100644 index 0000000..ff271f4 --- /dev/null +++ b/docker/.Dockerfiles/.gitignore @@ -0,0 +1,3 @@ +/* +!.gitignore +!/2.13.0/ diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile b/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile new file mode 100644 index 0000000..7e5873e --- /dev/null +++ b/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile @@ -0,0 +1,151 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +# +# THIS IS A GENERATED DOCKERFILE. +# +# This file was assembled from multiple pieces, whose use is documented +# throughout. Please refer to the TensorFlow dockerfiles documentation +# for more information. + +ARG UBUNTU_VERSION=20.04 + +ARG ARCH= +ARG CUDA=11.8 +FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}.0-base-ubuntu${UBUNTU_VERSION} as base +# ARCH and CUDA are specified again because the FROM directive resets ARGs +# (but their default value is retained if set previously) +ARG ARCH +ARG CUDA +ARG CUDNN=8.6.0.163-1 +ARG CUDNN_MAJOR_VERSION=8 +ARG LIB_DIR_PREFIX=x86_64 +ARG LIBNVINFER=8.4.3-1 +ARG LIBNVINFER_MAJOR_VERSION=8 + +# Needed for string substitution +SHELL ["/bin/bash", "-c"] +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub && \ + apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + clang-format \ + cuda-command-line-tools-${CUDA/./-} \ + libcublas-${CUDA/./-} \ + libcublas-dev-${CUDA/./-} \ + cuda-nvprune-${CUDA/./-} \ + cuda-nvrtc-${CUDA/./-} \ + cuda-nvrtc-dev-${CUDA/./-} \ + cuda-cudart-dev-${CUDA/./-} \ + libcufft-dev-${CUDA/./-} \ + libcurand-dev-${CUDA/./-} \ + libcusolver-dev-${CUDA/./-} \ + libcusparse-dev-${CUDA/./-} \ + libcudnn8=${CUDNN}+cuda${CUDA} \ + libcudnn8-dev=${CUDNN}+cuda${CUDA} \ + libcurl3-dev \ + libfreetype6-dev \ + libhdf5-serial-dev \ + libzmq3-dev \ + pkg-config \ + rsync \ + software-properties-common \ + unzip \ + zip \ + zlib1g-dev \ + wget \ + git \ + && \ + find /usr/local/cuda-${CUDA}/lib64/ -type f -name 'lib*_static.a' -not -name 'libcudart_static.a' -delete + +# Install TensorRT if not building for PowerPC +# NOTE: libnvinfer uses cuda11.1 versions +RUN [[ "${ARCH}" = "ppc64le" ]] || { apt-get update && \ + apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub && \ + echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/tensorRT.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ + libnvinfer-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/*; } + +# Configure the build for our CUDA configuration. +ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64:/usr/local/cuda-11.2/lib64 +ENV TF_NEED_CUDA 1 +ENV TF_NEED_TENSORRT 1 +ENV TF_CUDA_VERSION=${CUDA} +ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION} +# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version +ARG CACHE_STOP=1 +# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 +ARG CHECKOUT_TF_SRC=0 +RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow_src || true + +# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure +# dynamic linker run-time bindings +RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \ + && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ + && ldconfig + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + git \ + wget \ + openjdk-8-jdk \ + python3-dev \ + virtualenv \ + swig + +RUN python3 -m pip --no-cache-dir install \ + Pillow \ + h5py \ + keras_preprocessing \ + tb-nightly \ + matplotlib \ + mock \ + 'numpy<1.19.0' \ + scipy \ + scikit-learn \ + pandas \ + future \ + portpicker \ + enum34 + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc diff --git a/docker/.gitignore b/docker/.gitignore index f928c21..5a9df23 100644 --- a/docker/.gitignore +++ b/docker/.gitignore @@ -1,2 +1 @@ -.Dockerfiles/ .log/ \ No newline at end of file From ba6dfa8718b890e03e88b151449a5ceeb71ec1e4 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 8 Aug 2023 10:29:32 +0200 Subject: [PATCH 03/38] modify 2.13.0 devel dockerfile to run ubuntu22, cuda12.1 --- .../2.13.0/dockerfiles/devel-gpu.Dockerfile | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile b/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile index 7e5873e..49e254f 100644 --- a/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile +++ b/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile @@ -19,19 +19,19 @@ # throughout. Please refer to the TensorFlow dockerfiles documentation # for more information. -ARG UBUNTU_VERSION=20.04 +ARG UBUNTU_VERSION=22.04 ARG ARCH= -ARG CUDA=11.8 -FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}.0-base-ubuntu${UBUNTU_VERSION} as base +ARG CUDA=12.1 +FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}.1-devel-ubuntu${UBUNTU_VERSION} as base # ARCH and CUDA are specified again because the FROM directive resets ARGs # (but their default value is retained if set previously) ARG ARCH ARG CUDA -ARG CUDNN=8.6.0.163-1 +ARG CUDNN=8.9.3.28-1 ARG CUDNN_MAJOR_VERSION=8 ARG LIB_DIR_PREFIX=x86_64 -ARG LIBNVINFER=8.4.3-1 +ARG LIBNVINFER=8.6.1.6-1 ARG LIBNVINFER_MAJOR_VERSION=8 # Needed for string substitution @@ -75,15 +75,15 @@ RUN [[ "${ARCH}" = "ppc64le" ]] || { apt-get update && \ apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub && \ echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/tensorRT.list && \ apt-get update && \ - apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ - libnvinfer-dev=${LIBNVINFER}+cuda11.8 \ - libnvinfer-plugin-dev=${LIBNVINFER}+cuda11.8 \ - libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ + apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda12.0 \ + libnvinfer-dev=${LIBNVINFER}+cuda12.0 \ + libnvinfer-plugin-dev=${LIBNVINFER}+cuda12.0 \ + libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda12.0 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*; } # Configure the build for our CUDA configuration. -ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64:/usr/local/cuda-11.2/lib64 +ENV LD_LIBRARY_PATH /usr/local/cuda-12.1/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-12.1/lib64:/usr/local/cuda-11.2/lib64 ENV TF_NEED_CUDA 1 ENV TF_NEED_TENSORRT 1 ENV TF_CUDA_VERSION=${CUDA} @@ -124,6 +124,7 @@ RUN apt-get update && apt-get install -y \ virtualenv \ swig +RUN python3 -m pip install --upgrade pip RUN python3 -m pip --no-cache-dir install \ Pillow \ h5py \ @@ -131,7 +132,7 @@ RUN python3 -m pip --no-cache-dir install \ tb-nightly \ matplotlib \ mock \ - 'numpy<1.19.0' \ + numpy \ scipy \ scikit-learn \ pandas \ From 088f89b38fab7f5ef9005a340ae9d4d170c328a0 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 8 Aug 2023 10:31:09 +0200 Subject: [PATCH 04/38] successfully build 2.13.0 --- Makefile | 4 ++-- docker/Dockerfile | 11 +++++++++-- docker/patch/2.13.0/workspace2.bzl.patch | 17 +++++++++++++++++ scripts/.common.sh | 2 +- scripts/4-test-libtensorflow-cc.sh | 2 +- 5 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 docker/patch/2.13.0/workspace2.bzl.patch diff --git a/Makefile b/Makefile index e00695f..25d1bb7 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,8 @@ DEFAULT_ARCH := $(shell dpkg --print-architecture) ARCH := $(if $(ARCH),$(ARCH),$(DEFAULT_ARCH)) # defaults -DEFAULT_TF_VERSION := 2.12.0 -TF_VERSIONS := 2.12.0 2.11.0 2.10.1 2.10.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.3 2.5.2 2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.3 2.2.2 2.2.1 2.2.0 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 +DEFAULT_TF_VERSION := 2.13.0 +TF_VERSIONS := 2.13.0 2.11.0 2.10.1 2.10.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.3 2.5.2 2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.3 2.2.2 2.2.1 2.2.0 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 DEFAULT_JOBS := $(shell nproc) DEFAULT_GPU := 1 ifeq ($(ARCH), arm64) diff --git a/docker/Dockerfile b/docker/Dockerfile index af88a1e..a8ba631 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -39,6 +39,13 @@ RUN if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ]; then \ git checkout FETCH_HEAD -- tensorflow/BUILD; \ fi +# fix build issue in 2.13.0 +# https://github.com/tensorflow/tensorflow/issues/60398#issuecomment-1537040602 +COPY patch/2.13.0/workspace2.bzl.patch . +RUN if [ "${TF_VERSION}" = "2.13.0" ]; then \ + git apply workspace2.bzl.patch; \ + fi + # configure compilation ARG TF_CUDA_COMPUTE_CAPABILITIES=5.3,6.0,6.1,7.0,7.2,7.5,8.0,8.6 ENV PYTHON_BIN_PATH=/usr/bin/python3 @@ -56,13 +63,13 @@ RUN ./configure # https://github.com/tensorflow/tensorflow/issues/59081 ARG JOBS="auto" RUN if [ "${GPU_POSTFIX}" = "-gpu" ]; then \ - if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ]; then \ + if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ bazel build --jobs ${JOBS} --config=cuda --config=opt --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ else \ bazel build --jobs ${JOBS} --config=cuda --config=opt --config=monolithic --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ fi; \ else \ - if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ]; then \ + if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ bazel build --jobs ${JOBS} --config=opt --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ else \ bazel build --jobs ${JOBS} --config=opt --config=monolithic --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ diff --git a/docker/patch/2.13.0/workspace2.bzl.patch b/docker/patch/2.13.0/workspace2.bzl.patch new file mode 100644 index 0000000..ad3c568 --- /dev/null +++ b/docker/patch/2.13.0/workspace2.bzl.patch @@ -0,0 +1,17 @@ +diff --git a/tensorflow/workspace2.bzl b/tensorflow/workspace2.bzl +index da9295ad..86a3df2f 100644 +--- a/tensorflow/workspace2.bzl ++++ b/tensorflow/workspace2.bzl +@@ -174,9 +174,9 @@ def _tf_repositories(): + name = "cudnn_frontend_archive", + build_file = "//third_party:cudnn_frontend.BUILD", + patch_file = ["//third_party:cudnn_frontend_header_fix.patch"], +- sha256 = "bfcf778030831f325cfc13ae5995388cc834fbff2995a297ba580d9ec65ca3b6", +- strip_prefix = "cudnn-frontend-0.8", +- urls = tf_mirror_urls("https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v0.8.zip"), ++ sha256 = "d8dba9e2607a0c256aa8eacb45b39986ab6f3f24a4d431d4397047a3cb0cd4fb", ++ strip_prefix = "cudnn-frontend-0.9", ++ urls = tf_mirror_urls("https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v0.9.zip"), + ) + + tf_http_archive( diff --git a/scripts/.common.sh b/scripts/.common.sh index df9e16a..56d35aa 100644 --- a/scripts/.common.sh +++ b/scripts/.common.sh @@ -21,7 +21,7 @@ set -e set -o pipefail -DEFAULT_TF_VERSION="2.12.0" +DEFAULT_TF_VERSION="2.13.0" DEFAULT_JOBS=$(nproc) DEFAULT_GPU=1 DEFAULT_ARCH=$(dpkg --print-architecture) diff --git a/scripts/4-test-libtensorflow-cc.sh b/scripts/4-test-libtensorflow-cc.sh index 61fc703..6dc86cc 100755 --- a/scripts/4-test-libtensorflow-cc.sh +++ b/scripts/4-test-libtensorflow-cc.sh @@ -23,7 +23,7 @@ source $(dirname "$0")/.common.sh EXAMPLE_DIR=${REPOSITORY_DIR}/example EXAMPLE_MOUNT="/example" -if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ]; then +if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.13.0" ]; then CMD="./build-and-run.sh" else CMD="./build-and-run-monolithic.sh" From 38d78a39514e0c7c7576fcb743f4dc721e57b704 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 8 Aug 2023 13:39:49 +0200 Subject: [PATCH 05/38] explicitly add cpu devel dockerfile for 2.13.0 same as 2.12.1 --- docker/.Dockerfiles/2.13.0/bashrc | 53 +++++++++ .../2.13.0/dockerfiles/devel-cpu.Dockerfile | 107 ++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 docker/.Dockerfiles/2.13.0/bashrc create mode 100644 docker/.Dockerfiles/2.13.0/dockerfiles/devel-cpu.Dockerfile diff --git a/docker/.Dockerfiles/2.13.0/bashrc b/docker/.Dockerfiles/2.13.0/bashrc new file mode 100644 index 0000000..d9dd7a6 --- /dev/null +++ b/docker/.Dockerfiles/2.13.0/bashrc @@ -0,0 +1,53 @@ +# Copyright 2018 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============================================================================== + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return + +export PS1="\[\e[31m\]tf-docker\[\e[m\] \[\e[33m\]\w\[\e[m\] > " +export TERM=xterm-256color +alias grep="grep --color=auto" +alias ls="ls --color=auto" + +echo -e "\e[1;31m" +cat< Date: Tue, 8 Aug 2023 15:52:09 +0200 Subject: [PATCH 06/38] update supported compute capabilities --- Makefile | 4 ++-- docker/Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 25d1bb7..e50d086 100644 --- a/Makefile +++ b/Makefile @@ -33,9 +33,9 @@ TF_VERSIONS := 2.13.0 2.11.0 2.10.1 2.10.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2 DEFAULT_JOBS := $(shell nproc) DEFAULT_GPU := 1 ifeq ($(ARCH), arm64) - DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES := 5.3,6.0,6.1,7.0,7.2,7.5,8.0,8.6,8.7 + DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES := 5.3,6.2,7.2,8.7 else - DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES := 5.3,6.0,6.1,7.0,7.2,7.5,8.0,8.6 + DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES := 6.0,6.1,7.0,7.5,8.0,8.6,8.9,9.0 endif # arguments diff --git a/docker/Dockerfile b/docker/Dockerfile index a8ba631..4ab4a7d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -47,7 +47,7 @@ RUN if [ "${TF_VERSION}" = "2.13.0" ]; then \ fi # configure compilation -ARG TF_CUDA_COMPUTE_CAPABILITIES=5.3,6.0,6.1,7.0,7.2,7.5,8.0,8.6 +ARG TF_CUDA_COMPUTE_CAPABILITIES=6.0,6.1,7.0,7.5,8.0,8.6,8.9,9.0 ENV PYTHON_BIN_PATH=/usr/bin/python3 ENV PYTHON_LIB_PATH=/usr/lib/python3/dist-packages ENV TF_NEED_ROCM=0 From 6706599531de06fbb4f3e72d9c6f68592a3ff008 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Tue, 8 Aug 2023 18:10:48 +0200 Subject: [PATCH 07/38] add arm64 dockerimage for TF2.13.0 --- .../arm64v8/devel-cpu-arm64v8.Dockerfile | 110 ++++++++++++++++++ scripts/1-build-official-devel-image.sh | 2 + 2 files changed, 112 insertions(+) create mode 100644 docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile new file mode 100644 index 0000000..e52e34a --- /dev/null +++ b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -0,0 +1,110 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +# +# THIS IS A GENERATED DOCKERFILE. +# +# This file was assembled from multiple pieces, whose use is documented +# throughout. Please refer to the TensorFlow dockerfiles documentation +# for more information. + +ARG UBUNTU_VERSION=20.04 + +FROM nvcr.io/nvidia/l4t-tensorflow:r35.3.1-tf2.11-py3 AS base + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + clang-format \ + curl \ + git \ + libcurl3-dev \ + libfreetype6-dev \ + libhdf5-serial-dev \ + libzmq3-dev \ + pkg-config \ + rsync \ + software-properties-common \ + sudo \ + unzip \ + zip \ + zlib1g-dev \ + openjdk-8-jdk \ + openjdk-8-jre-headless \ + && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ENV CI_BUILD_PYTHON python + +# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version +ARG CACHE_STOP=1 +# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 +ARG CHECKOUT_TF_SRC=0 +# In case of Python 2.7+ we need to add passwd entries for user and group id +RUN chmod a+w /etc/passwd /etc/group +RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow_src || true + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + git \ + openjdk-8-jdk \ + python3-dev \ + virtualenv \ + swig + +RUN apt-get update && apt-get install -y \ + gfortran \ + libblas-dev \ + liblapack-dev + +RUN python3 -m pip --no-cache-dir install \ + Pillow \ + keras_preprocessing \ + tb-nightly \ + h5py \ + matplotlib \ + mock \ + 'numpy<1.19.0' \ + scipy \ + scikit-learn \ + pandas \ + portpicker \ + enum34 + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-arm64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc diff --git a/scripts/1-build-official-devel-image.sh b/scripts/1-build-official-devel-image.sh index 3df21eb..dbe2bb2 100755 --- a/scripts/1-build-official-devel-image.sh +++ b/scripts/1-build-official-devel-image.sh @@ -30,6 +30,8 @@ elif [ "$ARCH" = "arm64" ]; then DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile if [ "$TF_VERSION" = "2.8.4" ]; then sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r34.1.1-tf2.8-py3/" $DOCKERFILE + elif [ "$TF_VERSION" = "2.13.0" ]; then + sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.3.1-tf2.11-py3/" $DOCKERFILE else sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE fi From 83173166b87129727bb93d0b513f2f18452c1fb7 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 8 Aug 2023 19:17:17 +0200 Subject: [PATCH 08/38] add devel dockerfile for 2.13.0 with cuda 11.8 --- .../dockerfiles/devel-gpu+cu121.Dockerfile | 152 ++++++++++++++++++ .../2.13.0/dockerfiles/devel-gpu.Dockerfile | 23 ++- 2 files changed, 163 insertions(+), 12 deletions(-) create mode 100644 docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile b/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile new file mode 100644 index 0000000..8f97e4c --- /dev/null +++ b/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile @@ -0,0 +1,152 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +# +# THIS IS A GENERATED DOCKERFILE. +# +# This file was assembled from multiple pieces, whose use is documented +# throughout. Please refer to the TensorFlow dockerfiles documentation +# for more information. + +ARG UBUNTU_VERSION=22.04 + +ARG ARCH= +ARG CUDA=12.1 +FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}.1-devel-ubuntu${UBUNTU_VERSION} as base +# ARCH and CUDA are specified again because the FROM directive resets ARGs +# (but their default value is retained if set previously) +ARG ARCH +ARG CUDA +ARG CUDNN=8.9.3.28-1 +ARG CUDNN_MAJOR_VERSION=8 +ARG LIB_DIR_PREFIX=x86_64 +ARG LIBNVINFER=8.6.1.6-1 +ARG LIBNVINFER_MAJOR_VERSION=8 + +# Needed for string substitution +SHELL ["/bin/bash", "-c"] +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub && \ + apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + clang-format \ + cuda-command-line-tools-${CUDA/./-} \ + libcublas-${CUDA/./-} \ + libcublas-dev-${CUDA/./-} \ + cuda-nvprune-${CUDA/./-} \ + cuda-nvrtc-${CUDA/./-} \ + cuda-nvrtc-dev-${CUDA/./-} \ + cuda-cudart-dev-${CUDA/./-} \ + libcufft-dev-${CUDA/./-} \ + libcurand-dev-${CUDA/./-} \ + libcusolver-dev-${CUDA/./-} \ + libcusparse-dev-${CUDA/./-} \ + libcudnn8=${CUDNN}+cuda${CUDA} \ + libcudnn8-dev=${CUDNN}+cuda${CUDA} \ + libcurl3-dev \ + libfreetype6-dev \ + libhdf5-serial-dev \ + libzmq3-dev \ + pkg-config \ + rsync \ + software-properties-common \ + unzip \ + zip \ + zlib1g-dev \ + wget \ + git \ + && \ + find /usr/local/cuda-${CUDA}/lib64/ -type f -name 'lib*_static.a' -not -name 'libcudart_static.a' -delete + +# Install TensorRT if not building for PowerPC +# NOTE: libnvinfer uses cuda11.1 versions +RUN [[ "${ARCH}" = "ppc64le" ]] || { apt-get update && \ + apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub && \ + echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/tensorRT.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda12.0 \ + libnvinfer-dev=${LIBNVINFER}+cuda12.0 \ + libnvinfer-plugin-dev=${LIBNVINFER}+cuda12.0 \ + libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda12.0 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/*; } + +# Configure the build for our CUDA configuration. +ENV LD_LIBRARY_PATH /usr/local/cuda-12.1/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-12.1/lib64:/usr/local/cuda-11.2/lib64 +ENV TF_NEED_CUDA 1 +ENV TF_NEED_TENSORRT 1 +ENV TF_CUDA_VERSION=${CUDA} +ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION} +# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version +ARG CACHE_STOP=1 +# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 +ARG CHECKOUT_TF_SRC=0 +RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow_src || true + +# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure +# dynamic linker run-time bindings +RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \ + && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ + && ldconfig + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + git \ + wget \ + openjdk-8-jdk \ + python3-dev \ + virtualenv \ + swig + +RUN python3 -m pip install --upgrade pip +RUN python3 -m pip --no-cache-dir install \ + Pillow \ + h5py \ + keras_preprocessing \ + tb-nightly \ + matplotlib \ + mock \ + numpy \ + scipy \ + sklearn \ + pandas \ + future \ + portpicker \ + enum34 + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile b/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile index 49e254f..c7e1898 100644 --- a/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile +++ b/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu.Dockerfile @@ -19,19 +19,19 @@ # throughout. Please refer to the TensorFlow dockerfiles documentation # for more information. -ARG UBUNTU_VERSION=22.04 +ARG UBUNTU_VERSION=20.04 ARG ARCH= -ARG CUDA=12.1 -FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}.1-devel-ubuntu${UBUNTU_VERSION} as base +ARG CUDA=11.8 +FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}.0-devel-ubuntu${UBUNTU_VERSION} as base # ARCH and CUDA are specified again because the FROM directive resets ARGs # (but their default value is retained if set previously) ARG ARCH ARG CUDA -ARG CUDNN=8.9.3.28-1 +ARG CUDNN=8.6.0.163-1 ARG CUDNN_MAJOR_VERSION=8 ARG LIB_DIR_PREFIX=x86_64 -ARG LIBNVINFER=8.6.1.6-1 +ARG LIBNVINFER=8.5.3-1 ARG LIBNVINFER_MAJOR_VERSION=8 # Needed for string substitution @@ -75,15 +75,15 @@ RUN [[ "${ARCH}" = "ppc64le" ]] || { apt-get update && \ apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub && \ echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/tensorRT.list && \ apt-get update && \ - apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda12.0 \ - libnvinfer-dev=${LIBNVINFER}+cuda12.0 \ - libnvinfer-plugin-dev=${LIBNVINFER}+cuda12.0 \ - libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda12.0 \ + apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ + libnvinfer-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*; } # Configure the build for our CUDA configuration. -ENV LD_LIBRARY_PATH /usr/local/cuda-12.1/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-12.1/lib64:/usr/local/cuda-11.2/lib64 +ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64:/usr/local/cuda-11.2/lib64 ENV TF_NEED_CUDA 1 ENV TF_NEED_TENSORRT 1 ENV TF_CUDA_VERSION=${CUDA} @@ -124,7 +124,6 @@ RUN apt-get update && apt-get install -y \ virtualenv \ swig -RUN python3 -m pip install --upgrade pip RUN python3 -m pip --no-cache-dir install \ Pillow \ h5py \ @@ -132,7 +131,7 @@ RUN python3 -m pip --no-cache-dir install \ tb-nightly \ matplotlib \ mock \ - numpy \ + 'numpy<1.19.0' \ scipy \ scikit-learn \ pandas \ From 70c9ee164f3d4abbd18857138b9fdb2e5fca06d0 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 8 Aug 2023 22:43:00 +0200 Subject: [PATCH 09/38] install gcc11 in final image in order to build tf2.13 apps --- docker/Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 4ab4a7d..48ffe20 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -138,6 +138,18 @@ FROM "final-${TARGETARCH}" as final ARG TF_VERSION ARG GPU_POSTFIX +# install GCC 11 for 2.13 +# https://stackoverflow.com/a/67453352/7264974 +RUN if [ "${TF_VERSION}" = "2.13.0" ]; then \ + add-apt-repository ppa:ubuntu-toolchain-r/test && \ + apt-get update && \ + apt-get install -y gcc-11 g++-11 && \ + rm -rf /var/lib/apt/lists/* && \ + update-alternatives --remove-all cpp && \ + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-9 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-9 --slave /usr/bin/cpp cpp /usr/bin/cpp-9 && \ + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11 --slave /usr/bin/cpp cpp /usr/bin/cpp-11 ; \ + fi + # install TensorFlow C++ API incl. protobuf COPY --from=deb-package /libtensorflow-cc_${TF_VERSION}${GPU_POSTFIX}.deb /tmp RUN dpkg -i /tmp/libtensorflow-cc_${TF_VERSION}${GPU_POSTFIX}.deb && \ From c63fdaec4ada909f5482031792c4585257da8f96 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 8 Aug 2023 23:04:04 +0200 Subject: [PATCH 10/38] update readme to 2.13.0 --- README.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5d362d7..75f748f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ docker run --rm \ rwthika/tensorflow-cc:latest \ ./build-and-run.sh -# Hello from TensorFlow C++ 2.11.0! +# Hello from TensorFlow C++ 2.13.0! # # A = # 1 2 @@ -65,16 +65,16 @@ The pre-built `libtensorflow_cc.so` library and accompanying headers are package #### GPU ```bash -wget https://github.com/ika-rwth-aachen/libtensorflow_cc/releases/download/v2.11.0/libtensorflow-cc_2.11.0-gpu_$(dpkg --print-architecture).deb -sudo dpkg -i libtensorflow-cc_2.11.0-gpu_$(dpkg --print-architecture).deb +wget https://github.com/ika-rwth-aachen/libtensorflow_cc/releases/download/v2.13.0/libtensorflow-cc_2.13.0-gpu_$(dpkg --print-architecture).deb +sudo dpkg -i libtensorflow-cc_2.13.0-gpu_$(dpkg --print-architecture).deb ldconfig ``` #### CPU ```bash -wget https://github.com/ika-rwth-aachen/libtensorflow_cc/releases/download/v2.11.0/libtensorflow-cc_2.11.0_$(dpkg --print-architecture).deb -sudo dpkg -i libtensorflow-cc_2.11.0_$(dpkg --print-architecture).deb +wget https://github.com/ika-rwth-aachen/libtensorflow_cc/releases/download/v2.13.0/libtensorflow-cc_2.13.0_$(dpkg --print-architecture).deb +sudo dpkg -i libtensorflow-cc_2.13.0_$(dpkg --print-architecture).deb ldconfig ``` @@ -101,15 +101,16 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu | TensorFlow Version | CPU/GPU | Architecture | Image:Tag | | :---: | :---: | :---: | --- | -| 2.11.0 | GPU | amd64, arm64 | `rwthika/tensorflow-cc:latest-gpu` | -| 2.11.0 | CPU | amd64, arm64 | `rwthika/tensorflow-cc:latest` | +| 2.13.0 | GPU | amd64, arm64 | `rwthika/tensorflow-cc:latest-gpu` | +| 2.13.0 | CPU | amd64, arm64 | `rwthika/tensorflow-cc:latest` |
All TensorFlow Versions (GPU) | TensorFlow Version | Architecture | Image:Tag | | :---: | :---: | --- | -| latest | amd64, arm64 | `rwthika/tensorflow-cc:latest-gpu` | +| latest | amd64 | `rwthika/tensorflow-cc:latest-gpu` | +| 2.13.0 | amd64 | `rwthika/tensorflow-cc:2.13.0-gpu` | | 2.11.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.0-gpu` | | 2.10.1 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.1-gpu` | | 2.10.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.0-gpu` | @@ -135,7 +136,8 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu | TensorFlow Version | Architecture | Image:Tag | | :---: | :---: | --- | -| latest | amd64, arm64 | `rwthika/tensorflow-cc:latest` | +| latest | amd64 | `rwthika/tensorflow-cc:latest` | +| 2.13.0 | amd64 | `rwthika/tensorflow-cc:2.13.0` | | 2.11.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.0` | | 2.10.1 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.1` | | 2.10.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.0` | @@ -178,7 +180,7 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu If you would like to build the deb-package and Docker images yourself, use the [`Makefile`](Makefile) as instructed below. -All `make` targets support the flags `TF_VERSION` (defaults to `2.11.0`), `GPU` (defaults to `1`), and `ARCH` (defaults to host architecture) in order to build a specific TensorFlow version in CPU/GPU mode for a specific architecture. +All `make` targets support the flags `TF_VERSION` (defaults to `2.13.0`), `GPU` (defaults to `1`), and `ARCH` (defaults to host architecture) in order to build a specific TensorFlow version in CPU/GPU mode for a specific architecture. All `make` targets listed below also have a counterpart named `-all`, which can be used to build multiple TensorFlow versions one after the other using the `TF_VERSIONS` flag like so: @@ -242,6 +244,7 @@ make 5-print-versions | Version | Architecture | Step 1 (CPU) | Step 2 (CPU) | Step 4 (CPU) | Step 1 (GPU) | Step 2 (GPU) | Step 4 (GPU) | Notes | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | --- | +| 2.13.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.11.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.11.0 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.10.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | @@ -310,6 +313,7 @@ make 5-print-versions | TensorFlow | Architecture | Ubuntu | GCC | Bazel | Python | protobuf | CUDA | cuDNN | TensorRT | GPU Compute Capability | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| 2.13.0 | amd64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | 11.8.89 | 8.6.0 | 8.5.3 | 9.0, 8.9, 8.6, 8.0, 7.5, 7.0, 6.1, 6.0 | | 2.11.0 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | | 2.11.0 | arm64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.4.239 | 8.4.1 | 8.4.1 | 8.7, 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | | 2.10.1 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | From 8b233d72ab8d4ff73a1336188172ee9e015348b1 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Wed, 9 Aug 2023 14:43:50 +0200 Subject: [PATCH 11/38] successfully build 2.12.0, 2.12.1 --- Makefile | 8 +- docker/.Dockerfiles/.gitignore | 2 + docker/.Dockerfiles/2.12.0/bashrc | 53 ++++++ .../2.12.0/dockerfiles/devel-cpu.Dockerfile | 107 +++++++++++++ .../2.12.0/dockerfiles/devel-gpu.Dockerfile | 151 ++++++++++++++++++ docker/.Dockerfiles/2.12.1/bashrc | 53 ++++++ .../2.12.1/dockerfiles/devel-cpu.Dockerfile | 107 +++++++++++++ .../2.12.1/dockerfiles/devel-gpu.Dockerfile | 151 ++++++++++++++++++ docker/Dockerfile | 18 +-- docker/patch/2.12.0/workspace2.bzl.patch | 17 ++ docker/patch/2.12.1/workspace2.bzl.patch | 17 ++ scripts/4-test-libtensorflow-cc.sh | 2 +- 12 files changed, 672 insertions(+), 14 deletions(-) create mode 100644 docker/.Dockerfiles/2.12.0/bashrc create mode 100644 docker/.Dockerfiles/2.12.0/dockerfiles/devel-cpu.Dockerfile create mode 100644 docker/.Dockerfiles/2.12.0/dockerfiles/devel-gpu.Dockerfile create mode 100644 docker/.Dockerfiles/2.12.1/bashrc create mode 100644 docker/.Dockerfiles/2.12.1/dockerfiles/devel-cpu.Dockerfile create mode 100644 docker/.Dockerfiles/2.12.1/dockerfiles/devel-gpu.Dockerfile create mode 100644 docker/patch/2.12.0/workspace2.bzl.patch create mode 100644 docker/patch/2.12.1/workspace2.bzl.patch diff --git a/Makefile b/Makefile index e50d086..b551ea7 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ ARCH := $(if $(ARCH),$(ARCH),$(DEFAULT_ARCH)) # defaults DEFAULT_TF_VERSION := 2.13.0 -TF_VERSIONS := 2.13.0 2.11.0 2.10.1 2.10.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.3 2.5.2 2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.3 2.2.2 2.2.1 2.2.0 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 +TF_VERSIONS := 2.13.0 2.12.1 2.12.0 2.11.0 2.10.1 2.10.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.3 2.5.2 2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.3 2.2.2 2.2.1 2.2.0 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 DEFAULT_JOBS := $(shell nproc) DEFAULT_GPU := 1 ifeq ($(ARCH), arm64) @@ -118,15 +118,15 @@ clean-images: clean-official-devel-images clean-cpp-images clean-libtensorflow-c $(MAKEFILE_DIR)/scripts/$@.sh .PHONY: 1-build-official-devel-image -1-build-official-devel-image: 0-download-official-dockerfiles +1-build-official-devel-image: $(MAKEFILE_DIR)/scripts/$@.sh .PHONY: 2-build-cpp-image -2-build-cpp-image: 1-build-official-devel-image +2-build-cpp-image: $(MAKEFILE_DIR)/scripts/$@.sh .PHONY: 3-export-libtensorflow-cc -3-export-libtensorflow-cc: 2-build-cpp-image +3-export-libtensorflow-cc: $(MAKEFILE_DIR)/scripts/$@.sh .PHONY: 4-test-libtensorflow-cc diff --git a/docker/.Dockerfiles/.gitignore b/docker/.Dockerfiles/.gitignore index ff271f4..4a280e0 100644 --- a/docker/.Dockerfiles/.gitignore +++ b/docker/.Dockerfiles/.gitignore @@ -1,3 +1,5 @@ /* !.gitignore +!/2.12.0/ +!/2.12.1/ !/2.13.0/ diff --git a/docker/.Dockerfiles/2.12.0/bashrc b/docker/.Dockerfiles/2.12.0/bashrc new file mode 100644 index 0000000..d9dd7a6 --- /dev/null +++ b/docker/.Dockerfiles/2.12.0/bashrc @@ -0,0 +1,53 @@ +# Copyright 2018 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============================================================================== + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return + +export PS1="\[\e[31m\]tf-docker\[\e[m\] \[\e[33m\]\w\[\e[m\] > " +export TERM=xterm-256color +alias grep="grep --color=auto" +alias ls="ls --color=auto" + +echo -e "\e[1;31m" +cat< /etc/apt/sources.list.d/tensorRT.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ + libnvinfer-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/*; } + +# Configure the build for our CUDA configuration. +ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64:/usr/local/cuda-11.2/lib64 +ENV TF_NEED_CUDA 1 +ENV TF_NEED_TENSORRT 1 +ENV TF_CUDA_VERSION=${CUDA} +ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION} +# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version +ARG CACHE_STOP=1 +# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 +ARG CHECKOUT_TF_SRC=0 +RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow_src || true + +# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure +# dynamic linker run-time bindings +RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \ + && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ + && ldconfig + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + git \ + wget \ + openjdk-8-jdk \ + python3-dev \ + virtualenv \ + swig + +RUN python3 -m pip --no-cache-dir install \ + Pillow \ + h5py \ + keras_preprocessing \ + tb-nightly \ + matplotlib \ + mock \ + 'numpy<1.19.0' \ + scipy \ + scikit-learn \ + pandas \ + future \ + portpicker \ + enum34 + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc diff --git a/docker/.Dockerfiles/2.12.1/bashrc b/docker/.Dockerfiles/2.12.1/bashrc new file mode 100644 index 0000000..d9dd7a6 --- /dev/null +++ b/docker/.Dockerfiles/2.12.1/bashrc @@ -0,0 +1,53 @@ +# Copyright 2018 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============================================================================== + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return + +export PS1="\[\e[31m\]tf-docker\[\e[m\] \[\e[33m\]\w\[\e[m\] > " +export TERM=xterm-256color +alias grep="grep --color=auto" +alias ls="ls --color=auto" + +echo -e "\e[1;31m" +cat< /etc/apt/sources.list.d/tensorRT.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ + libnvinfer-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/*; } + +# Configure the build for our CUDA configuration. +ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64:/usr/local/cuda-11.2/lib64 +ENV TF_NEED_CUDA 1 +ENV TF_NEED_TENSORRT 1 +ENV TF_CUDA_VERSION=${CUDA} +ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION} +# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version +ARG CACHE_STOP=1 +# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 +ARG CHECKOUT_TF_SRC=0 +RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow_src || true + +# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure +# dynamic linker run-time bindings +RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \ + && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ + && ldconfig + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + git \ + wget \ + openjdk-8-jdk \ + python3-dev \ + virtualenv \ + swig + +RUN python3 -m pip --no-cache-dir install \ + Pillow \ + h5py \ + keras_preprocessing \ + tb-nightly \ + matplotlib \ + mock \ + 'numpy<1.19.0' \ + scipy \ + scikit-learn \ + pandas \ + future \ + portpicker \ + enum34 + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc diff --git a/docker/Dockerfile b/docker/Dockerfile index 48ffe20..96f6554 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -39,11 +39,11 @@ RUN if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ]; then \ git checkout FETCH_HEAD -- tensorflow/BUILD; \ fi -# fix build issue in 2.13.0 +# fix GPU-version build issue in 2.12.0, 2.12.1, 2.13.0 # https://github.com/tensorflow/tensorflow/issues/60398#issuecomment-1537040602 -COPY patch/2.13.0/workspace2.bzl.patch . -RUN if [ "${TF_VERSION}" = "2.13.0" ]; then \ - git apply workspace2.bzl.patch; \ +COPY patch/ patch/ +RUN if [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ + git apply patch/${TF_VERSION}/workspace2.bzl.patch; \ fi # configure compilation @@ -59,17 +59,17 @@ ENV TF_SET_ANDROID_WORKSPACE=0 RUN ./configure # build C++ library -# fix runtime issue in 2.10.0, 2.10.1, 2.11.0 +# fix runtime issue in 2.10.0, 2.10.1, 2.11.0, 2.12.0, 2.12.1, 2.13.0 # https://github.com/tensorflow/tensorflow/issues/59081 ARG JOBS="auto" RUN if [ "${GPU_POSTFIX}" = "-gpu" ]; then \ - if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ + if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ bazel build --jobs ${JOBS} --config=cuda --config=opt --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ else \ bazel build --jobs ${JOBS} --config=cuda --config=opt --config=monolithic --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ fi; \ else \ - if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ + if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ bazel build --jobs ${JOBS} --config=opt --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ else \ bazel build --jobs ${JOBS} --config=opt --config=monolithic --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ @@ -138,9 +138,9 @@ FROM "final-${TARGETARCH}" as final ARG TF_VERSION ARG GPU_POSTFIX -# install GCC 11 for 2.13 +# install GCC 11 for 2.12.0, 2.12.1, 2.13.0 # https://stackoverflow.com/a/67453352/7264974 -RUN if [ "${TF_VERSION}" = "2.13.0" ]; then \ +RUN if [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ add-apt-repository ppa:ubuntu-toolchain-r/test && \ apt-get update && \ apt-get install -y gcc-11 g++-11 && \ diff --git a/docker/patch/2.12.0/workspace2.bzl.patch b/docker/patch/2.12.0/workspace2.bzl.patch new file mode 100644 index 0000000..64aa087 --- /dev/null +++ b/docker/patch/2.12.0/workspace2.bzl.patch @@ -0,0 +1,17 @@ +diff --git a/tensorflow/workspace2.bzl b/tensorflow/workspace2.bzl +index 1261273b..0a9d755a 100644 +--- a/tensorflow/workspace2.bzl ++++ b/tensorflow/workspace2.bzl +@@ -172,9 +172,9 @@ def _tf_repositories(): + name = "cudnn_frontend_archive", + build_file = "//third_party:cudnn_frontend.BUILD", + patch_file = ["//third_party:cudnn_frontend_header_fix.patch"], +- sha256 = "3c7b842cd67989810955b220fa1116e7e2ed10660a8cfb632118146a64992c30", +- strip_prefix = "cudnn-frontend-0.7.3", +- urls = tf_mirror_urls("https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v0.7.3.zip"), ++ sha256 = "d8dba9e2607a0c256aa8eacb45b39986ab6f3f24a4d431d4397047a3cb0cd4fb", ++ strip_prefix = "cudnn-frontend-0.9", ++ urls = tf_mirror_urls("https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v0.9.zip"), + ) + + tf_http_archive( diff --git a/docker/patch/2.12.1/workspace2.bzl.patch b/docker/patch/2.12.1/workspace2.bzl.patch new file mode 100644 index 0000000..64aa087 --- /dev/null +++ b/docker/patch/2.12.1/workspace2.bzl.patch @@ -0,0 +1,17 @@ +diff --git a/tensorflow/workspace2.bzl b/tensorflow/workspace2.bzl +index 1261273b..0a9d755a 100644 +--- a/tensorflow/workspace2.bzl ++++ b/tensorflow/workspace2.bzl +@@ -172,9 +172,9 @@ def _tf_repositories(): + name = "cudnn_frontend_archive", + build_file = "//third_party:cudnn_frontend.BUILD", + patch_file = ["//third_party:cudnn_frontend_header_fix.patch"], +- sha256 = "3c7b842cd67989810955b220fa1116e7e2ed10660a8cfb632118146a64992c30", +- strip_prefix = "cudnn-frontend-0.7.3", +- urls = tf_mirror_urls("https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v0.7.3.zip"), ++ sha256 = "d8dba9e2607a0c256aa8eacb45b39986ab6f3f24a4d431d4397047a3cb0cd4fb", ++ strip_prefix = "cudnn-frontend-0.9", ++ urls = tf_mirror_urls("https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v0.9.zip"), + ) + + tf_http_archive( diff --git a/scripts/4-test-libtensorflow-cc.sh b/scripts/4-test-libtensorflow-cc.sh index 6dc86cc..ef8d0e9 100755 --- a/scripts/4-test-libtensorflow-cc.sh +++ b/scripts/4-test-libtensorflow-cc.sh @@ -23,7 +23,7 @@ source $(dirname "$0")/.common.sh EXAMPLE_DIR=${REPOSITORY_DIR}/example EXAMPLE_MOUNT="/example" -if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.13.0" ]; then +if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then CMD="./build-and-run.sh" else CMD="./build-and-run-monolithic.sh" From 191f39d30e01286426cf4621b7295aac18b44122 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Wed, 9 Aug 2023 21:39:28 +0200 Subject: [PATCH 12/38] update readme with 2.12.0, 2.12.1 --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 75f748f..03d220c 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,8 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu | :---: | :---: | --- | | latest | amd64 | `rwthika/tensorflow-cc:latest-gpu` | | 2.13.0 | amd64 | `rwthika/tensorflow-cc:2.13.0-gpu` | +| 2.12.1 | amd64 | - | +| 2.12.0 | amd64 | `rwthika/tensorflow-cc:2.12.0-gpu` | | 2.11.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.0-gpu` | | 2.10.1 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.1-gpu` | | 2.10.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.0-gpu` | @@ -138,6 +140,8 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu | :---: | :---: | --- | | latest | amd64 | `rwthika/tensorflow-cc:latest` | | 2.13.0 | amd64 | `rwthika/tensorflow-cc:2.13.0` | +| 2.12.1 | amd64 | - | +| 2.12.0 | amd64 | `rwthika/tensorflow-cc:2.12.0` | | 2.11.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.0` | | 2.10.1 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.1` | | 2.10.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.0` | @@ -245,6 +249,8 @@ make 5-print-versions | Version | Architecture | Step 1 (CPU) | Step 2 (CPU) | Step 4 (CPU) | Step 1 (GPU) | Step 2 (GPU) | Step 4 (GPU) | Notes | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | --- | | 2.13.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | +| 2.12.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | missing image `tensorflow/tensorflow:2.12.1` | +| 2.12.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.11.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.11.0 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.10.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | @@ -314,6 +320,8 @@ make 5-print-versions | TensorFlow | Architecture | Ubuntu | GCC | Bazel | Python | protobuf | CUDA | cuDNN | TensorRT | GPU Compute Capability | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | 2.13.0 | amd64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | 11.8.89 | 8.6.0 | 8.5.3 | 9.0, 8.9, 8.6, 8.0, 7.5, 7.0, 6.1, 6.0 | +| 2.12.1 | amd64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | 11.8.89 | 8.6.0 | 8.5.3 | 9.0, 8.9, 8.6, 8.0, 7.5, 7.0, 6.1, 6.0 | +| 2.12.0 | amd64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | 11.8.89 | 8.6.0 | 8.5.3 | 9.0, 8.9, 8.6, 8.0, 7.5, 7.0, 6.1, 6.0 | | 2.11.0 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | | 2.11.0 | arm64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.4.239 | 8.4.1 | 8.4.1 | 8.7, 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | | 2.10.1 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | From 7dbd2ed75bf4f5a47b46f432f863faff2f4c2b20 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Wed, 9 Aug 2023 22:20:29 +0200 Subject: [PATCH 13/38] successfully build 2.11.1 --- Makefile | 2 +- README.md | 3 +++ docker/Dockerfile | 13 +++++++++---- scripts/4-test-libtensorflow-cc.sh | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index b551ea7..03740ff 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ ARCH := $(if $(ARCH),$(ARCH),$(DEFAULT_ARCH)) # defaults DEFAULT_TF_VERSION := 2.13.0 -TF_VERSIONS := 2.13.0 2.12.1 2.12.0 2.11.0 2.10.1 2.10.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.3 2.5.2 2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.3 2.2.2 2.2.1 2.2.0 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 +TF_VERSIONS := 2.13.0 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.3 2.5.2 2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.3 2.2.2 2.2.1 2.2.0 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 DEFAULT_JOBS := $(shell nproc) DEFAULT_GPU := 1 ifeq ($(ARCH), arm64) diff --git a/README.md b/README.md index 03d220c..559309f 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,7 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu | 2.13.0 | amd64 | `rwthika/tensorflow-cc:2.13.0` | | 2.12.1 | amd64 | - | | 2.12.0 | amd64 | `rwthika/tensorflow-cc:2.12.0` | +| 2.11.1 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.1` | | 2.11.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.0` | | 2.10.1 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.1` | | 2.10.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.0` | @@ -251,6 +252,7 @@ make 5-print-versions | 2.13.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.12.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | missing image `tensorflow/tensorflow:2.12.1` | | 2.12.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | +| 2.11.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | - | - | missing image `nvidia/cuda:11.2.1-base-ubuntu20.04` | | 2.11.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.11.0 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.10.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | @@ -322,6 +324,7 @@ make 5-print-versions | 2.13.0 | amd64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | 11.8.89 | 8.6.0 | 8.5.3 | 9.0, 8.9, 8.6, 8.0, 7.5, 7.0, 6.1, 6.0 | | 2.12.1 | amd64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | 11.8.89 | 8.6.0 | 8.5.3 | 9.0, 8.9, 8.6, 8.0, 7.5, 7.0, 6.1, 6.0 | | 2.12.0 | amd64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | 11.8.89 | 8.6.0 | 8.5.3 | 9.0, 8.9, 8.6, 8.0, 7.5, 7.0, 6.1, 6.0 | +| 2.11.1 | amd64 | 20.04 | 9.4.0 | 6.3.2 | 3.8.10 | 3.9.2 | - | - | - | - | | 2.11.0 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | | 2.11.0 | arm64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.4.239 | 8.4.1 | 8.4.1 | 8.7, 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | | 2.10.1 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | diff --git a/docker/Dockerfile b/docker/Dockerfile index 96f6554..1c3d239 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -59,17 +59,17 @@ ENV TF_SET_ANDROID_WORKSPACE=0 RUN ./configure # build C++ library -# fix runtime issue in 2.10.0, 2.10.1, 2.11.0, 2.12.0, 2.12.1, 2.13.0 +# fix runtime issue in 2.10.0, 2.10.1, 2.11.0, 2.11.1, 2.12.0, 2.12.1, 2.13.0 by building non-monolithic # https://github.com/tensorflow/tensorflow/issues/59081 ARG JOBS="auto" RUN if [ "${GPU_POSTFIX}" = "-gpu" ]; then \ - if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ + if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.11.1" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ bazel build --jobs ${JOBS} --config=cuda --config=opt --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ else \ bazel build --jobs ${JOBS} --config=cuda --config=opt --config=monolithic --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ fi; \ else \ - if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ + if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.11.1" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ bazel build --jobs ${JOBS} --config=opt --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ else \ bazel build --jobs ${JOBS} --config=opt --config=monolithic --verbose_failures tensorflow:libtensorflow_cc.so tensorflow:install_headers; \ @@ -138,7 +138,12 @@ FROM "final-${TARGETARCH}" as final ARG TF_VERSION ARG GPU_POSTFIX -# install GCC 11 for 2.12.0, 2.12.1, 2.13.0 +# make sure gcc is installed +RUN apt-get update && \ + apt-get install -y build-essential && \ + rm -rf /var/lib/apt/lists/* + +# install gcc 11 for 2.12.0, 2.12.1, 2.13.0 # https://stackoverflow.com/a/67453352/7264974 RUN if [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ add-apt-repository ppa:ubuntu-toolchain-r/test && \ diff --git a/scripts/4-test-libtensorflow-cc.sh b/scripts/4-test-libtensorflow-cc.sh index ef8d0e9..3d71d4a 100755 --- a/scripts/4-test-libtensorflow-cc.sh +++ b/scripts/4-test-libtensorflow-cc.sh @@ -23,7 +23,7 @@ source $(dirname "$0")/.common.sh EXAMPLE_DIR=${REPOSITORY_DIR}/example EXAMPLE_MOUNT="/example" -if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then +if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.11.1" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then CMD="./build-and-run.sh" else CMD="./build-and-run-monolithic.sh" From 88672f2b8247120a34cea136acf98d5e8e5cb7e2 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Wed, 9 Aug 2023 23:26:29 +0200 Subject: [PATCH 14/38] add option to build and export pip package --- Makefile | 2 ++ README.md | 2 +- docker/Dockerfile | 31 ++++++++++++++++++++++++++-- scripts/2-build-cpp-image.sh | 2 +- scripts/3-export-libtensorflow-cc.sh | 14 ++++++++++--- tensorflow-wheel/.gitignore | 2 ++ 6 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 tensorflow-wheel/.gitignore diff --git a/Makefile b/Makefile index 03740ff..9ec1fc8 100644 --- a/Makefile +++ b/Makefile @@ -37,12 +37,14 @@ ifeq ($(ARCH), arm64) else DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES := 6.0,6.1,7.0,7.5,8.0,8.6,8.9,9.0 endif +DEFAULT_BUILD_PIP_PACKAGE := 0 # arguments TF_VERSION := $(if $(TF_VERSION),$(TF_VERSION),$(DEFAULT_TF_VERSION)) JOBS := $(if $(JOBS),$(JOBS),$(DEFAULT_JOBS)) GPU := $(if $(GPU),$(GPU),$(DEFAULT_GPU)) TF_CUDA_COMPUTE_CAPABILITIES := $(if $(TF_CUDA_COMPUTE_CAPABILITIES),$(TF_CUDA_COMPUTE_CAPABILITIES),$(DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES)) +BUILD_PIP_PACKAGE := $(if $(BUILD_PIP_PACKAGE),$(BUILD_PIP_PACKAGE),$(DEFAULT_BUILD_PIP_PACKAGE)) # variables ifeq ($(GPU), 1) diff --git a/README.md b/README.md index 559309f..ead15cb 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu If you would like to build the deb-package and Docker images yourself, use the [`Makefile`](Makefile) as instructed below. -All `make` targets support the flags `TF_VERSION` (defaults to `2.13.0`), `GPU` (defaults to `1`), and `ARCH` (defaults to host architecture) in order to build a specific TensorFlow version in CPU/GPU mode for a specific architecture. +All `make` targets support the flags `TF_VERSION` (defaults to `2.13.0`), `GPU` (defaults to `1`), and `ARCH` (defaults to host architecture) in order to build a specific TensorFlow version in CPU/GPU mode for a specific architecture. The flag `BUILD_PIP_PACKAGE` (defaults to `0`) enables you to also build the pip-package alongside. All `make` targets listed below also have a counterpart named `-all`, which can be used to build multiple TensorFlow versions one after the other using the `TF_VERSIONS` flag like so: diff --git a/docker/Dockerfile b/docker/Dockerfile index 1c3d239..f37710f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -77,12 +77,35 @@ RUN if [ "${GPU_POSTFIX}" = "-gpu" ]; then \ fi # move libtensorflow_cc to separate folder for easier Dockerfile COPY -RUN mkdir bazel-bin/tensorflow/lib && \ +RUN mkdir -p bazel-bin/tensorflow/lib && \ + mkdir -p bazel-bin/tensorflow/pip && \ mv bazel-bin/tensorflow/libtensorflow_cc.so* bazel-bin/tensorflow/lib/ && \ mv bazel-bin/tensorflow/libtensorflow_framework.so* bazel-bin/tensorflow/lib/ && \ - ln -s libtensorflow_framework.so.2 bazel-bin/tensorflow/lib/libtensorflow_framework.so && \ + ln -sf libtensorflow_framework.so.2 bazel-bin/tensorflow/lib/libtensorflow_framework.so && \ rm bazel-bin/tensorflow/lib/*params +# build pip package +# fix runtime issue in 2.10.0, 2.10.1, 2.11.0, 2.11.1, 2.12.0, 2.12.1, 2.13.0 by building non-monolithic +# https://github.com/tensorflow/tensorflow/issues/59081 +ARG BUILD_PIP_PACKAGE=0 +RUN if [ "${BUILD_PIP_PACKAGE}" = "1" ]; then \ + if [ "${GPU_POSTFIX}" = "-gpu" ]; then \ + if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.11.1" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ + bazel build --jobs ${JOBS} --config=cuda --config=opt --verbose_failures tensorflow/tools/pip_package:build_pip_package; \ + else \ + bazel build --jobs ${JOBS} --config=cuda --config=opt --config=monolithic --verbose_failures tensorflow/tools/pip_package:build_pip_package; \ + fi; \ + else \ + if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ] || [ "${TF_VERSION}" = "2.11.0" ] || [ "${TF_VERSION}" = "2.11.1" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ + bazel build --jobs ${JOBS} --config=opt --verbose_failures tensorflow/tools/pip_package:build_pip_package; \ + else \ + bazel build --jobs ${JOBS} --config=opt --config=monolithic --verbose_failures tensorflow/tools/pip_package:build_pip_package; \ + fi; \ + fi; \ + pip install patchelf && \ + ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow/pip ; \ + fi + # build protobuf from source, same version as TensorFlow is using WORKDIR / RUN apt-get install -y autoconf automake libtool curl make g++ unzip && \ @@ -126,6 +149,10 @@ WORKDIR / RUN dpkg-deb --build --root-owner-group libtensorflow-cc_${TF_VERSION}${GPU_POSTFIX} && \ rm -rf libtensorflow-cc_${TF_VERSION}${GPU_POSTFIX}/ +# copy pip package, if built +ARG BUILD_PIP_PACKAGE=0 +COPY --from=build /tmp/tensorflow/pip/tensorflow*.whl / + # --- final stage with TensorFlow Python and C++ Library ----------------------- FROM --platform=amd64 tensorflow/tensorflow:${TF_VERSION}${GPU_POSTFIX} as final-amd64 ARG TARGETARCH diff --git a/scripts/2-build-cpp-image.sh b/scripts/2-build-cpp-image.sh index b7e4517..98977de 100755 --- a/scripts/2-build-cpp-image.sh +++ b/scripts/2-build-cpp-image.sh @@ -22,5 +22,5 @@ source $(dirname "$0")/.common.sh echo "Building ${IMAGE_CPP} ... " -docker build --build-arg TARGETARCH=$ARCH --build-arg TF_VERSION=${TF_VERSION} --build-arg JOBS=${JOBS} --build-arg GPU_POSTFIX=${GPU_POSTFIX} --build-arg TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES} -t ${IMAGE_CPP_ARCH} ${DOCKER_DIR} | tee ${LOG_FILE} +docker build --build-arg TARGETARCH=$ARCH --build-arg TF_VERSION=${TF_VERSION} --build-arg JOBS=${JOBS} --build-arg GPU_POSTFIX=${GPU_POSTFIX} --build-arg TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES} --build-arg BUILD_PIP_PACKAGE=${BUILD_PIP_PACKAGE} -t ${IMAGE_CPP_ARCH} ${DOCKER_DIR} | tee ${LOG_FILE} docker tag ${IMAGE_CPP_ARCH} ${IMAGE_CPP} \ No newline at end of file diff --git a/scripts/3-export-libtensorflow-cc.sh b/scripts/3-export-libtensorflow-cc.sh index bcdeadb..df152d5 100755 --- a/scripts/3-export-libtensorflow-cc.sh +++ b/scripts/3-export-libtensorflow-cc.sh @@ -24,12 +24,20 @@ source $(dirname "$0")/.common.sh EXPORT_DIR=${REPOSITORY_DIR}/libtensorflow-cc CONTAINER_FILE="libtensorflow-cc_${TF_VERSION}${GPU_POSTFIX}.deb" EXPORT_FILE="libtensorflow-cc_${TF_VERSION}${GPU_POSTFIX}_${ARCH}.deb" + +EXPORT_DIR_PIP=${REPOSITORY_DIR}/tensorflow-wheel +CONTAINER_FILE_PIP="tensorflow-${TF_VERSION}*.whl" + STAGE="deb-package" echo "Building ${IMAGE_LIBTENSORFLOW_CC_ARCH} ... " -docker build --build-arg TARGETARCH=$ARCH --build-arg TF_VERSION=${TF_VERSION} --build-arg JOBS=${JOBS} --build-arg GPU_POSTFIX=${GPU_POSTFIX} --build-arg TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES} --target ${STAGE} -t ${IMAGE_LIBTENSORFLOW_CC_ARCH} ${DOCKER_DIR} | tee ${LOG_FILE} +docker build --build-arg TARGETARCH=$ARCH --build-arg TF_VERSION=${TF_VERSION} --build-arg JOBS=${JOBS} --build-arg GPU_POSTFIX=${GPU_POSTFIX} --build-arg TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES} --build-arg BUILD_PIP_PACKAGE=${BUILD_PIP_PACKAGE} --target ${STAGE} -t ${IMAGE_LIBTENSORFLOW_CC_ARCH} ${DOCKER_DIR} | tee ${LOG_FILE} echo "Exporting to $(realpath ${EXPORT_DIR})/${EXPORT_FILE} ... " -TMP_CONTAINER=$(docker create ${IMAGE_LIBTENSORFLOW_CC_ARCH}) +TMP_CONTAINER=$(docker run -d --rm ${IMAGE_LIBTENSORFLOW_CC_ARCH} sleep infinity) docker cp ${TMP_CONTAINER}:/${CONTAINER_FILE} ${EXPORT_DIR}/${EXPORT_FILE} -docker rm -v ${TMP_CONTAINER} +if [ "$BUILD_PIP_PACKAGE" = "1" ]; then + echo "Exporting to $(realpath ${EXPORT_DIR_PIP}) ... " + docker exec ${TMP_CONTAINER} bash -c "ls /${CONTAINER_FILE_PIP}" | while read f; do docker cp ${TMP_CONTAINER}:/$f ${EXPORT_DIR_PIP}; done +fi +docker kill ${TMP_CONTAINER} diff --git a/tensorflow-wheel/.gitignore b/tensorflow-wheel/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/tensorflow-wheel/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file From d355248c3911c76bdba1dc459a81c43d7b9ccf33 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 10 Aug 2023 10:15:33 +0200 Subject: [PATCH 15/38] update sklearn in 2.13.0 devel dockerfile --- .../.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile b/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile index 8f97e4c..49e254f 100644 --- a/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile +++ b/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile @@ -134,7 +134,7 @@ RUN python3 -m pip --no-cache-dir install \ mock \ numpy \ scipy \ - sklearn \ + scikit-learn \ pandas \ future \ portpicker \ From 022adfa888193559d5878c671e1a825828886688 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Thu, 10 Aug 2023 16:42:17 +0200 Subject: [PATCH 16/38] generate own arm64 gpu devel Dockerfile --- .../2.13.0/dockerfiles/arm64v8/.gitignore | 2 + .../arm64v8/devel-cpu-arm64v8.Dockerfile | 2 +- .../arm64v8/devel-gpu-arm64v8.Dockerfile | 125 ++++++++++++++++++ docker/Dockerfile | 3 +- scripts/1-build-official-devel-image.sh | 14 +- 5 files changed, 138 insertions(+), 8 deletions(-) create mode 100644 docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/.gitignore create mode 100644 docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/.gitignore b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/.gitignore new file mode 100644 index 0000000..78d0ae7 --- /dev/null +++ b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/.gitignore @@ -0,0 +1,2 @@ +cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_arm64.deb +nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_arm64.deb \ No newline at end of file diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile index e52e34a..f4002c3 100644 --- a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -21,7 +21,7 @@ ARG UBUNTU_VERSION=20.04 -FROM nvcr.io/nvidia/l4t-tensorflow:r35.3.1-tf2.11-py3 AS base +FROM ubuntu:${UBUNTU_VERSION} AS base ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile new file mode 100644 index 0000000..f4ce8ad --- /dev/null +++ b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile @@ -0,0 +1,125 @@ +ARG UBUNTU_VERSION=20.04 + +FROM nvcr.io/nvidia/l4t-base:35.4.1 as base +ENV DEBIAN_FRONTEND=noninteractive + +ARG CUDA=11.8 +ARG CUDNN=8.6.0.163-1 +ARG CUDNN_MAJOR_VERSION=8 +ARG LIBNVINFER=8.5.3-1 +ARG LIBNVINFER_MAJOR_VERSION=8 + +# Needed for string substitution +SHELL ["/bin/bash", "-c"] + +# essentials +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 +RUN apt-get update && apt-get install -y \ + build-essential \ + clang-format \ + curl \ + git \ + gnupg2 \ + libcurl3-dev \ + libfreetype6-dev \ + libhdf5-serial-dev \ + libzmq3-dev \ + openjdk-8-jdk \ + pkg-config \ + python3 \ + python3-dev \ + python3-pip \ + rsync \ + software-properties-common \ + swig \ + unzip \ + virtualenv \ + wget \ + zip \ + zlib1g-dev + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN python3 -m pip --no-cache-dir install \ + Pillow \ + h5py \ + keras_preprocessing \ + tb-nightly \ + matplotlib \ + mock \ + 'numpy<1.19.0' \ + scipy \ + scikit-learn \ + pandas \ + future \ + portpicker \ + enum34 + + +# CUDA 11.8 - jetson - native - ubuntu 20.04 +RUN wget -q -O /tmp/cuda-keyring_1.0-1_all.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/arm64/cuda-keyring_1.0-1_all.deb && \ + dpkg -i /tmp/cuda-keyring_1.0-1_all.deb + +# l4t stuff +RUN echo "deb https://repo.download.nvidia.com/jetson/common r35.4 main" >> /etc/apt/sources.list && \ + echo "deb https://repo.download.nvidia.com/jetson/t194 r35.4 main" >> /etc/apt/sources.list && \ + apt-key adv --fetch-key http://repo.download.nvidia.com/jetson/jetson-ota-public.asc +RUN mkdir -p /opt/nvidia/l4t-packages/ && \ + touch /opt/nvidia/l4t-packages/.nv-l4t-disable-boot-fw-update-in-preinstall + +# install CUDA 11.8 for jetson and its dependencies (includes l4t stuff) +RUN apt-get update && \ + echo "N" | apt-get install -y cuda-${CUDA/./-} +RUN echo "export PATH=/usr/local/cuda-11.8/bin:$PATH" >> ~/.bashrc + +# libcudnn8 +# Download from https://developer.nvidia.com/compute/cudnn/secure/8.6.0/local_installers/11.8/cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_arm64.deb +COPY dockerfiles/arm64v8/cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_arm64.deb /cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_arm64.deb +RUN dpkg -i cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_arm64.deb && \ + cp /var/cudnn-local-repo-ubuntu2004-8.6.0.163/cudnn-local-04A93B30-keyring.gpg /usr/share/keyrings/ && \ + apt-get update && \ + apt-get install -y \ + libcudnn${CUDNN_MAJOR_VERSION}=${CUDNN}+cuda${CUDA} \ + libcudnn${CUDNN_MAJOR_VERSION}-dev=${CUDNN}+cuda${CUDA} + +# libnvinfer8 (TensorRT) +# Download from: https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.5.3/local_repos/nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_arm64.deb +COPY dockerfiles/arm64v8/nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_arm64.deb /nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_arm64.deb +RUN dpkg -i nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_arm64.deb && \ + cp /var/nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8/nv-tensorrt-local-5C39D720-keyring.gpg /usr/share/keyrings/ && \ + apt-get update && \ + apt-get install -y \ + libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda${CUDA} \ + libnvinfer-dev=${LIBNVINFER}+cuda${CUDA} \ + libnvinfer-plugin-dev=${LIBNVINFER}+cuda${CUDA} \ + libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda${CUDA} + +# Configure the build for our CUDA configuration. +ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64 +ENV TF_NEED_CUDA 1 +ENV TF_NEED_TENSORRT 1 +ENV TF_CUDA_VERSION=${CUDA} +ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION} + +# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure +# dynamic linker run-time bindings +RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \ + && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ + && ldconfig + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-arm64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index f37710f..6487c50 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -173,8 +173,9 @@ RUN apt-get update && \ # install gcc 11 for 2.12.0, 2.12.1, 2.13.0 # https://stackoverflow.com/a/67453352/7264974 RUN if [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ - add-apt-repository ppa:ubuntu-toolchain-r/test && \ apt-get update && \ + apt-get install -y software-properties-common && \ + add-apt-repository ppa:ubuntu-toolchain-r/test && \ apt-get install -y gcc-11 g++-11 && \ rm -rf /var/lib/apt/lists/* && \ update-alternatives --remove-all cpp && \ diff --git a/scripts/1-build-official-devel-image.sh b/scripts/1-build-official-devel-image.sh index dbe2bb2..572e2f6 100755 --- a/scripts/1-build-official-devel-image.sh +++ b/scripts/1-build-official-devel-image.sh @@ -27,13 +27,15 @@ BUILD_DIR=${DOWNLOAD_DOCKERFILE_DIR} if [ "$ARCH" = "amd64" ]; then DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/devel${CPU_GPU_POSTFIX}.Dockerfile elif [ "$ARCH" = "arm64" ]; then - DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile - if [ "$TF_VERSION" = "2.8.4" ]; then - sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r34.1.1-tf2.8-py3/" $DOCKERFILE - elif [ "$TF_VERSION" = "2.13.0" ]; then - sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.3.1-tf2.11-py3/" $DOCKERFILE + if [ "$TF_VERSION" = "2.13.0" ]; then + DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel${CPU_GPU_POSTFIX}-arm64v8.Dockerfile else - sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE + DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile + if [ "$TF_VERSION" = "2.8.4" ]; then + sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r34.1.1-tf2.8-py3/" $DOCKERFILE + else + sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE + fi fi fi From 902a90dc8ab767b464e6fab395acd967c6b365cf Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Mon, 14 Aug 2023 13:08:56 +0200 Subject: [PATCH 17/38] update default compute capabilities in other script --- scripts/.common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/.common.sh b/scripts/.common.sh index 56d35aa..9ed9bd3 100644 --- a/scripts/.common.sh +++ b/scripts/.common.sh @@ -33,9 +33,9 @@ GPU=${GPU:-${DEFAULT_GPU}} ARCH=${ARCH:-${DEFAULT_ARCH}} if [ "$ARCH" = "arm64" ]; then - DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES=5.3,6.0,6.1,7.0,7.2,7.5,8.0,8.6,8.7 + DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES=5.3,6.2,7.2,8.7 else - DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES=5.3,6.0,6.1,7.0,7.2,7.5,8.0,8.6 + DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES=6.0,6.1,7.0,7.5,8.0,8.6,8.9,9.0 fi TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES:-${DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES}} From 4c4dc1e781d28ea63690244c3ecb22f444f20927 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Mon, 14 Aug 2023 13:47:02 +0200 Subject: [PATCH 18/38] enable building on arm macs --- Makefile | 4 ++-- scripts/.common.sh | 4 ++-- scripts/1-build-official-devel-image.sh | 10 +++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9ec1fc8..11df315 100644 --- a/Makefile +++ b/Makefile @@ -24,13 +24,13 @@ MAKEFLAGS += --no-print-directory MAKEFILE_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) # build architecture -DEFAULT_ARCH := $(shell dpkg --print-architecture) +DEFAULT_ARCH := $(shell dpkg --print-architecture 2> /dev/null || uname -m) ARCH := $(if $(ARCH),$(ARCH),$(DEFAULT_ARCH)) # defaults DEFAULT_TF_VERSION := 2.13.0 TF_VERSIONS := 2.13.0 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.3 2.5.2 2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.3 2.2.2 2.2.1 2.2.0 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 -DEFAULT_JOBS := $(shell nproc) +DEFAULT_JOBS := $(shell nproc 2> /dev/null || sysctl -n hw.ncpu) DEFAULT_GPU := 1 ifeq ($(ARCH), arm64) DEFAULT_TF_CUDA_COMPUTE_CAPABILITIES := 5.3,6.2,7.2,8.7 diff --git a/scripts/.common.sh b/scripts/.common.sh index 9ed9bd3..15478e5 100644 --- a/scripts/.common.sh +++ b/scripts/.common.sh @@ -22,9 +22,9 @@ set -e set -o pipefail DEFAULT_TF_VERSION="2.13.0" -DEFAULT_JOBS=$(nproc) +DEFAULT_JOBS=$(nproc 2> /dev/null || sysctl -n hw.ncpu) DEFAULT_GPU=1 -DEFAULT_ARCH=$(dpkg --print-architecture) +DEFAULT_ARCH=$(dpkg --print-architecture 2> /dev/null || uname -m) TF_VERSION=${TF_VERSION:-${DEFAULT_TF_VERSION}} JOBS=${JOBS:-${DEFAULT_JOBS}} diff --git a/scripts/1-build-official-devel-image.sh b/scripts/1-build-official-devel-image.sh index 572e2f6..7ac82b9 100755 --- a/scripts/1-build-official-devel-image.sh +++ b/scripts/1-build-official-devel-image.sh @@ -23,6 +23,10 @@ source $(dirname "$0")/.common.sh CPU_GPU_POSTFIX=${GPU_POSTFIX:--cpu} BUILD_DIR=${DOWNLOAD_DOCKERFILE_DIR} +BSD_SED_ARG="" +if [ "$(uname -s)" = "Darwin" ]; then + BSD_SED_ARG=".bak" +fi if [ "$ARCH" = "amd64" ]; then DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/devel${CPU_GPU_POSTFIX}.Dockerfile @@ -32,16 +36,16 @@ elif [ "$ARCH" = "arm64" ]; then else DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile if [ "$TF_VERSION" = "2.8.4" ]; then - sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r34.1.1-tf2.8-py3/" $DOCKERFILE + sed -i $BSD_SED_ARG "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r34.1.1-tf2.8-py3/" $DOCKERFILE else - sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE + sed -i $BSD_SED_ARG "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE fi fi fi # replace sklearn (deprecated) with scikit-learn # https://pypi.org/project/sklearn/ -sed -i "s/sklearn/scikit-learn/" $DOCKERFILE +sed -i $BSD_SED_ARG "s/sklearn/scikit-learn/" $DOCKERFILE echo "Building ${IMAGE_DEVEL_ARCH} ... " docker build -t ${IMAGE_DEVEL_ARCH} -f ${DOCKERFILE} ${BUILD_DIR} | tee ${LOG_FILE} From cb6b4a419de809902c671427fe02db5db3b5c810 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Mon, 14 Aug 2023 14:24:48 +0200 Subject: [PATCH 19/38] revert changes for non-working 2.13.0 on arm64 and store special 2.11.0 devel dockerfiles --- docker/.Dockerfiles/.gitignore | 1 + docker/.Dockerfiles/2.11.0/bashrc | 53 ++++++ .../arm64v8/devel-cpu-arm64v8.Dockerfile | 5 +- .../dockerfiles/devel-cpu-ubuntu20.Dockerfile | 108 +++++++++++++ .../dockerfiles/devel-cpu-ubuntu22.Dockerfile | 108 +++++++++++++ .../devel-gpu+cu118-ubuntu20.Dockerfile | 152 ++++++++++++++++++ .../devel-gpu+cu118-ubuntu22.Dockerfile} | 30 ++-- .../2.13.0/dockerfiles/arm64v8/.gitignore | 2 - .../arm64v8/devel-gpu-arm64v8.Dockerfile | 125 -------------- scripts/1-build-official-devel-image.sh | 12 +- 10 files changed, 443 insertions(+), 153 deletions(-) create mode 100644 docker/.Dockerfiles/2.11.0/bashrc rename docker/.Dockerfiles/{2.13.0 => 2.11.0}/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile (97%) create mode 100644 docker/.Dockerfiles/2.11.0/dockerfiles/devel-cpu-ubuntu20.Dockerfile create mode 100644 docker/.Dockerfiles/2.11.0/dockerfiles/devel-cpu-ubuntu22.Dockerfile create mode 100644 docker/.Dockerfiles/2.11.0/dockerfiles/devel-gpu+cu118-ubuntu20.Dockerfile rename docker/.Dockerfiles/{2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile => 2.11.0/dockerfiles/devel-gpu+cu118-ubuntu22.Dockerfile} (88%) delete mode 100644 docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/.gitignore delete mode 100644 docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile diff --git a/docker/.Dockerfiles/.gitignore b/docker/.Dockerfiles/.gitignore index 4a280e0..2e5a32f 100644 --- a/docker/.Dockerfiles/.gitignore +++ b/docker/.Dockerfiles/.gitignore @@ -1,5 +1,6 @@ /* !.gitignore +!/2.11.0/ !/2.12.0/ !/2.12.1/ !/2.13.0/ diff --git a/docker/.Dockerfiles/2.11.0/bashrc b/docker/.Dockerfiles/2.11.0/bashrc new file mode 100644 index 0000000..d9dd7a6 --- /dev/null +++ b/docker/.Dockerfiles/2.11.0/bashrc @@ -0,0 +1,53 @@ +# Copyright 2018 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============================================================================== + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return + +export PS1="\[\e[31m\]tf-docker\[\e[m\] \[\e[33m\]\w\[\e[m\] > " +export TERM=xterm-256color +alias grep="grep --color=auto" +alias ls="ls --color=auto" + +echo -e "\e[1;31m" +cat< /etc/apt/sources.list.d/tensorRT.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ + libnvinfer-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Configure the build for our CUDA configuration. +ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64:/usr/local/cuda-11.8/lib64 +ENV TF_NEED_CUDA 1 +ENV TF_NEED_TENSORRT 1 +ENV TF_CUDA_VERSION=${CUDA} +ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION} +# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version +ARG CACHE_STOP=1 +# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 +ARG CHECKOUT_TF_SRC=0 +RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow_src || true + +# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure +# dynamic linker run-time bindings +RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \ + && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ + && ldconfig + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + git \ + wget \ + openjdk-8-jdk \ + python3-dev \ + virtualenv \ + swig + +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip --no-cache-dir install \ + Pillow \ + h5py \ + tb-nightly \ + matplotlib \ + mock \ + numpy \ + scipy \ + scikit-learn \ + pandas \ + future \ + portpicker \ + enum34 \ + 'protobuf < 4' + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile b/docker/.Dockerfiles/2.11.0/dockerfiles/devel-gpu+cu118-ubuntu22.Dockerfile similarity index 88% rename from docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile rename to docker/.Dockerfiles/2.11.0/dockerfiles/devel-gpu+cu118-ubuntu22.Dockerfile index 49e254f..fa81f63 100644 --- a/docker/.Dockerfiles/2.13.0/dockerfiles/devel-gpu+cu121.Dockerfile +++ b/docker/.Dockerfiles/2.11.0/dockerfiles/devel-gpu+cu118-ubuntu22.Dockerfile @@ -22,16 +22,16 @@ ARG UBUNTU_VERSION=22.04 ARG ARCH= -ARG CUDA=12.1 -FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}.1-devel-ubuntu${UBUNTU_VERSION} as base +ARG CUDA=11.8 +FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}.0-devel-ubuntu${UBUNTU_VERSION} as base # ARCH and CUDA are specified again because the FROM directive resets ARGs # (but their default value is retained if set previously) ARG ARCH ARG CUDA -ARG CUDNN=8.9.3.28-1 +ARG CUDNN=8.6.0.163-1 ARG CUDNN_MAJOR_VERSION=8 ARG LIB_DIR_PREFIX=x86_64 -ARG LIBNVINFER=8.6.1.6-1 +ARG LIBNVINFER=8.5.3-1 ARG LIBNVINFER_MAJOR_VERSION=8 # Needed for string substitution @@ -71,19 +71,19 @@ RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/ # Install TensorRT if not building for PowerPC # NOTE: libnvinfer uses cuda11.1 versions -RUN [[ "${ARCH}" = "ppc64le" ]] || { apt-get update && \ +RUN apt-get update && \ apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub && \ echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/tensorRT.list && \ apt-get update && \ - apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda12.0 \ - libnvinfer-dev=${LIBNVINFER}+cuda12.0 \ - libnvinfer-plugin-dev=${LIBNVINFER}+cuda12.0 \ - libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda12.0 \ + apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ + libnvinfer-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin-dev=${LIBNVINFER}+cuda11.8 \ + libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.8 \ && apt-get clean \ - && rm -rf /var/lib/apt/lists/*; } + && rm -rf /var/lib/apt/lists/* # Configure the build for our CUDA configuration. -ENV LD_LIBRARY_PATH /usr/local/cuda-12.1/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-12.1/lib64:/usr/local/cuda-11.2/lib64 +ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64:/usr/local/cuda-11.8/lib64 ENV TF_NEED_CUDA 1 ENV TF_NEED_TENSORRT 1 ENV TF_CUDA_VERSION=${CUDA} @@ -124,11 +124,10 @@ RUN apt-get update && apt-get install -y \ virtualenv \ swig -RUN python3 -m pip install --upgrade pip -RUN python3 -m pip --no-cache-dir install \ +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip --no-cache-dir install \ Pillow \ h5py \ - keras_preprocessing \ tb-nightly \ matplotlib \ mock \ @@ -138,7 +137,8 @@ RUN python3 -m pip --no-cache-dir install \ pandas \ future \ portpicker \ - enum34 + enum34 \ + 'protobuf < 4' # Installs bazelisk RUN mkdir /bazel && \ diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/.gitignore b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/.gitignore deleted file mode 100644 index 78d0ae7..0000000 --- a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_arm64.deb -nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_arm64.deb \ No newline at end of file diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile deleted file mode 100644 index f4ce8ad..0000000 --- a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile +++ /dev/null @@ -1,125 +0,0 @@ -ARG UBUNTU_VERSION=20.04 - -FROM nvcr.io/nvidia/l4t-base:35.4.1 as base -ENV DEBIAN_FRONTEND=noninteractive - -ARG CUDA=11.8 -ARG CUDNN=8.6.0.163-1 -ARG CUDNN_MAJOR_VERSION=8 -ARG LIBNVINFER=8.5.3-1 -ARG LIBNVINFER_MAJOR_VERSION=8 - -# Needed for string substitution -SHELL ["/bin/bash", "-c"] - -# essentials -# See http://bugs.python.org/issue19846 -ENV LANG C.UTF-8 -RUN apt-get update && apt-get install -y \ - build-essential \ - clang-format \ - curl \ - git \ - gnupg2 \ - libcurl3-dev \ - libfreetype6-dev \ - libhdf5-serial-dev \ - libzmq3-dev \ - openjdk-8-jdk \ - pkg-config \ - python3 \ - python3-dev \ - python3-pip \ - rsync \ - software-properties-common \ - swig \ - unzip \ - virtualenv \ - wget \ - zip \ - zlib1g-dev - -RUN python3 -m pip --no-cache-dir install --upgrade \ - "pip<20.3" \ - setuptools - -# Some TF tools expect a "python" binary -RUN ln -s $(which python3) /usr/local/bin/python - -RUN python3 -m pip --no-cache-dir install \ - Pillow \ - h5py \ - keras_preprocessing \ - tb-nightly \ - matplotlib \ - mock \ - 'numpy<1.19.0' \ - scipy \ - scikit-learn \ - pandas \ - future \ - portpicker \ - enum34 - - -# CUDA 11.8 - jetson - native - ubuntu 20.04 -RUN wget -q -O /tmp/cuda-keyring_1.0-1_all.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/arm64/cuda-keyring_1.0-1_all.deb && \ - dpkg -i /tmp/cuda-keyring_1.0-1_all.deb - -# l4t stuff -RUN echo "deb https://repo.download.nvidia.com/jetson/common r35.4 main" >> /etc/apt/sources.list && \ - echo "deb https://repo.download.nvidia.com/jetson/t194 r35.4 main" >> /etc/apt/sources.list && \ - apt-key adv --fetch-key http://repo.download.nvidia.com/jetson/jetson-ota-public.asc -RUN mkdir -p /opt/nvidia/l4t-packages/ && \ - touch /opt/nvidia/l4t-packages/.nv-l4t-disable-boot-fw-update-in-preinstall - -# install CUDA 11.8 for jetson and its dependencies (includes l4t stuff) -RUN apt-get update && \ - echo "N" | apt-get install -y cuda-${CUDA/./-} -RUN echo "export PATH=/usr/local/cuda-11.8/bin:$PATH" >> ~/.bashrc - -# libcudnn8 -# Download from https://developer.nvidia.com/compute/cudnn/secure/8.6.0/local_installers/11.8/cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_arm64.deb -COPY dockerfiles/arm64v8/cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_arm64.deb /cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_arm64.deb -RUN dpkg -i cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_arm64.deb && \ - cp /var/cudnn-local-repo-ubuntu2004-8.6.0.163/cudnn-local-04A93B30-keyring.gpg /usr/share/keyrings/ && \ - apt-get update && \ - apt-get install -y \ - libcudnn${CUDNN_MAJOR_VERSION}=${CUDNN}+cuda${CUDA} \ - libcudnn${CUDNN_MAJOR_VERSION}-dev=${CUDNN}+cuda${CUDA} - -# libnvinfer8 (TensorRT) -# Download from: https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.5.3/local_repos/nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_arm64.deb -COPY dockerfiles/arm64v8/nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_arm64.deb /nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_arm64.deb -RUN dpkg -i nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8_1.0-1_arm64.deb && \ - cp /var/nv-tensorrt-local-repo-ubuntu2004-8.5.3-cuda-11.8/nv-tensorrt-local-5C39D720-keyring.gpg /usr/share/keyrings/ && \ - apt-get update && \ - apt-get install -y \ - libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda${CUDA} \ - libnvinfer-dev=${LIBNVINFER}+cuda${CUDA} \ - libnvinfer-plugin-dev=${LIBNVINFER}+cuda${CUDA} \ - libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda${CUDA} - -# Configure the build for our CUDA configuration. -ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64 -ENV TF_NEED_CUDA 1 -ENV TF_NEED_TENSORRT 1 -ENV TF_CUDA_VERSION=${CUDA} -ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION} - -# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure -# dynamic linker run-time bindings -RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \ - && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ - && ldconfig - -# Installs bazelisk -RUN mkdir /bazel && \ - curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ - mkdir /bazelisk && \ - curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ - curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-arm64" && \ - chmod +x /usr/bin/bazel - -COPY bashrc /etc/bash.bashrc -RUN chmod a+rwx /etc/bash.bashrc \ No newline at end of file diff --git a/scripts/1-build-official-devel-image.sh b/scripts/1-build-official-devel-image.sh index 7ac82b9..17cd309 100755 --- a/scripts/1-build-official-devel-image.sh +++ b/scripts/1-build-official-devel-image.sh @@ -31,15 +31,11 @@ fi if [ "$ARCH" = "amd64" ]; then DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/devel${CPU_GPU_POSTFIX}.Dockerfile elif [ "$ARCH" = "arm64" ]; then - if [ "$TF_VERSION" = "2.13.0" ]; then - DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel${CPU_GPU_POSTFIX}-arm64v8.Dockerfile + DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile + if [ "$TF_VERSION" = "2.8.4" ]; then + sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r34.1.1-tf2.8-py3/" $DOCKERFILE else - DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile - if [ "$TF_VERSION" = "2.8.4" ]; then - sed -i $BSD_SED_ARG "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r34.1.1-tf2.8-py3/" $DOCKERFILE - else - sed -i $BSD_SED_ARG "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE - fi + sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE fi fi From e6457d0bb72e3020bc61eb7512979ab7d580f1ee Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Mon, 14 Aug 2023 14:38:16 +0200 Subject: [PATCH 20/38] remove arm64 2.13.0 versions from readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ead15cb..967913f 100644 --- a/README.md +++ b/README.md @@ -101,8 +101,8 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu | TensorFlow Version | CPU/GPU | Architecture | Image:Tag | | :---: | :---: | :---: | --- | -| 2.13.0 | GPU | amd64, arm64 | `rwthika/tensorflow-cc:latest-gpu` | -| 2.13.0 | CPU | amd64, arm64 | `rwthika/tensorflow-cc:latest` | +| 2.13.0 | GPU | amd64 | `rwthika/tensorflow-cc:latest-gpu` | +| 2.13.0 | CPU | amd64 | `rwthika/tensorflow-cc:latest` |
All TensorFlow Versions (GPU) From f4e97c7b57025283f9f5b5dcc95726698b7b2281 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Mon, 14 Aug 2023 15:10:09 +0200 Subject: [PATCH 21/38] fix building on arm macs after reverting changes --- scripts/1-build-official-devel-image.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/1-build-official-devel-image.sh b/scripts/1-build-official-devel-image.sh index 17cd309..7012e7b 100755 --- a/scripts/1-build-official-devel-image.sh +++ b/scripts/1-build-official-devel-image.sh @@ -33,9 +33,9 @@ if [ "$ARCH" = "amd64" ]; then elif [ "$ARCH" = "arm64" ]; then DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile if [ "$TF_VERSION" = "2.8.4" ]; then - sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r34.1.1-tf2.8-py3/" $DOCKERFILE + sed -i $BSD_SED_ARG "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r34.1.1-tf2.8-py3/" $DOCKERFILE else - sed -i "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE + sed -i $BSD_SED_ARG "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE fi fi From 52c5d6a9a80a7f799186d699b0b7d80639b2f2f2 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 15 Aug 2023 11:18:30 +0200 Subject: [PATCH 22/38] add patch to build 2.11.1 gpu --- docker/Dockerfile | 4 ++-- docker/patch/2.11.1/workspace2.bzl.patch | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 docker/patch/2.11.1/workspace2.bzl.patch diff --git a/docker/Dockerfile b/docker/Dockerfile index 6487c50..a10fc3a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -39,10 +39,10 @@ RUN if [ "${TF_VERSION}" = "2.10.0" ] || [ "${TF_VERSION}" = "2.10.1" ]; then \ git checkout FETCH_HEAD -- tensorflow/BUILD; \ fi -# fix GPU-version build issue in 2.12.0, 2.12.1, 2.13.0 +# fix GPU-version build issue in 2.11.1, 2.12.0, 2.12.1, 2.13.0 # https://github.com/tensorflow/tensorflow/issues/60398#issuecomment-1537040602 COPY patch/ patch/ -RUN if [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ +RUN if [ "${TF_VERSION}" = "2.11.1" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${TF_VERSION}" = "2.12.1" ] || [ "${TF_VERSION}" = "2.13.0" ]; then \ git apply patch/${TF_VERSION}/workspace2.bzl.patch; \ fi diff --git a/docker/patch/2.11.1/workspace2.bzl.patch b/docker/patch/2.11.1/workspace2.bzl.patch new file mode 100644 index 0000000..956eb74 --- /dev/null +++ b/docker/patch/2.11.1/workspace2.bzl.patch @@ -0,0 +1,17 @@ +diff --git a/tensorflow/workspace2.bzl b/tensorflow/workspace2.bzl +index 18274158..306f2431 100644 +--- a/tensorflow/workspace2.bzl ++++ b/tensorflow/workspace2.bzl +@@ -171,9 +171,9 @@ def _tf_repositories(): + name = "cudnn_frontend_archive", + build_file = "//third_party:cudnn_frontend.BUILD", + patch_file = ["//third_party:cudnn_frontend_header_fix.patch"], +- sha256 = "6ca6e7d4affdff59c749865d6d0428c849968b0873a1d1b849f56d7be624f27b", +- strip_prefix = "cudnn-frontend-0.7.1", +- urls = tf_mirror_urls("https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v0.7.1.zip"), ++ sha256 = "d8dba9e2607a0c256aa8eacb45b39986ab6f3f24a4d431d4397047a3cb0cd4fb", ++ strip_prefix = "cudnn-frontend-0.9", ++ urls = tf_mirror_urls("https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v0.9.zip"), + ) + + tf_http_archive( From e2296bd9db985f1f257eeb9d8b460ac1585fa148 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 15 Aug 2023 11:18:43 +0200 Subject: [PATCH 23/38] fix building without pip package --- docker/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a10fc3a..8a0df60 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -78,7 +78,6 @@ RUN if [ "${GPU_POSTFIX}" = "-gpu" ]; then \ # move libtensorflow_cc to separate folder for easier Dockerfile COPY RUN mkdir -p bazel-bin/tensorflow/lib && \ - mkdir -p bazel-bin/tensorflow/pip && \ mv bazel-bin/tensorflow/libtensorflow_cc.so* bazel-bin/tensorflow/lib/ && \ mv bazel-bin/tensorflow/libtensorflow_framework.so* bazel-bin/tensorflow/lib/ && \ ln -sf libtensorflow_framework.so.2 bazel-bin/tensorflow/lib/libtensorflow_framework.so && \ @@ -104,6 +103,9 @@ RUN if [ "${BUILD_PIP_PACKAGE}" = "1" ]; then \ fi; \ pip install patchelf && \ ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow/pip ; \ + else \ + mkdir -p /tmp/tensorflow/pip && \ + touch /tmp/tensorflow/pip/tensorflow-dummy.whl ; \ fi # build protobuf from source, same version as TensorFlow is using From 9b29b318b261639ebc90bb1c33358aedfcf2c575 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 15 Aug 2023 11:24:48 +0200 Subject: [PATCH 24/38] add arm64 cpu dockerfiles for 2.11.1+ --- docker/.Dockerfiles/.gitignore | 1 + docker/.Dockerfiles/2.11.1/bashrc | 53 ++++++ .../arm64v8/devel-cpu-arm64v8.Dockerfile | 109 +++++++++++++ .../2.11.1/dockerfiles/devel-cpu.Dockerfile | 107 ++++++++++++ .../2.11.1/dockerfiles/devel-gpu.Dockerfile | 152 ++++++++++++++++++ .../arm64v8/devel-cpu-arm64v8.Dockerfile | 110 +++++++++++++ .../arm64v8/devel-cpu-arm64v8.Dockerfile | 110 +++++++++++++ .../arm64v8/devel-cpu-arm64v8.Dockerfile | 110 +++++++++++++ 8 files changed, 752 insertions(+) create mode 100644 docker/.Dockerfiles/2.11.1/bashrc create mode 100644 docker/.Dockerfiles/2.11.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile create mode 100644 docker/.Dockerfiles/2.11.1/dockerfiles/devel-cpu.Dockerfile create mode 100644 docker/.Dockerfiles/2.11.1/dockerfiles/devel-gpu.Dockerfile create mode 100644 docker/.Dockerfiles/2.12.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile create mode 100644 docker/.Dockerfiles/2.12.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile create mode 100644 docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile diff --git a/docker/.Dockerfiles/.gitignore b/docker/.Dockerfiles/.gitignore index 2e5a32f..f6e6930 100644 --- a/docker/.Dockerfiles/.gitignore +++ b/docker/.Dockerfiles/.gitignore @@ -1,6 +1,7 @@ /* !.gitignore !/2.11.0/ +!/2.11.1/ !/2.12.0/ !/2.12.1/ !/2.13.0/ diff --git a/docker/.Dockerfiles/2.11.1/bashrc b/docker/.Dockerfiles/2.11.1/bashrc new file mode 100644 index 0000000..d9dd7a6 --- /dev/null +++ b/docker/.Dockerfiles/2.11.1/bashrc @@ -0,0 +1,53 @@ +# Copyright 2018 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============================================================================== + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return + +export PS1="\[\e[31m\]tf-docker\[\e[m\] \[\e[33m\]\w\[\e[m\] > " +export TERM=xterm-256color +alias grep="grep --color=auto" +alias ls="ls --color=auto" + +echo -e "\e[1;31m" +cat< /etc/apt/sources.list.d/tensorRT.list && \ + apt-get update && \ + apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.0 \ + libnvinfer-dev=${LIBNVINFER}+cuda11.0 \ + libnvinfer-plugin-dev=${LIBNVINFER}+cuda11.0 \ + libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.0 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/*; } + +# Configure the build for our CUDA configuration. +ENV LD_LIBRARY_PATH /usr/local/cuda-11.0/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.0/lib64:/usr/local/cuda-11.2/lib64 +ENV TF_NEED_CUDA 1 +ENV TF_NEED_TENSORRT 1 +ENV TF_CUDA_VERSION=${CUDA} +ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION} +# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version +ARG CACHE_STOP=1 +# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 +ARG CHECKOUT_TF_SRC=0 +RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow_src || true + +# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure +# dynamic linker run-time bindings +RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \ + && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ + && ldconfig + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + git \ + wget \ + openjdk-8-jdk \ + python3-dev \ + virtualenv \ + swig + +RUN python3 -m pip --no-cache-dir install \ + Pillow \ + h5py \ + tb-nightly \ + matplotlib \ + mock \ + 'numpy<1.19.0' \ + scipy \ + sklearn \ + pandas \ + future \ + portpicker \ + enum34 \ + 'protobuf < 4' + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc diff --git a/docker/.Dockerfiles/2.12.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.12.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile new file mode 100644 index 0000000..b85b5bf --- /dev/null +++ b/docker/.Dockerfiles/2.12.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -0,0 +1,110 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +# +# THIS IS A GENERATED DOCKERFILE. +# +# This file was assembled from multiple pieces, whose use is documented +# throughout. Please refer to the TensorFlow dockerfiles documentation +# for more information. + +ARG UBUNTU_VERSION=20.04 + +FROM ubuntu:${UBUNTU_VERSION} AS base + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + clang-format \ + curl \ + git \ + libcurl3-dev \ + libfreetype6-dev \ + libhdf5-serial-dev \ + libzmq3-dev \ + pkg-config \ + rsync \ + software-properties-common \ + sudo \ + unzip \ + zip \ + zlib1g-dev \ + openjdk-8-jdk \ + openjdk-8-jre-headless \ + && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ENV CI_BUILD_PYTHON python + +# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version +ARG CACHE_STOP=1 +# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 +ARG CHECKOUT_TF_SRC=0 +# In case of Python 2.7+ we need to add passwd entries for user and group id +RUN chmod a+w /etc/passwd /etc/group +RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow_src || true + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + git \ + openjdk-8-jdk \ + python3-dev \ + virtualenv \ + swig + +RUN apt-get update && apt-get install -y \ + gfortran \ + libblas-dev \ + liblapack-dev + +RUN python3 -m pip --no-cache-dir install \ + Pillow \ + keras_preprocessing \ + tb-nightly \ + h5py \ + matplotlib \ + mock \ + 'numpy<1.19.0' \ + scipy \ + sklearn \ + pandas \ + portpicker \ + enum34 + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-arm64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc diff --git a/docker/.Dockerfiles/2.12.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.12.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile new file mode 100644 index 0000000..b85b5bf --- /dev/null +++ b/docker/.Dockerfiles/2.12.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -0,0 +1,110 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +# +# THIS IS A GENERATED DOCKERFILE. +# +# This file was assembled from multiple pieces, whose use is documented +# throughout. Please refer to the TensorFlow dockerfiles documentation +# for more information. + +ARG UBUNTU_VERSION=20.04 + +FROM ubuntu:${UBUNTU_VERSION} AS base + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + clang-format \ + curl \ + git \ + libcurl3-dev \ + libfreetype6-dev \ + libhdf5-serial-dev \ + libzmq3-dev \ + pkg-config \ + rsync \ + software-properties-common \ + sudo \ + unzip \ + zip \ + zlib1g-dev \ + openjdk-8-jdk \ + openjdk-8-jre-headless \ + && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ENV CI_BUILD_PYTHON python + +# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version +ARG CACHE_STOP=1 +# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 +ARG CHECKOUT_TF_SRC=0 +# In case of Python 2.7+ we need to add passwd entries for user and group id +RUN chmod a+w /etc/passwd /etc/group +RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow_src || true + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + git \ + openjdk-8-jdk \ + python3-dev \ + virtualenv \ + swig + +RUN apt-get update && apt-get install -y \ + gfortran \ + libblas-dev \ + liblapack-dev + +RUN python3 -m pip --no-cache-dir install \ + Pillow \ + keras_preprocessing \ + tb-nightly \ + h5py \ + matplotlib \ + mock \ + 'numpy<1.19.0' \ + scipy \ + sklearn \ + pandas \ + portpicker \ + enum34 + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-arm64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile new file mode 100644 index 0000000..b85b5bf --- /dev/null +++ b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -0,0 +1,110 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +# +# THIS IS A GENERATED DOCKERFILE. +# +# This file was assembled from multiple pieces, whose use is documented +# throughout. Please refer to the TensorFlow dockerfiles documentation +# for more information. + +ARG UBUNTU_VERSION=20.04 + +FROM ubuntu:${UBUNTU_VERSION} AS base + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + clang-format \ + curl \ + git \ + libcurl3-dev \ + libfreetype6-dev \ + libhdf5-serial-dev \ + libzmq3-dev \ + pkg-config \ + rsync \ + software-properties-common \ + sudo \ + unzip \ + zip \ + zlib1g-dev \ + openjdk-8-jdk \ + openjdk-8-jre-headless \ + && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ENV CI_BUILD_PYTHON python + +# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version +ARG CACHE_STOP=1 +# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 +ARG CHECKOUT_TF_SRC=0 +# In case of Python 2.7+ we need to add passwd entries for user and group id +RUN chmod a+w /etc/passwd /etc/group +RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow_src || true + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + git \ + openjdk-8-jdk \ + python3-dev \ + virtualenv \ + swig + +RUN apt-get update && apt-get install -y \ + gfortran \ + libblas-dev \ + liblapack-dev + +RUN python3 -m pip --no-cache-dir install \ + Pillow \ + keras_preprocessing \ + tb-nightly \ + h5py \ + matplotlib \ + mock \ + 'numpy<1.19.0' \ + scipy \ + sklearn \ + pandas \ + portpicker \ + enum34 + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-arm64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc From 16d5839c3b412ac835913a2954fa2767fa85da0d Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 15 Aug 2023 11:26:08 +0200 Subject: [PATCH 25/38] adjust 2.11.1 devel gpu dockerfile to successful build --- README.md | 3 ++- docker/.Dockerfiles/2.11.1/dockerfiles/devel-gpu.Dockerfile | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 967913f..f776b51 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu | 2.13.0 | amd64 | `rwthika/tensorflow-cc:2.13.0-gpu` | | 2.12.1 | amd64 | - | | 2.12.0 | amd64 | `rwthika/tensorflow-cc:2.12.0-gpu` | +| 2.11.1 | amd64 | `rwthika/tensorflow-cc:2.11.0-gpu` | | 2.11.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.0-gpu` | | 2.10.1 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.1-gpu` | | 2.10.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.0-gpu` | @@ -252,7 +253,7 @@ make 5-print-versions | 2.13.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.12.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | missing image `tensorflow/tensorflow:2.12.1` | | 2.12.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | -| 2.11.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | - | - | missing image `nvidia/cuda:11.2.1-base-ubuntu20.04` | +| 2.11.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.11.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.11.0 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.10.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | diff --git a/docker/.Dockerfiles/2.11.1/dockerfiles/devel-gpu.Dockerfile b/docker/.Dockerfiles/2.11.1/dockerfiles/devel-gpu.Dockerfile index 370e2b0..b1208a0 100644 --- a/docker/.Dockerfiles/2.11.1/dockerfiles/devel-gpu.Dockerfile +++ b/docker/.Dockerfiles/2.11.1/dockerfiles/devel-gpu.Dockerfile @@ -23,7 +23,7 @@ ARG UBUNTU_VERSION=20.04 ARG ARCH= ARG CUDA=11.2 -FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}.1-base-ubuntu${UBUNTU_VERSION} as base +FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}.2-base-ubuntu${UBUNTU_VERSION} as base # ARCH and CUDA are specified again because the FROM directive resets ARGs # (but their default value is retained if set previously) ARG ARCH From ad0251a082c2a36727359931f4efede1d31c44ba Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Tue, 15 Aug 2023 12:46:24 +0200 Subject: [PATCH 26/38] modify 2.11.1+ devel gpu arm64 dockerfiles --- .../arm64v8/devel-cpu-arm64v8.Dockerfile | 7 ++++--- .../arm64v8/devel-cpu-arm64v8.Dockerfile | 7 ++++--- .../arm64v8/devel-cpu-arm64v8.Dockerfile | 7 ++++--- .../arm64v8/devel-cpu-arm64v8.Dockerfile | 7 ++++--- scripts/1-build-official-devel-image.sh | 21 ++++++++++++------- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/docker/.Dockerfiles/2.11.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.11.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile index 1fad14c..94f4cb9 100644 --- a/docker/.Dockerfiles/2.11.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.11.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -84,15 +84,16 @@ RUN apt-get update && apt-get install -y \ libblas-dev \ liblapack-dev -RUN python3 -m pip --no-cache-dir install \ +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip --no-cache-dir install \ Pillow \ tb-nightly \ h5py \ matplotlib \ mock \ - 'numpy<1.19.0' \ + numpy \ scipy \ - sklearn \ + scikit-learn \ pandas \ portpicker \ enum34 diff --git a/docker/.Dockerfiles/2.12.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.12.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile index b85b5bf..c8a1ec4 100644 --- a/docker/.Dockerfiles/2.12.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.12.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -84,16 +84,17 @@ RUN apt-get update && apt-get install -y \ libblas-dev \ liblapack-dev -RUN python3 -m pip --no-cache-dir install \ +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip --no-cache-dir install \ Pillow \ keras_preprocessing \ tb-nightly \ h5py \ matplotlib \ mock \ - 'numpy<1.19.0' \ + numpy \ scipy \ - sklearn \ + scikit-learn \ pandas \ portpicker \ enum34 diff --git a/docker/.Dockerfiles/2.12.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.12.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile index b85b5bf..c8a1ec4 100644 --- a/docker/.Dockerfiles/2.12.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.12.1/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -84,16 +84,17 @@ RUN apt-get update && apt-get install -y \ libblas-dev \ liblapack-dev -RUN python3 -m pip --no-cache-dir install \ +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip --no-cache-dir install \ Pillow \ keras_preprocessing \ tb-nightly \ h5py \ matplotlib \ mock \ - 'numpy<1.19.0' \ + numpy \ scipy \ - sklearn \ + scikit-learn \ pandas \ portpicker \ enum34 diff --git a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile index b85b5bf..c8a1ec4 100644 --- a/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.13.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -84,16 +84,17 @@ RUN apt-get update && apt-get install -y \ libblas-dev \ liblapack-dev -RUN python3 -m pip --no-cache-dir install \ +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip --no-cache-dir install \ Pillow \ keras_preprocessing \ tb-nightly \ h5py \ matplotlib \ mock \ - 'numpy<1.19.0' \ + numpy \ scipy \ - sklearn \ + scikit-learn \ pandas \ portpicker \ enum34 diff --git a/scripts/1-build-official-devel-image.sh b/scripts/1-build-official-devel-image.sh index 7012e7b..6fdab50 100755 --- a/scripts/1-build-official-devel-image.sh +++ b/scripts/1-build-official-devel-image.sh @@ -27,21 +27,26 @@ BSD_SED_ARG="" if [ "$(uname -s)" = "Darwin" ]; then BSD_SED_ARG=".bak" fi +TF_VERSION_MAJOR=$(echo "$TF_VERSION" | cut -d. -f1) +TF_VERSION_MINOR=$(echo "$TF_VERSION" | cut -d. -f2) +TF_VERSION_PATCH=$(echo "$TF_VERSION" | cut -d. -f3) if [ "$ARCH" = "amd64" ]; then DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/devel${CPU_GPU_POSTFIX}.Dockerfile elif [ "$ARCH" = "arm64" ]; then - DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile - if [ "$TF_VERSION" = "2.8.4" ]; then - sed -i $BSD_SED_ARG "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r34.1.1-tf2.8-py3/" $DOCKERFILE + if [[ "$TF_VERSION_MAJOR" -lt "2" || ( "$TF_VERSION_MAJOR" -eq "2" && "$TF_VERSION_MINOR" -le "10" ) ]]; then + DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile + if [ "$TF_VERSION" = "2.8.4" ]; then + sed -i $BSD_SED_ARG "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r34.1.1-tf2.8-py3/" $DOCKERFILE + else + sed -i $BSD_SED_ARG "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE + fi + # replace sklearn (deprecated) with scikit-learn https://pypi.org/project/sklearn/ + sed -i $BSD_SED_ARG "s/sklearn/scikit-learn/" $DOCKERFILE else - sed -i $BSD_SED_ARG "s/ubuntu:\${UBUNTU_VERSION}/nvcr.io\/nvidia\/l4t-tensorflow:r35.1.0-tf2.9-py3/" $DOCKERFILE + DOCKERFILE=${DOWNLOAD_DOCKERFILE_DIR}/dockerfiles/arm64v8/devel${CPU_GPU_POSTFIX}-arm64v8.Dockerfile fi fi -# replace sklearn (deprecated) with scikit-learn -# https://pypi.org/project/sklearn/ -sed -i $BSD_SED_ARG "s/sklearn/scikit-learn/" $DOCKERFILE - echo "Building ${IMAGE_DEVEL_ARCH} ... " docker build -t ${IMAGE_DEVEL_ARCH} -f ${DOCKERFILE} ${BUILD_DIR} | tee ${LOG_FILE} From 65638f40271db4cd2b1346045ee20a4b75768428 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Wed, 16 Aug 2023 14:40:59 +0200 Subject: [PATCH 27/38] fix missing wget dependency in some cases --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 8a0df60..ce0c017 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -110,7 +110,7 @@ RUN if [ "${BUILD_PIP_PACKAGE}" = "1" ]; then \ # build protobuf from source, same version as TensorFlow is using WORKDIR / -RUN apt-get install -y autoconf automake libtool curl make g++ unzip && \ +RUN apt-get install -y autoconf automake libtool curl make g++ unzip wget && \ PROTOBUF_URL=$(grep -Eho "https://github.com/protocolbuffers/protobuf/archive/.*\.(zip|tar.gz)" tensorflow/tensorflow/workspace*.bzl) && \ PROTOBUF_VERSION=$(echo $PROTOBUF_URL | grep -Eo "([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|[0-9a-f]{40})") && \ wget -q $PROTOBUF_URL -O protobuf.archive && \ From 8f94a281f9ab5c7e70a9543c4db490cbad2e7748 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Wed, 16 Aug 2023 14:41:13 +0200 Subject: [PATCH 28/38] build cpu arm64 final images on ubuntu instead of l4t --- docker/Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ce0c017..69932d2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -159,11 +159,16 @@ COPY --from=build /tmp/tensorflow/pip/tensorflow*.whl / FROM --platform=amd64 tensorflow/tensorflow:${TF_VERSION}${GPU_POSTFIX} as final-amd64 ARG TARGETARCH -FROM --platform=arm64 nvcr.io/nvidia/l4t-tensorflow:r35.1.0-tf2.9-py3 as final-arm64 +# FROM ubuntu +FROM --platform=arm64 ubuntu:focal as final-arm64 ARG TARGETARCH -FROM "final-${TARGETARCH}" as final +FROM --platform=arm64 nvcr.io/nvidia/l4t-tensorflow:r35.1.0-tf2.9-py3 as final-arm64-gpu +ARG TARGETARCH + +FROM "final-${TARGETARCH}${GPU_POSTFIX}" as final +ARG DEBIAN_FRONTEND=noninteractive ARG TF_VERSION ARG GPU_POSTFIX From 6ed7a4d3f80c60ca849b84b12f2b237ff1c13e32 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Wed, 16 Aug 2023 15:16:15 +0200 Subject: [PATCH 29/38] finalize readme information with arm64 cpu --- README.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f776b51..f9fed37 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu | TensorFlow Version | CPU/GPU | Architecture | Image:Tag | | :---: | :---: | :---: | --- | | 2.13.0 | GPU | amd64 | `rwthika/tensorflow-cc:latest-gpu` | -| 2.13.0 | CPU | amd64 | `rwthika/tensorflow-cc:latest` | +| 2.13.0 | CPU | amd64, arm64 | `rwthika/tensorflow-cc:latest` |
All TensorFlow Versions (GPU) @@ -111,7 +111,6 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu | :---: | :---: | --- | | latest | amd64 | `rwthika/tensorflow-cc:latest-gpu` | | 2.13.0 | amd64 | `rwthika/tensorflow-cc:2.13.0-gpu` | -| 2.12.1 | amd64 | - | | 2.12.0 | amd64 | `rwthika/tensorflow-cc:2.12.0-gpu` | | 2.11.1 | amd64 | `rwthika/tensorflow-cc:2.11.0-gpu` | | 2.11.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.0-gpu` | @@ -139,10 +138,10 @@ The amd64 images are based on the [official TensorFlow Docker images](https://hu | TensorFlow Version | Architecture | Image:Tag | | :---: | :---: | --- | -| latest | amd64 | `rwthika/tensorflow-cc:latest` | -| 2.13.0 | amd64 | `rwthika/tensorflow-cc:2.13.0` | -| 2.12.1 | amd64 | - | -| 2.12.0 | amd64 | `rwthika/tensorflow-cc:2.12.0` | +| latest | amd64, arm64 | `rwthika/tensorflow-cc:latest` | +| 2.13.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.13.0` | +| 2.12.1 | arm64 | `rwthika/tensorflow-cc:2.12.1` | +| 2.12.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.12.0` | | 2.11.1 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.1` | | 2.11.0 | amd64, arm64 | `rwthika/tensorflow-cc:2.11.0` | | 2.10.1 | amd64, arm64 | `rwthika/tensorflow-cc:2.10.1` | @@ -251,9 +250,13 @@ make 5-print-versions | Version | Architecture | Step 1 (CPU) | Step 2 (CPU) | Step 4 (CPU) | Step 1 (GPU) | Step 2 (GPU) | Step 4 (GPU) | Notes | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | --- | | 2.13.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | +| 2.13.0 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | - | linker error at the end of building `libtensorflow_cc.so`; CPU image without Python TensorFlow | | 2.12.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | missing image `tensorflow/tensorflow:2.12.1` | +| 2.12.1 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | - | linker error at the end of building `libtensorflow_cc.so`; CPU image without Python TensorFlow | | 2.12.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | +| 2.12.0 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | - | linker error at the end of building `libtensorflow_cc.so`; CPU image without Python TensorFlow | | 2.11.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | +| 2.11.1 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | - | linker error at the end of building `libtensorflow_cc.so`; CPU image without Python TensorFlow | | 2.11.0 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.11.0 | arm64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | 2.10.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | @@ -323,9 +326,13 @@ make 5-print-versions | TensorFlow | Architecture | Ubuntu | GCC | Bazel | Python | protobuf | CUDA | cuDNN | TensorRT | GPU Compute Capability | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | 2.13.0 | amd64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | 11.8.89 | 8.6.0 | 8.5.3 | 9.0, 8.9, 8.6, 8.0, 7.5, 7.0, 6.1, 6.0 | +| 2.13.0 | arm64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | - | - | - | - | | 2.12.1 | amd64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | 11.8.89 | 8.6.0 | 8.5.3 | 9.0, 8.9, 8.6, 8.0, 7.5, 7.0, 6.1, 6.0 | +| 2.12.1 | arm64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | - | - | - | - | | 2.12.0 | amd64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | 11.8.89 | 8.6.0 | 8.5.3 | 9.0, 8.9, 8.6, 8.0, 7.5, 7.0, 6.1, 6.0 | -| 2.11.1 | amd64 | 20.04 | 9.4.0 | 6.3.2 | 3.8.10 | 3.9.2 | - | - | - | - | +| 2.12.0 | arm64 | 20.04 | 9.4.0/11.4.0 | 6.3.2 | 3.8.10 | 3.21.9 | - | - | - | - | +| 2.11.1 | amd64 | 20.04 | 9.4.0 | 6.3.2 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.0, 6.1, 6.0 | +| 2.11.1 | arm64 | 20.04 | 9.4.0 | 6.3.2 | 3.8.10 | 3.9.2 | - | - | - | - | | 2.11.0 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | | 2.11.0 | arm64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.4.239 | 8.4.1 | 8.4.1 | 8.7, 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | | 2.10.1 | amd64 | 20.04 | 9.4.0 | 6.0.0 | 3.8.10 | 3.9.2 | 11.2.152 | 8.1.0 | 7.2.2 | 8.6, 8.0, 7.5, 7.2, 7.0, 6.1, 6.0, 5.3 | From 64cf26905dd9d249dcfa8c8ebceb801e82411bdd Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Thu, 17 Aug 2023 13:12:38 +0200 Subject: [PATCH 30/38] change base of devel-cpu-arm64v8 back to ubuntu --- .../2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile | 2 +- docker/DEBIAN/control | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile index 56b5014..1fad14c 100644 --- a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -21,7 +21,7 @@ ARG UBUNTU_VERSION=20.04 -FROM rwthika/cuda:11.8-cudnn-trt-ubuntu20-devel AS base +FROM ubuntu:${UBUNTU_VERSION} AS base ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ diff --git a/docker/DEBIAN/control b/docker/DEBIAN/control index 0b94a9e..dc8f226 100644 --- a/docker/DEBIAN/control +++ b/docker/DEBIAN/control @@ -2,4 +2,5 @@ Package: libtensorflow-cc Version: TF_VERSION Architecture: TARGETARCH Maintainer: Lennart Reiher +Uploaders: Lennart Reiher , Jean-Pierre Busch Description: TensorFlow C++ Library From 9476e7dcc6eec12aa1f15bf1a86ddb8ed75ccb26 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Thu, 17 Aug 2023 13:13:27 +0200 Subject: [PATCH 31/38] temporary push full devel-gpu-arm64v8.Dockerfile --- .../arm64v8/devel-gpu-arm64v8.Dockerfile | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile diff --git a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile new file mode 100644 index 0000000..82d6f83 --- /dev/null +++ b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile @@ -0,0 +1,86 @@ +ARG UBUNTU_VERSION=20.04 + +FROM rwthika/cuda:11.8-cudnn-trt-ubuntu20.04-devel as base +ENV DEBIAN_FRONTEND=noninteractive + +ARG CUDA=11.8 +ARG CUDNN=8.6.0.163-1 +ARG CUDNN_MAJOR_VERSION=8 +ARG LIBNVINFER=8.5.3-1 +ARG LIBNVINFER_MAJOR_VERSION=8 + +# Needed for string substitution +SHELL ["/bin/bash", "-c"] + +# essentials +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 +RUN apt-get update && apt-get install -y \ + build-essential \ + clang-format \ + curl \ + git \ + gnupg2 \ + libcurl3-dev \ + libfreetype6-dev \ + libhdf5-serial-dev \ + libzmq3-dev \ + openjdk-8-jdk \ + pkg-config \ + python3 \ + python3-dev \ + python3-pip \ + rsync \ + software-properties-common \ + swig \ + unzip \ + virtualenv \ + wget \ + zip \ + zlib1g-dev + +RUN python3 -m pip --no-cache-dir install --upgrade \ + "pip<20.3" \ + setuptools==49.6.0 + +# Some TF tools expect a "python" binary +RUN ln -s $(which python3) /usr/local/bin/python + +RUN python3 -m pip --no-cache-dir install \ + Pillow \ + h5py \ + keras_preprocessing \ + tb-nightly \ + matplotlib \ + mock \ + 'numpy<1.19.0' \ + scipy \ + scikit-learn \ + pandas \ + future \ + portpicker \ + enum34 + +# Configure the build for our CUDA configuration. +ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/aarch64-linux/lib:/usr/local/cuda/lib64:/usr/include/aarch64-linux-gnu:/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64 +ENV TF_NEED_CUDA 1 +ENV TF_NEED_TENSORRT 1 +ENV TF_CUDA_VERSION=${CUDA} +ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION} + +# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure +# dynamic linker run-time bindings +RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \ + && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ + && ldconfig + +# Installs bazelisk +RUN mkdir /bazel && \ + curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ + mkdir /bazelisk && \ + curl -fSsL -o /bazelisk/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazelisk/master/LICENSE" && \ + curl -fSsL -o /usr/bin/bazel "https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-arm64" && \ + chmod +x /usr/bin/bazel + +COPY bashrc /etc/bash.bashrc +RUN chmod a+rwx /etc/bash.bashrc \ No newline at end of file From 162d599014d94eaca91d721d0bae1ab6b4c90ee3 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Thu, 17 Aug 2023 13:15:37 +0200 Subject: [PATCH 32/38] replace devel-gpu-arm64v8.Dockerfile with cpu content --- .../arm64v8/devel-gpu-arm64v8.Dockerfile | 109 +++++++++++------- 1 file changed, 66 insertions(+), 43 deletions(-) diff --git a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile index 82d6f83..1fad14c 100644 --- a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile @@ -1,79 +1,102 @@ -ARG UBUNTU_VERSION=20.04 - -FROM rwthika/cuda:11.8-cudnn-trt-ubuntu20.04-devel as base -ENV DEBIAN_FRONTEND=noninteractive +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +# +# THIS IS A GENERATED DOCKERFILE. +# +# This file was assembled from multiple pieces, whose use is documented +# throughout. Please refer to the TensorFlow dockerfiles documentation +# for more information. -ARG CUDA=11.8 -ARG CUDNN=8.6.0.163-1 -ARG CUDNN_MAJOR_VERSION=8 -ARG LIBNVINFER=8.5.3-1 -ARG LIBNVINFER_MAJOR_VERSION=8 +ARG UBUNTU_VERSION=20.04 -# Needed for string substitution -SHELL ["/bin/bash", "-c"] +FROM ubuntu:${UBUNTU_VERSION} AS base -# essentials -# See http://bugs.python.org/issue19846 -ENV LANG C.UTF-8 -RUN apt-get update && apt-get install -y \ +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ clang-format \ curl \ git \ - gnupg2 \ libcurl3-dev \ libfreetype6-dev \ libhdf5-serial-dev \ libzmq3-dev \ - openjdk-8-jdk \ pkg-config \ - python3 \ - python3-dev \ - python3-pip \ rsync \ software-properties-common \ - swig \ + sudo \ unzip \ - virtualenv \ - wget \ zip \ - zlib1g-dev + zlib1g-dev \ + openjdk-8-jdk \ + openjdk-8-jre-headless \ + && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ENV CI_BUILD_PYTHON python + +# CACHE_STOP is used to rerun future commands, otherwise cloning tensorflow will be cached and will not pull the most recent version +ARG CACHE_STOP=1 +# Check out TensorFlow source code if --build-arg CHECKOUT_TF_SRC=1 +ARG CHECKOUT_TF_SRC=0 +# In case of Python 2.7+ we need to add passwd entries for user and group id +RUN chmod a+w /etc/passwd /etc/group +RUN test "${CHECKOUT_TF_SRC}" -eq 1 && git clone --depth=1 https://github.com/tensorflow/tensorflow.git /tensorflow_src || true + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip RUN python3 -m pip --no-cache-dir install --upgrade \ "pip<20.3" \ - setuptools==49.6.0 + setuptools # Some TF tools expect a "python" binary RUN ln -s $(which python3) /usr/local/bin/python +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + git \ + openjdk-8-jdk \ + python3-dev \ + virtualenv \ + swig + +RUN apt-get update && apt-get install -y \ + gfortran \ + libblas-dev \ + liblapack-dev + RUN python3 -m pip --no-cache-dir install \ Pillow \ - h5py \ - keras_preprocessing \ tb-nightly \ + h5py \ matplotlib \ mock \ 'numpy<1.19.0' \ scipy \ - scikit-learn \ + sklearn \ pandas \ - future \ portpicker \ enum34 -# Configure the build for our CUDA configuration. -ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/aarch64-linux/lib:/usr/local/cuda/lib64:/usr/include/aarch64-linux-gnu:/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64 -ENV TF_NEED_CUDA 1 -ENV TF_NEED_TENSORRT 1 -ENV TF_CUDA_VERSION=${CUDA} -ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION} - -# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure -# dynamic linker run-time bindings -RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \ - && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ - && ldconfig - # Installs bazelisk RUN mkdir /bazel && \ curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ @@ -83,4 +106,4 @@ RUN mkdir /bazel && \ chmod +x /usr/bin/bazel COPY bashrc /etc/bash.bashrc -RUN chmod a+rwx /etc/bash.bashrc \ No newline at end of file +RUN chmod a+rwx /etc/bash.bashrc From 4e16b4765b299e5d337299021a20ec61c3b8be61 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Thu, 17 Aug 2023 13:17:55 +0200 Subject: [PATCH 33/38] add only relevant gpu content to devel-gpu-arm64v8.Dockerfile --- .../arm64v8/devel-gpu-arm64v8.Dockerfile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile index 1fad14c..aabd906 100644 --- a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile @@ -21,8 +21,7 @@ ARG UBUNTU_VERSION=20.04 -FROM ubuntu:${UBUNTU_VERSION} AS base - +FROM rwthika/cuda:11.8-cudnn-trt-ubuntu${UBUNTU_VERSION}-devel as base ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ @@ -97,6 +96,19 @@ RUN python3 -m pip --no-cache-dir install \ portpicker \ enum34 +# Configure the build for our CUDA configuration. +ENV LD_LIBRARY_PATH /usr/local/cuda-11.8/targets/aarch64-linux/lib:/usr/local/cuda/lib64:/usr/include/aarch64-linux-gnu:/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs:/usr/local/cuda-11.8/lib64 +ENV TF_NEED_CUDA 1 +ENV TF_NEED_TENSORRT 1 +ENV TF_CUDA_VERSION=${CUDA} +ENV TF_CUDNN_VERSION=${CUDNN_MAJOR_VERSION} + +# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure +# dynamic linker run-time bindings +RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 \ + && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ + && ldconfig + # Installs bazelisk RUN mkdir /bazel && \ curl -fSsL -o /bazel/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" && \ From bf5e9fd99be92249632b08db8431c0c1d444fea7 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Thu, 17 Aug 2023 14:05:30 +0200 Subject: [PATCH 34/38] set configuration for tensorrt explicitly in Dockerimage --- docker/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 69932d2..fea213c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -47,10 +47,12 @@ RUN if [ "${TF_VERSION}" = "2.11.1" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${ fi # configure compilation -ARG TF_CUDA_COMPUTE_CAPABILITIES=6.0,6.1,7.0,7.5,8.0,8.6,8.9,9.0 ENV PYTHON_BIN_PATH=/usr/bin/python3 ENV PYTHON_LIB_PATH=/usr/lib/python3/dist-packages ENV TF_NEED_ROCM=0 +ENV TF_NEED_CUDA=1 +ENV TF_NEED_TENSORRT=1 +ARG TF_CUDA_COMPUTE_CAPABILITIES=6.0,6.1,7.0,7.5,8.0,8.6,8.9,9.0 ENV TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES} ENV TF_CUDA_CLANG=0 ENV GCC_HOST_COMPILER_PATH=/usr/bin/gcc From ad95915ed310c5155999223be3c53fc17903fd0a Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Thu, 17 Aug 2023 14:05:51 +0200 Subject: [PATCH 35/38] replace sklearn in pushed dockerfiles --- .../2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile | 2 +- docker/.Dockerfiles/2.11.1/dockerfiles/devel-cpu.Dockerfile | 2 +- docker/.Dockerfiles/2.11.1/dockerfiles/devel-gpu.Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile index 1fad14c..30ca909 100644 --- a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -92,7 +92,7 @@ RUN python3 -m pip --no-cache-dir install \ mock \ 'numpy<1.19.0' \ scipy \ - sklearn \ + scikit-learn \ pandas \ portpicker \ enum34 diff --git a/docker/.Dockerfiles/2.11.1/dockerfiles/devel-cpu.Dockerfile b/docker/.Dockerfiles/2.11.1/dockerfiles/devel-cpu.Dockerfile index fe596ac..a6217f5 100644 --- a/docker/.Dockerfiles/2.11.1/dockerfiles/devel-cpu.Dockerfile +++ b/docker/.Dockerfiles/2.11.1/dockerfiles/devel-cpu.Dockerfile @@ -88,7 +88,7 @@ RUN python3 -m pip --no-cache-dir install \ mock \ 'numpy<1.19.0' \ scipy \ - sklearn \ + scikit-learn \ pandas \ future \ portpicker \ diff --git a/docker/.Dockerfiles/2.11.1/dockerfiles/devel-gpu.Dockerfile b/docker/.Dockerfiles/2.11.1/dockerfiles/devel-gpu.Dockerfile index b1208a0..51cc80d 100644 --- a/docker/.Dockerfiles/2.11.1/dockerfiles/devel-gpu.Dockerfile +++ b/docker/.Dockerfiles/2.11.1/dockerfiles/devel-gpu.Dockerfile @@ -133,7 +133,7 @@ RUN python3 -m pip --no-cache-dir install \ mock \ 'numpy<1.19.0' \ scipy \ - sklearn \ + scikit-learn \ pandas \ future \ portpicker \ From dab2596ec77d24045cb04f6bcc63028747a6f2fd Mon Sep 17 00:00:00 2001 From: Jean-Pierre Busch Date: Thu, 17 Aug 2023 14:07:06 +0200 Subject: [PATCH 36/38] replace sklearn in pushed dockerfiles --- .../2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile index aabd906..965c9c5 100644 --- a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile @@ -91,7 +91,7 @@ RUN python3 -m pip --no-cache-dir install \ mock \ 'numpy<1.19.0' \ scipy \ - sklearn \ + scikit-learn \ pandas \ portpicker \ enum34 From 1b4b4db5edb71122ce9ff8544eb0a8295d594bc6 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 17 Aug 2023 22:31:26 +0200 Subject: [PATCH 37/38] upgrading pip in 2.11.0 arm devel dockerfiles (according to 2.12 and 2.13) --- .../2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile | 5 +++-- .../2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile index 30ca909..94f4cb9 100644 --- a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-cpu-arm64v8.Dockerfile @@ -84,13 +84,14 @@ RUN apt-get update && apt-get install -y \ libblas-dev \ liblapack-dev -RUN python3 -m pip --no-cache-dir install \ +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip --no-cache-dir install \ Pillow \ tb-nightly \ h5py \ matplotlib \ mock \ - 'numpy<1.19.0' \ + numpy \ scipy \ scikit-learn \ pandas \ diff --git a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile index 965c9c5..a8113a0 100644 --- a/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile +++ b/docker/.Dockerfiles/2.11.0/dockerfiles/arm64v8/devel-gpu-arm64v8.Dockerfile @@ -83,13 +83,14 @@ RUN apt-get update && apt-get install -y \ libblas-dev \ liblapack-dev -RUN python3 -m pip --no-cache-dir install \ +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip --no-cache-dir install \ Pillow \ tb-nightly \ h5py \ matplotlib \ mock \ - 'numpy<1.19.0' \ + numpy \ scipy \ scikit-learn \ pandas \ From f614bee0e87a98e7b9df542da82ec3302ac49907 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 17 Aug 2023 22:38:45 +0200 Subject: [PATCH 38/38] remove env for tensorrt and cuda build from Dockerfile to also allow cpu build configuration --- docker/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index fea213c..e8837ac 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -50,8 +50,6 @@ RUN if [ "${TF_VERSION}" = "2.11.1" ] || [ "${TF_VERSION}" = "2.12.0" ] || [ "${ ENV PYTHON_BIN_PATH=/usr/bin/python3 ENV PYTHON_LIB_PATH=/usr/lib/python3/dist-packages ENV TF_NEED_ROCM=0 -ENV TF_NEED_CUDA=1 -ENV TF_NEED_TENSORRT=1 ARG TF_CUDA_COMPUTE_CAPABILITIES=6.0,6.1,7.0,7.5,8.0,8.6,8.9,9.0 ENV TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES} ENV TF_CUDA_CLANG=0