Skip to content

Commit f3bea44

Browse files
authored
Merge pull request #271 from FloopCZ/relocatable
Make package relocatable
2 parents 385751c + e1cc26b commit f3bea44

File tree

6 files changed

+25
-8
lines changed

6 files changed

+25
-8
lines changed

Dockerfiles/install-common.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ make
2424
rm -rf /home/tensorflow_cc/.cache
2525
rm -rf /root/.cache
2626
make install
27+
ldconfig
2728
cd "$cwd"
2829
rm -rf tensorflow_cc/tensorflow_cc/build
2930

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ mkdir build && cd build
8383
cmake ..
8484
make
8585
sudo make install
86+
sudo ldconfig
8687
```
8788

8889
**Warning:** Optimizations for Intel CPU generation `>=haswell` are enabled by default. If you have a

tensorflow_cc/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
2+
cmake_policy(SET CMP0048 NEW) # Enable version parameter in project().
23
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/PROJECT_VERSION" version)
34
project(
45
"tensorflow_cc"
6+
VERSION ${version}
57
)
6-
set(PROJECT_VERSION "${version}")
78

89
# If enabled, bazel has to be installed.
910
option(ALLOW_CUDA "Try to find and use CUDA." ON)
@@ -45,10 +46,10 @@ target_compile_features(tensorflow_cc INTERFACE ${TARGET_CXX_STANDARD})
4546
# The include folders are sometimes contained under bazel-bin/bin/ and sometimes just bazel-bin.
4647
target_include_directories(
4748
tensorflow_cc INTERFACE
48-
"${CMAKE_INSTALL_PREFIX}/include/tensorflow/bazel-bin/tensorflow/include"
49-
"${CMAKE_INSTALL_PREFIX}/include/tensorflow/bazel-bin/tensorflow/include/src"
50-
"${CMAKE_INSTALL_PREFIX}/include/tensorflow/bazel-bin/bin/tensorflow/include"
51-
"${CMAKE_INSTALL_PREFIX}/include/tensorflow/bazel-bin/bin/tensorflow/include/src"
49+
$<INSTALL_INTERFACE:include/tensorflow/bazel-bin/tensorflow/include>
50+
$<INSTALL_INTERFACE:include/tensorflow/bazel-bin/tensorflow/include/src>
51+
$<INSTALL_INTERFACE:include/tensorflow/bazel-bin/bin/tensorflow/include>
52+
$<INSTALL_INTERFACE:include/tensorflow/bazel-bin/bin/tensorflow/include/src>
5253
)
5354
target_link_libraries(
5455
tensorflow_cc INTERFACE

tensorflow_cc/cmake/TensorflowBase.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ 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
2225
)

tensorflow_cc/cmake/build_tensorflow.sh.in

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ if [ "$cuda_allowed" == true ] && [ "$cuda_available" == true ]; then
6161

6262
# choose the right version of CUDA compiler
6363
if [ -z "$GCC_HOST_COMPILER_PATH" ]; then
64-
if hash gcc 2>/dev/null && version_gt 10.3 `gcc -dumpversion`; then
65-
export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:-"/usr/bin/gcc"}
66-
elif hash gcc-10 2>/dev/null && version_gt 10.3 `gcc-10 -dumpversion`; then
64+
if hash gcc-10 2>/dev/null && version_gt 10.3 `gcc-10 -dumpversion`; then
6765
export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:-"/usr/bin/gcc-10"}
6866
elif hash gcc-9 2>/dev/null && version_gt 9.4 `gcc-9 -dumpversion`; then
6967
export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:-"/usr/bin/gcc-9"}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/third_party/nccl/build_defs.bzl.tpl b/third_party/nccl/build_defs.bzl.tpl
2+
index ceb65e3b632f3..c875717403857 100644
3+
--- a/third_party/nccl/build_defs.bzl.tpl
4+
+++ b/third_party/nccl/build_defs.bzl.tpl
5+
@@ -204,7 +204,7 @@ def _prune_relocatable_code_impl(ctx):
6+
arguments = arguments,
7+
mnemonic = "nvprune",
8+
)
9+
- output.append(outputs)
10+
+ outputs.append(output)
11+
12+
return DefaultInfo(files = depset(outputs))
13+

0 commit comments

Comments
 (0)