Skip to content

Commit 642ff70

Browse files
committed
Merge branch 'master' into cxx_17
2 parents 654a4aa + f3bea44 commit 642ff70

File tree

6 files changed

+30
-8
lines changed

6 files changed

+30
-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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,19 @@ 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
8990
processor that is older than `haswell` generation, you may wish to run `export CC_OPT_FLAGS="-march=native"`
9091
before the build. This command provides the best possible optimizations for your current CPU generation, but
9192
it may cause the built library to be incompatible with older generations.
9293

94+
**Warning:** In low-memory or many-cpu environments, the bazel scheduler can miss the resource consumption
95+
estimates and the build may be terminated by the out-of-memory killer.
96+
If that is your case, consider adding resource limit parameters to CMake, e.g.,
97+
`cmake -DLOCAL_RAM_RESOURCES=2048 -DLOCAL_CPU_RESOURCES=4 ..`
98+
9399
#### 4) (Optional) Free disk space
94100

95101
```

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
option(ALLOW_CUDA "Try to find and use CUDA." ON)
910
option(REQUIRE_CUDA "Make sure to find and use CUDA (implies ALLOW_CUDA)." OFF)
@@ -41,10 +42,10 @@ target_compile_features(tensorflow_cc INTERFACE "cxx_std_${CMAKE_CXX_STANDARD}")
4142
# The include folders are sometimes contained under bazel-bin/bin/ and sometimes just bazel-bin.
4243
target_include_directories(
4344
tensorflow_cc INTERFACE
44-
"${CMAKE_INSTALL_PREFIX}/include/tensorflow/bazel-bin/tensorflow/include"
45-
"${CMAKE_INSTALL_PREFIX}/include/tensorflow/bazel-bin/tensorflow/include/src"
46-
"${CMAKE_INSTALL_PREFIX}/include/tensorflow/bazel-bin/bin/tensorflow/include"
47-
"${CMAKE_INSTALL_PREFIX}/include/tensorflow/bazel-bin/bin/tensorflow/include/src"
45+
$<INSTALL_INTERFACE:include/tensorflow/bazel-bin/tensorflow/include>
46+
$<INSTALL_INTERFACE:include/tensorflow/bazel-bin/tensorflow/include/src>
47+
$<INSTALL_INTERFACE:include/tensorflow/bazel-bin/bin/tensorflow/include>
48+
$<INSTALL_INTERFACE:include/tensorflow/bazel-bin/bin/tensorflow/include/src>
4849
)
4950
target_link_libraries(
5051
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)