Skip to content

Commit cea76cd

Browse files
saudetkarllessard
andauthored
Upgrade for TensorFlow 2.5.0 (#303)
* Upgrade for TensorFlow 2.5.0 * Upgrade version of bazel to build TF2.5 * Disable libiomp5 path fix on MacOSX * Disabling MKL builds on all platforms Co-authored-by: klessard <[email protected]>
1 parent 7b5a1ca commit cea76cd

File tree

257 files changed

+35396
-5641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+35396
-5641
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
needs: prepare
9090
strategy:
9191
matrix:
92-
ext: ["", -mkl, -gpu] #, -mkl-gpu]
92+
ext: ["", -gpu] #, -mkl, -mkl-gpu]
9393
steps:
9494
- name: Install environment
9595
run: |
@@ -104,7 +104,7 @@ jobs:
104104
tar xzf $HOME/apache-maven-3.6.3-bin.tar.gz -C /opt/
105105
ln -sf /opt/apache-maven-3.6.3/bin/mvn /usr/bin/mvn
106106
echo Downloading Bazel
107-
curl -L https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel-3.1.0-installer-linux-x86_64.sh -o bazel.sh --retry 10
107+
curl -L https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel-3.7.2-installer-linux-x86_64.sh -o bazel.sh --retry 10
108108
bash bazel.sh
109109
if [[ "${{ matrix.ext }}" == *-gpu ]]; then
110110
echo Installing CUDA
@@ -153,13 +153,13 @@ jobs:
153153
needs: prepare
154154
strategy:
155155
matrix:
156-
ext: ["", -mkl]
156+
ext: [""] # , -mkl]
157157
steps:
158158
- name: Install environment
159159
run: |
160160
python3 -m pip install numpy six
161161
echo Downloading Bazel
162-
curl -L https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel-3.1.0-installer-darwin-x86_64.sh -o bazel.sh --retry 10
162+
curl -L https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel-3.7.2-installer-darwin-x86_64.sh -o bazel.sh --retry 10
163163
bash bazel.sh
164164
brew install libomp perl
165165
- name: Checkout repository
@@ -189,7 +189,7 @@ jobs:
189189
needs: prepare
190190
strategy:
191191
matrix:
192-
ext: ["", -gpu, -mkl] #, -mkl-gpu]
192+
ext: ["", -gpu] #, -mkl, -mkl-gpu]
193193
steps:
194194
- name: Configure page file
195195
uses: al-cheb/[email protected]
@@ -208,7 +208,7 @@ jobs:
208208
bash.exe -lc "find 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/' -iname '14.1*' -exec rm -Rf {} \;"
209209
echo Downloading Bazel
210210
mkdir C:\bazel
211-
curl.exe -L https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel-3.1.0-windows-x86_64.exe -o C:/bazel/bazel.exe --retry 10
211+
curl.exe -L https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel-3.7.2-windows-x86_64.exe -o C:/bazel/bazel.exe --retry 10
212212
set "EXT=${{ matrix.ext }}"
213213
if "%EXT:~-4%" == "-gpu" (
214214
echo Removing some unused stuff to avoid running out of disk space

tensorflow-core/pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@
102102
</activation>
103103
<modules>
104104
<module>tensorflow-core-platform</module>
105-
<module>tensorflow-core-platform-mkl</module>
106-
<module>tensorflow-core-platform-mkl-gpu</module>
107105
<module>tensorflow-core-platform-gpu</module>
106+
<!-- Disabling MKL builds until they are more stable and performant -->
107+
<!--module>tensorflow-core-platform-mkl</module-->
108+
<!--module>tensorflow-core-platform-mkl-gpu</module-->
108109
</modules>
109110
</profile>
110111

tensorflow-core/tensorflow-core-api/.bazelrc

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ build --define open_source_build=true
151151
test --define open_source_build=true
152152

153153
# For workaround https://github.com/bazelbuild/bazel/issues/8772 with Bazel >= 0.29.1
154-
build --java_toolchain=@org_tensorflow//third_party/toolchains/java:tf_java_toolchain
155-
build --host_java_toolchain=@org_tensorflow//third_party/toolchains/java:tf_java_toolchain
154+
build --java_toolchain=@tf_toolchains//toolchains/java:tf_java_toolchain
155+
build --host_java_toolchain=@tf_toolchains//toolchains/java:tf_java_toolchain
156156

157157
# Please note that MKL on MacOS or windows is still not supported.
158158
# If you would like to use a local MKL instead of downloading, please set the
@@ -616,3 +616,33 @@ build:release_gpu_linux_cuda_10_1 --config=release_gpu_linux
616616
build:release_gpu_linux_cuda_10_1 --action_env CUDA_TOOLKIT_PATH="/usr/local/cuda-10.1"
617617
build:release_gpu_linux_cuda_10_1 --action_env=TF_CUDA_VERSION="10"
618618
build:release_gpu_linux_cuda_10_1 --action_env=TF_CUDNN_VERSION="7"
619+
620+
# Address sanitizer
621+
# CC=clang bazel build --config asan
622+
build:asan --strip=never
623+
build:asan --copt -fsanitize=address
624+
build:asan --copt -DADDRESS_SANITIZER
625+
build:asan --copt -g
626+
build:asan --copt -O3
627+
build:asan --copt -fno-omit-frame-pointer
628+
build:asan --linkopt -fsanitize=address
629+
630+
# Memory sanitizer
631+
# CC=clang bazel build --config msan
632+
build:msan --strip=never
633+
build:msan --copt -fsanitize=memory
634+
build:msan --copt -DADDRESS_SANITIZER
635+
build:msan --copt -g
636+
build:msan --copt -O3
637+
build:msan --copt -fno-omit-frame-pointer
638+
build:msan --linkopt -fsanitize=memory
639+
640+
# Undefined Behavior Sanitizer
641+
# CC=clang bazel build --config ubsan
642+
build:ubsan --strip=never
643+
build:ubsan --copt -fsanitize=undefined
644+
build:ubsan --copt -g
645+
build:ubsan --copt -O3
646+
build:ubsan --copt -fno-omit-frame-pointer
647+
build:ubsan --linkopt -fsanitize=undefined
648+
build:ubsan --linkopt -lubsan

tensorflow-core/tensorflow-core-api/WORKSPACE

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,31 @@ http_archive(
1717
patch_args = ["-p1"],
1818
patch_cmds = ["grep -rl 'java_package' tensorflow/core | xargs sed -i.bak 's/^\(.* java_package = \"org\.tensorflow\.\)\(.*\"\)/\\1proto.\\2'/"],
1919
urls = [
20-
"https://github.com/tensorflow/tensorflow/archive/v2.4.1.tar.gz",
20+
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.5.0.tar.gz",
2121
],
22-
sha256 = "f681331f8fc0800883761c7709d13cda11942d4ad5ff9f44ad855e9dc78387e0",
23-
strip_prefix = "tensorflow-2.4.1"
22+
sha256 = "233875ea27fc357f6b714b2a0de5f6ff124b50c1ee9b3b41f9e726e9e677b86c",
23+
strip_prefix = "tensorflow-2.5.0"
2424
)
2525

2626
# START: Upstream TensorFlow dependencies
2727
# TensorFlow build depends on these dependencies.
2828
# Needs to be in-sync with TensorFlow sources.
29-
http_archive(
30-
name = "io_bazel_rules_closure",
31-
sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
32-
strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
33-
urls = [
34-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
35-
"https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2019-06-13
36-
],
37-
)
38-
# END: Upstream TensorFlow dependencies
29+
load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3")
30+
31+
tf_workspace3()
3932

40-
load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")
41-
tf_workspace()
33+
load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2")
34+
35+
tf_workspace2()
36+
37+
load("@org_tensorflow//tensorflow:workspace1.bzl", "tf_workspace1")
38+
39+
tf_workspace1()
40+
41+
load("@org_tensorflow//tensorflow:workspace0.bzl", "tf_workspace0")
42+
43+
tf_workspace0()
44+
# END: Upstream TensorFlow dependencies
4245

4346
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
4447
grpc_deps()

tensorflow-core/tensorflow-core-api/build.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@ done
6868
echo "Listing $TENSORFLOW_BIN:" && ls -l $TENSORFLOW_BIN
6969

7070
if [[ -x /usr/bin/install_name_tool ]] && [[ -e $BAZEL_BIN/external/llvm_openmp/libiomp5.dylib ]]; then
71-
# Fix library with correct rpath on Mac
72-
chmod +w $BAZEL_BIN/external/llvm_openmp/libiomp5.dylib $TENSORFLOW_BIN/libtensorflow_cc.2.dylib $TENSORFLOW_BIN/libtensorflow_framework.2.dylib
73-
UGLYPATH=$(otool -L $TENSORFLOW_BIN/libtensorflow_cc.2.dylib | grep @loader_path | cut -f1 -d ' ')
74-
install_name_tool -add_rpath @loader_path/. -id @rpath/libiomp5.dylib $BAZEL_BIN/external/llvm_openmp/libiomp5.dylib
75-
install_name_tool -change $UGLYPATH @rpath/libiomp5.dylib $TENSORFLOW_BIN/libtensorflow_cc.2.dylib
76-
install_name_tool -change $UGLYPATH @rpath/libiomp5.dylib $TENSORFLOW_BIN/libtensorflow_framework.2.dylib
71+
# Fix library with correct rpath on Mac
72+
chmod +w $BAZEL_BIN/external/llvm_openmp/libiomp5.dylib $TENSORFLOW_BIN/libtensorflow_cc.2.dylib $TENSORFLOW_BIN/libtensorflow_framework.2.dylib
73+
UGLYPATH=$(otool -L $TENSORFLOW_BIN/libtensorflow_cc.2.dylib | grep @loader_path | cut -f1 -d ' ')
74+
echo $UGLYPATH
75+
install_name_tool -add_rpath @loader_path/. -id @rpath/libiomp5.dylib $BAZEL_BIN/external/llvm_openmp/libiomp5.dylib
76+
install_name_tool -change $UGLYPATH @rpath/libiomp5.dylib $TENSORFLOW_BIN/libtensorflow_cc.2.dylib
77+
install_name_tool -change $UGLYPATH @rpath/libiomp5.dylib $TENSORFLOW_BIN/libtensorflow_framework.2.dylib
7778
fi
7879

7980
GEN_SRCS_DIR=src/gen/java

0 commit comments

Comments
 (0)