Skip to content

Commit 5fefb85

Browse files
authored
Merge pull request #189 from FloopCZ/v1.15.0
Update TensorFlow to v1.15.0
2 parents 88cf2ab + 9075a3b commit 5fefb85

12 files changed

+136
-46
lines changed

Dockerfiles/BAZEL_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.21.0
1+
0.26.1

Dockerfiles/archlinux-shared

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM archlinux/base
1+
FROM archlinux:latest
22

33
# copy the contents of this repository to the container
44
COPY . tensorflow_cc

Dockerfiles/archlinux-shared-cuda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM archlinux/base
1+
FROM archlinux:latest
22

33
# copy the contents of this repository to the container
44
COPY . tensorflow_cc
@@ -10,4 +10,4 @@ RUN ./tensorflow_cc/Dockerfiles/install-archlinux.sh --cuda --shared
1010

1111
ENV NVIDIA_VISIBLE_DEVICES all
1212
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
13-
ENV NVIDIA_REQUIRE_CUDA "cuda>=9.2"
13+
ENV NVIDIA_REQUIRE_CUDA "cuda>=10.1"

Dockerfiles/install-archlinux.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ pacman -Syu --noconfirm --needed \
3030

3131
if $shared; then
3232
pacman -S --noconfirm --needed \
33-
gcc \
3433
java-environment=8 \
3534
libarchive \
3635
protobuf \

Dockerfiles/install-ubuntu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ if $shared; then
5151
fi
5252
if $cuda; then
5353
# install libcupti
54-
apt-get -y install cuda-command-line-tools-10-0
54+
apt-get -y install cuda-command-line-tools-10-1
5555
fi
5656

5757
apt-get -y clean

Dockerfiles/ubuntu-shared-cuda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
1+
FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
22

33
# copy the contents of this repository to the container
44
COPY . tensorflow_cc

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://ash.floop.cz:8080/buildStatus/icon?job=tensorflow_cc)](http://ash.floop.cz:8080/job/tensorflow_cc/)
3-
[![TF version](https://img.shields.io/badge/TF%20version-1.13.1-brightgreen.svg)]()
3+
[![TF version](https://img.shields.io/badge/TF%20version-1.15.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

@@ -60,7 +60,7 @@ sudo pacman -S gcc7 bazel cuda cudnn nvidia
6060
```
6161

6262
**Warning:** Newer versions of TensorFlow sometimes fail to build with the latest version of Bazel. You may wish
63-
to install an older version of Bazel (e.g., 0.16.1).
63+
to install an older version of Bazel (e.g., 0.26.1).
6464

6565
#### 2) Clone this repository
6666
```

tensorflow_cc/CMakeLists.txt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
22
project(
33
"tensorflow_cc"
4-
VERSION 1.13.1
4+
VERSION 1.15.0
55
)
66

77
# Static library with no GPU support is built by default.
@@ -10,7 +10,7 @@ project(
1010
option(TENSORFLOW_SHARED "Build shared library (required for GPU support)." OFF)
1111
option(ALLOW_CUDA "When building the shared library, try to find and use CUDA." ON)
1212
option(TENSORFLOW_STATIC "Build static library." ON)
13-
set(TENSORFLOW_TAG "v1.13.1" CACHE STRING "The tensorflow release tag to be checked out (default v1.13.1).")
13+
set(TENSORFLOW_TAG "v1.15.0" CACHE STRING "The tensorflow release tag to be checked out (default v1.15.0).")
1414
option(SYSTEM_PROTOBUF "Use system protobuf instead of static protobuf from contrib/makefile." OFF)
1515

1616
# -------------
@@ -79,7 +79,7 @@ if(TENSORFLOW_SHARED)
7979
)
8080
target_link_libraries(
8181
tensorflow_cc_shared INTERFACE
82-
"${CMAKE_INSTALL_PREFIX}/lib/tensorflow_cc/libtensorflow_cc.so"
82+
"${CMAKE_INSTALL_PREFIX}/lib/libtensorflow_cc.so.${PROJECT_VERSION_MAJOR}"
8383
dl pthread
8484
)
8585
if(SYSTEM_PROTOBUF)
@@ -204,6 +204,12 @@ install(
204204
PATTERN "*.tar.*" EXCLUDE
205205
PATTERN "*.zip" EXCLUDE
206206
)
207+
# install all the *.inc files
208+
install(
209+
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/tensorflow/tensorflow/contrib/makefile/gen/"
210+
DESTINATION include/tensorflow/tensorflow/contrib/makefile/gen
211+
FILES_MATCHING PATTERN "*.inc"
212+
)
207213
# install all files from third_party folder (e.g., Eigen/Tensor)
208214
install(
209215
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/tensorflow/third_party/"
@@ -220,14 +226,23 @@ endif()
220226
if(TENSORFLOW_SHARED)
221227
install(
222228
FILES "${CMAKE_CURRENT_BINARY_DIR}/tensorflow/bazel-bin/tensorflow/libtensorflow_cc.so"
223-
DESTINATION lib/tensorflow_cc
229+
DESTINATION lib
230+
RENAME libtensorflow_cc.so.${PROJECT_VERSION_MAJOR}
224231
OPTIONAL
225232
)
226233
install(
227234
FILES "${CMAKE_CURRENT_BINARY_DIR}/tensorflow/bazel-bin/bin/tensorflow/libtensorflow_cc.so"
228-
DESTINATION lib/tensorflow_cc
235+
DESTINATION lib
236+
RENAME libtensorflow_cc.so.${PROJECT_VERSION_MAJOR}
229237
OPTIONAL
230238
)
239+
# Make versioned symlinks to the library
240+
install(CODE "execute_process( \
241+
COMMAND ${CMAKE_COMMAND} -E create_symlink \
242+
libtensorflow_cc.so.${PROJECT_VERSION_MAJOR} \
243+
${CMAKE_INSTALL_PREFIX}/lib/libtensorflow_cc.so \
244+
)"
245+
)
231246
endif()
232247
# static library specific
233248
if(TENSORFLOW_STATIC)

tensorflow_cc/cmake/TensorflowShared.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ ExternalProject_Add(
1010
BUILD_IN_SOURCE 1
1111
DOWNLOAD_COMMAND ""
1212
UPDATE_COMMAND ""
13-
CONFIGURE_COMMAND tensorflow/contrib/makefile/compile_linux_protobuf.sh
13+
# The grpc integrated in v1.15.0 needs patching, see https://github.com/clearlinux/distribution/issues/1151.
14+
CONFIGURE_COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/patches/v1.15.0-Rename-gettid-functions.patch" .
15+
COMMAND git apply v1.15.0-Rename-gettid-functions.patch
16+
COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/patches/v1.15.0-workspace.bzl.patch" .
17+
COMMAND git apply v1.15.0-workspace.bzl.patch
18+
COMMAND tensorflow/contrib/makefile/compile_linux_protobuf.sh
1419
# Do not fail on warnings when building nsync
1520
COMMAND sed -i "s/ -Werror//g" tensorflow/contrib/makefile/compile_nsync.sh
1621
COMMAND tensorflow/contrib/makefile/compile_nsync.sh

tensorflow_cc/cmake/build_tensorflow.sh.in

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,48 +28,25 @@ export TF_NEED_KAFKA=${TF_NEED_KAFKA:-0}
2828
export TF_DOWNLOAD_CLANG=${TF_DOWNLOAD_CLANG:-0}
2929
export TF_NEED_IGNITE=${TF_NEED_IGNITE:-0}
3030
export TF_NEED_ROCM=${TF_NEED_ROCM:-0}
31-
export TF_NCCL_VERSION=${TF_NCCL_VERSION:-2.3} # _DEFAULT_NCCL_VERSION from configure.py
3231
export NCCL_INSTALL_PATH=${NCCL_INSTALL_PATH:-/usr}
3332
export PYTHON_BIN_PATH=${PYTHON_BIN_PATH:-"$(which python3)"}
3433
export PYTHON_LIB_PATH="$($PYTHON_BIN_PATH -c 'import site; print(site.getsitepackages()[0])')"
3534

36-
# configure cuda environmental variables
37-
38-
if [ -e /opt/cuda ]; then
39-
echo "Using CUDA from /opt/cuda"
40-
export CUDA_TOOLKIT_PATH=/opt/cuda
41-
elif [ -e /usr/local/cuda ]; then
42-
echo "Using CUDA from /usr/local/cuda"
43-
export CUDA_TOOLKIT_PATH=/usr/local/cuda
44-
fi
45-
46-
if [ -e /opt/cuda/include/cudnn.h ]; then
47-
echo "Using CUDNN from /opt/cuda"
48-
export CUDNN_INSTALL_PATH=/opt/cuda
49-
elif [ -e /usr/local/cuda/include/cudnn.h ]; then
50-
echo "Using CUDNN from /usr/local/cuda"
51-
export CUDNN_INSTALL_PATH=/usr/local/cuda
52-
elif [ -e /usr/include/cudnn.h ]; then
53-
echo "Using CUDNN from /usr"
54-
export CUDNN_INSTALL_PATH=/usr
55-
fi
56-
57-
if [ "@ALLOW_CUDA@" = "ON" ] && [ -n "${CUDA_TOOLKIT_PATH}" ]; then
58-
if [[ -z "${CUDNN_INSTALL_PATH}" ]]; then
59-
echo "CUDA found but no cudnn.h found. Please install cuDNN."
60-
exit 1
61-
fi
35+
# check if cuda support requested and supported
36+
if [ "@ALLOW_CUDA@" = "ON" ] && hash nvcc 2>/dev/null; then
6237
echo "CUDA support enabled"
6338
cuda_config_opts="--config=cuda"
6439
export TF_NEED_CUDA=1
6540
export TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES:-"3.5,7.0"} # default from configure.py
66-
export TF_CUDA_VERSION="$($CUDA_TOOLKIT_PATH/bin/nvcc --version | sed -n 's/^.*release \(.*\),.*/\1/p')"
67-
export TF_CUDNN_VERSION="$(sed -n 's/^#define CUDNN_MAJOR\s*\(.*\).*/\1/p' $CUDNN_INSTALL_PATH/include/cudnn.h)"
41+
export TF_CUDA_PATHS=${TF_CUDA_PATHS:-"/opt/cuda,/usr/local/cuda,/usr/local,/usr/cuda,/usr"}
42+
export TF_CUDA_VERSION="$(nvcc --version | sed -n 's/^.*release \(.*\),.*/\1/p')"
43+
export TF_NCCL_VERSION="$(find / -name 'libnccl.so.*' | tail -n1 | sed -r 's/^.*\.so\.//')"
44+
export TF_CUDNN_VERSION="$(find / -name 'libcudnn.so.*' | tail -n1 | sed -r 's/^.*\.so\.//')"
6845

6946
# choose the right version of CUDA compiler
7047
if [ -z "$GCC_HOST_COMPILER_PATH" ]; then
71-
if hash gcc 2>/dev/null && version_gt 8.5 `gcc -dumpversion`; then
72-
export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:-"/usr/bin/gcc"}
48+
if hash gcc-8 2>/dev/null && version_gt 8.5 `gcc-8 -dumpversion`; then
49+
export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:-"/usr/bin/gcc-8"}
7350
elif hash gcc-7 2>/dev/null && version_gt 7.5 `gcc-7 -dumpversion`; then
7451
export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:-"/usr/bin/gcc-7"}
7552
elif hash gcc-6 2>/dev/null && version_gt 6.4 `gcc-6 -dumpversion`; then

0 commit comments

Comments
 (0)