Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support v2.13.0, v2.12.1, v2.12.0, v2.11.1 on amd64 #6

Merged
merged 38 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
eaf9f95
try to build 2.12
lreiher Jun 15, 2023
131acd4
explicitly add devel dockerfile for 2.13.0
lreiher Aug 8, 2023
ba6dfa8
modify 2.13.0 devel dockerfile to run ubuntu22, cuda12.1
lreiher Aug 8, 2023
088f89b
successfully build 2.13.0
lreiher Aug 8, 2023
38d78a3
explicitly add cpu devel dockerfile for 2.13.0
lreiher Aug 8, 2023
431d530
update supported compute capabilities
lreiher Aug 8, 2023
6706599
add arm64 dockerimage for TF2.13.0
jpbusch Aug 8, 2023
8317316
add devel dockerfile for 2.13.0 with cuda 11.8
lreiher Aug 8, 2023
70c9ee1
install gcc11 in final image in order to build tf2.13 apps
lreiher Aug 8, 2023
c63fdae
update readme to 2.13.0
lreiher Aug 8, 2023
8b233d7
successfully build 2.12.0, 2.12.1
lreiher Aug 9, 2023
191f39d
update readme with 2.12.0, 2.12.1
lreiher Aug 9, 2023
7dbd2ed
successfully build 2.11.1
lreiher Aug 9, 2023
88672f2
add option to build and export pip package
lreiher Aug 9, 2023
d355248
update sklearn in 2.13.0 devel dockerfile
lreiher Aug 10, 2023
022adfa
generate own arm64 gpu devel Dockerfile
jpbusch Aug 10, 2023
902a90d
update default compute capabilities in other script
lreiher Aug 14, 2023
4c4dc1e
enable building on arm macs
lreiher Aug 14, 2023
cb6b4a4
revert changes for non-working 2.13.0 on arm64 and store special 2.11…
lreiher Aug 14, 2023
e6457d0
remove arm64 2.13.0 versions from readme
lreiher Aug 14, 2023
f4e97c7
fix building on arm macs after reverting changes
lreiher Aug 14, 2023
52c5d6a
add patch to build 2.11.1 gpu
lreiher Aug 15, 2023
e2296bd
fix building without pip package
lreiher Aug 15, 2023
9b29b31
add arm64 cpu dockerfiles for 2.11.1+
lreiher Aug 15, 2023
16d5839
adjust 2.11.1 devel gpu dockerfile to successful build
lreiher Aug 15, 2023
ad0251a
modify 2.11.1+ devel gpu arm64 dockerfiles
lreiher Aug 15, 2023
65638f4
fix missing wget dependency in some cases
lreiher Aug 16, 2023
8f94a28
build cpu arm64 final images on ubuntu instead of l4t
lreiher Aug 16, 2023
6ed7a4d
finalize readme information with arm64 cpu
lreiher Aug 16, 2023
64cf269
change base of devel-cpu-arm64v8 back to ubuntu
jpbusch Aug 17, 2023
9476e7d
temporary push full devel-gpu-arm64v8.Dockerfile
jpbusch Aug 17, 2023
162d599
replace devel-gpu-arm64v8.Dockerfile with cpu content
jpbusch Aug 17, 2023
4e16b47
add only relevant gpu content to devel-gpu-arm64v8.Dockerfile
jpbusch Aug 17, 2023
bf5e9fd
set configuration for tensorrt explicitly in Dockerimage
jpbusch Aug 17, 2023
ad95915
replace sklearn in pushed dockerfiles
jpbusch Aug 17, 2023
dab2596
replace sklearn in pushed dockerfiles
jpbusch Aug 17, 2023
1b4b4db
upgrading pip in 2.11.0 arm devel dockerfiles (according to 2.12 and …
lreiher Aug 17, 2023
f614bee
remove env for tensorrt and cuda build from Dockerfile to also allow …
lreiher Aug 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,27 @@ 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.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_JOBS := $(shell nproc)
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 2> /dev/null || sysctl -n hw.ncpu)
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
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)
Expand Down Expand Up @@ -118,15 +120,15 @@ clean-images: clean-official-devel-images clean-cpp-images clean-libtensorflow-c
$(MAKEFILE_DIR)/scripts/[email protected]

.PHONY: 1-build-official-devel-image
1-build-official-devel-image: 0-download-official-dockerfiles
1-build-official-devel-image:
$(MAKEFILE_DIR)/scripts/[email protected]

.PHONY: 2-build-cpp-image
2-build-cpp-image: 1-build-official-devel-image
2-build-cpp-image:
$(MAKEFILE_DIR)/scripts/[email protected]

.PHONY: 3-export-libtensorflow-cc
3-export-libtensorflow-cc: 2-build-cpp-image
lreiher marked this conversation as resolved.
Show resolved Hide resolved
3-export-libtensorflow-cc:
$(MAKEFILE_DIR)/scripts/[email protected]

.PHONY: 4-test-libtensorflow-cc
Expand Down
35 changes: 25 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```

Expand All @@ -101,15 +101,18 @@ 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 | `rwthika/tensorflow-cc:latest-gpu` |
| 2.13.0 | CPU | amd64 | `rwthika/tensorflow-cc:latest` |

<details>
<summary><i>All TensorFlow Versions (GPU)</i></summary>

| 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.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` |
Expand All @@ -135,7 +138,11 @@ 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.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` |
Expand Down Expand Up @@ -178,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.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. 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 `<target>-all`, which can be used to build multiple TensorFlow versions one after the other using the `TF_VERSIONS` flag like so:

Expand Down Expand Up @@ -242,6 +249,10 @@ 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.1 | amd64 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | - | - | missing image `nvidia/cuda:11.2.1-base-ubuntu20.04` |
lreiher marked this conversation as resolved.
Show resolved Hide resolved
| 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: | |
Expand Down Expand Up @@ -310,6 +321,10 @@ 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.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 |
Expand Down
6 changes: 6 additions & 0 deletions docker/.Dockerfiles/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
!.gitignore
!/2.11.0/
!/2.12.0/
!/2.12.1/
!/2.13.0/
53 changes: 53 additions & 0 deletions docker/.Dockerfiles/2.11.0/bashrc
Original file line number Diff line number Diff line change
@@ -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<<TF
________ _______________
___ __/__________________________________ ____/__ /________ __
__ / _ _ \_ __ \_ ___/ __ \_ ___/_ /_ __ /_ __ \_ | /| / /
_ / / __/ / / /(__ )/ /_/ / / _ __/ _ / / /_/ /_ |/ |/ /
/_/ \___//_/ /_//____/ \____//_/ /_/ /_/ \____/____/|__/

TF
echo -e "\e[0;33m"

if [[ $EUID -eq 0 ]]; then
cat <<WARN
WARNING: You are running this container as root, which can cause new files in
mounted volumes to be created as the root user on your host machine.

To avoid this, run the container by specifying your user's userid:

$ docker run -u \$(id -u):\$(id -g) args...
WARN
else
cat <<EXPL
You are running this container as user with ID $(id -u) and group $(id -g),
which should map to the ID and group for your user on the Docker host. Great!
EXPL
fi

# Turn off colors
echo -e "\e[m"
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# 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 rwthika/cuda:11.8-cudnn-trt-ubuntu20-devel 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 \
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
Loading