Skip to content

Commit 6e48036

Browse files
committed
Merge remote-tracking branch 'origin/master' into system-protobuf
2 parents 7e178bd + c5ae816 commit 6e48036

8 files changed

Lines changed: 38 additions & 33 deletions

Dockerfiles/BAZEL_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.2
1+
4.2.1

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# tensorflow_cc
22
[![Build Status](http://oak.floop.cz:8080/buildStatus/icon?job=tensorflow_cc)](http://oak.floop.cz:8080/job/tensorflow_cc/)
3-
[![TF version](https://img.shields.io/badge/TF%20version-2.5.0-brightgreen.svg)]()
3+
[![TF version](https://img.shields.io/badge/TF%20version-2.8.0-brightgreen.svg)]()
44

55
This repository makes possible the usage of the [TensorFlow C++](https://www.tensorflow.org/api_docs/cc/) API from the outside of the TensorFlow source code folders and without the use of the [Bazel](https://bazel.build/) build system.
66

@@ -17,7 +17,7 @@ docker run -it floopcz/tensorflow_cc:ubuntu /bin/bash
1717

1818
If you also want to utilize your NVIDIA GPU, install [NVIDIA Docker](https://github.com/NVIDIA/nvidia-docker) and run:
1919
```bash
20-
docker run --runtime=nvidia -it floopcz/tensorflow_cc:ubuntu-cuda /bin/bash
20+
docker run --gpus all -it floopcz/tensorflow_cc:ubuntu-cuda /bin/bash
2121
```
2222

2323
The list of available images:

build-all-dockerfiles.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,32 @@
33
# Parse command line arguments.
44
prune=false
55
push=false
6-
for key in "$@"; do
6+
cpu_shares=0
7+
cpu_quota=-1
8+
while [[ $# -gt 0 ]]; do
9+
key="$1"
710
case $key in
811
--prune)
912
prune=true
13+
shift
1014
;;
1115
--push)
1216
push=true
17+
shift
18+
;;
19+
--cpu-shares)
20+
cpu_shares="$2"
21+
shift
22+
shift
23+
;;
24+
--cpu-quota)
25+
cpu_quota="$2"
26+
shift
27+
shift
28+
;;
29+
*)
30+
echo "Unknown option $key"
31+
exit 1
1332
;;
1433
esac
1534
done
@@ -18,7 +37,7 @@ done
1837
PROJECT_VERSION="$(cat ./tensorflow_cc/PROJECT_VERSION)"
1938

2039
for tag in ubuntu ubuntu-cuda archlinux archlinux-cuda; do
21-
docker build --pull -t floopcz/tensorflow_cc:${tag} -f Dockerfiles/${tag} .
40+
docker build --cpu-shares="${cpu_shares}" --cpu-quota="${cpu_quota}" --pull -t floopcz/tensorflow_cc:${tag} -f Dockerfiles/${tag} .
2241
docker tag floopcz/tensorflow_cc:${tag} floopcz/tensorflow_cc:${tag}-"${PROJECT_VERSION}"
2342
if $push; then
2443
docker push floopcz/tensorflow_cc:${tag}

tensorflow_cc/PROJECT_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.5.0
1+
2.8.0

tensorflow_cc/cmake/TensorflowBase.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,4 @@ ExternalProject_Add(
1919
COMMAND mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/tensorflow/bazel-bin/bin/tensorflow/include/src"
2020
COMMAND touch "${CMAKE_CURRENT_BINARY_DIR}/tensorflow/bazel-bin/tensorflow/include/src/__placeholder__.h"
2121
COMMAND touch "${CMAKE_CURRENT_BINARY_DIR}/tensorflow/bazel-bin/bin/tensorflow/include/src/__placeholder__.h"
22-
# Fix compilation with CUDA 11.3.
23-
PATCH_COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/patches/v2.5.0-Fix-NCCL-build-failure-with-CUDA-11.3.patch" .
24-
COMMAND patch -p1 < v2.5.0-Fix-NCCL-build-failure-with-CUDA-11.3.patch
2522
)

tensorflow_cc/cmake/build_tensorflow.sh.in

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,21 @@ if [ "$cuda_allowed" == true ] && [ "$cuda_available" == true ]; then
5353
echo "CUDA support enabled"
5454
cuda_config_opts="--config=cuda"
5555
export TF_NEED_CUDA=1
56-
export TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES:-"3.5,7.0"} # default from configure.py
56+
# Capabilities are taken from Archlinux tensorflow build.
57+
# https://github.com/tensorflow/tensorflow/blob/1ba2eb7b313c0c5001ee1683a3ec4fbae01105fd/third_party/gpus/cuda_configure.bzl#L411-L446
58+
# according to the above, we should be specifying CUDA compute capabilities as 'sm_XX' or 'compute_XX' from now on
59+
# add latest PTX for future compatibility
60+
export TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES:-"sm_52,sm_53,sm_60,sm_61,sm_62,sm_70,sm_72,sm_75,sm_80,sm_86,compute_86"}
5761
export TF_CUDA_PATHS=${TF_CUDA_PATHS:-"/opt/cuda,/usr/local/cuda,/usr/local,/usr/cuda,/usr"}
5862
export TF_CUDA_VERSION="$(nvcc --version | sed -n 's/^.*release \(.*\),.*/\1/p')"
5963
export TF_NCCL_VERSION="$(find /opt /usr -name 'libnccl.so.*' -path '*/cuda*' | tail -n1 | sed -r 's/^.*\.so\.//')"
6064
export TF_CUDNN_VERSION="$(find /opt /usr -name 'libcudnn.so.*' -path '*/cuda*' | tail -n1 | sed -r 's/^.*\.so\.//')"
6165

6266
# choose the right version of CUDA compiler
6367
if [ -z "$GCC_HOST_COMPILER_PATH" ]; then
64-
if hash gcc-10 2>/dev/null && version_gt 10.3 `gcc-10 -dumpversion`; then
68+
if hash gcc-11 2>/dev/null && version_gt 11.1 `gcc-11 -dumpversion`; then
69+
export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:-"/usr/bin/gcc-11"}
70+
elif hash gcc-10 2>/dev/null && version_gt 10.3 `gcc-10 -dumpversion`; then
6571
export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:-"/usr/bin/gcc-10"}
6672
elif hash gcc-9 2>/dev/null && version_gt 9.4 `gcc-9 -dumpversion`; then
6773
export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:-"/usr/bin/gcc-9"}
@@ -76,12 +82,7 @@ if [ "$cuda_allowed" == true ] && [ "$cuda_available" == true ]; then
7682
elif hash gcc-4 2>/dev/null && version_gt 4.9 `gcc-4 -dumpversion`; then
7783
export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:-"/usr/bin/gcc-4"}
7884
else
79-
echo "No supported CUDA compiler available. If you are sure your compiler"
80-
echo "version is supported by your CUDA version, please run e.g.:"
81-
echo "export GCC_HOST_COMPILER_PATH=/usr/bin/gcc"
82-
echo "before the build. For the list of supported compilers refer to:"
83-
echo "https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html"
84-
exit 1
85+
export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:-"/usr/bin/gcc"}
8586
fi
8687
fi
8788

tensorflow_cc/patches/v2.5.0-Fix-NCCL-build-failure-with-CUDA-11.3.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.

ubuntu-requirements.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if [[ "$OSTYPE" == "linux-gnu" ]]; then
1313
apt-get -y update
1414
apt-get -y install \
1515
cmake \
16-
g++-7 \
16+
g++-9 \
1717
git \
1818
python3-dev \
1919
python3-numpy \
@@ -22,7 +22,8 @@ if [[ "$OSTYPE" == "linux-gnu" ]]; then
2222

2323
# install bazel
2424
export BAZEL_VERSION=${BAZEL_VERSION:-`cat $(dirname "$0")/Dockerfiles/BAZEL_VERSION`}
25-
apt-get -y install pkg-config zip g++ zlib1g-dev unzip python
25+
apt-get -y install pkg-config zip g++ zlib1g-dev unzip python3
26+
update-alternatives --install /usr/bin/python python /usr/bin/python3 1
2627
bazel_installer=bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
2728
wget -P /tmp https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/${bazel_installer}
2829
chmod +x /tmp/${bazel_installer}
@@ -33,4 +34,4 @@ else
3334
echo "This script supports only Debian-based operating systems (like Ubuntu)." \
3435
"Please consult README file for manual installation on your '$OSTYPE' OS."
3536
exit 1
36-
fi
37+
fi

0 commit comments

Comments
 (0)