Skip to content

Commit

Permalink
Merge pull request #6 from ika-rwth-aachen/versions-beyond-2p11
Browse files Browse the repository at this point in the history
Support v2.13.0, v2.12.1, v2.12.0, v2.11.1 on amd64
  • Loading branch information
jpbusch authored Aug 18, 2023
2 parents 41665bb + f614bee commit 09ccb01
Show file tree
Hide file tree
Showing 39 changed files with 2,718 additions and 47 deletions.
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/$@.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
Expand Down
41 changes: 32 additions & 9 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, arm64 | `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.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` |
Expand All @@ -136,6 +139,10 @@ 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` |
| 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` |
| 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,14 @@ 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: | |
Expand Down Expand Up @@ -310,6 +325,14 @@ 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.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 |
Expand Down
7 changes: 7 additions & 0 deletions docker/.Dockerfiles/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
!.gitignore
!/2.11.0/
!/2.11.1/
!/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,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 install --upgrade pip && \
python3 -m pip --no-cache-dir install \
Pillow \
tb-nightly \
h5py \
matplotlib \
mock \
numpy \
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
Loading

0 comments on commit 09ccb01

Please sign in to comment.