Skip to content

Commit 1c3a2b2

Browse files
authoredMay 20, 2022
Build against TF 2.9 (#2696)
* Build with TF 2.9 * Update cuda toolchain for manylinux2014
1 parent 953d848 commit 1c3a2b2

21 files changed

+72
-1958
lines changed
 

‎.devcontainer/Dockerfile

-32
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,2 @@
11
ARG IMAGE_TYPE=latest-cpu
22
FROM tfaddons/dev_container:$IMAGE_TYPE
3-
4-
ARG USERNAME=vscode
5-
ARG USER_UID=1000
6-
ARG USER_GID=$USER_UID
7-
8-
# Options for common package install script - SHA updated on release
9-
ARG INSTALL_ZSH="false"
10-
ARG UPGRADE_PACKAGES="false"
11-
ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/common-debian.sh"
12-
ARG COMMON_SCRIPT_SHA="dev-mode"
13-
14-
# Configure apt and install packages
15-
RUN apt-get update \
16-
&& export DEBIAN_FRONTEND=noninteractive \
17-
#
18-
# Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
19-
&& apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \
20-
&& curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \
21-
&& ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \
22-
&& /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
23-
&& rm /tmp/common-setup.sh \
24-
#
25-
# *********************************************************************
26-
# * Uncomment this section to use RUN to install other dependencies. *
27-
# * See https://aka.ms/vscode-remote/containers/dockerfile-run *
28-
# *********************************************************************
29-
# && apt-get -y install --no-install-recommends <your-package-list-here>
30-
#
31-
# Clean up
32-
&& apt-get autoremove -y \
33-
&& apt-get clean -y \
34-
&& rm -rf /var/lib/apt/lists/*

‎.devcontainer/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@
5555
"seccomp=unconfined" ],
5656

5757
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/pytest ./tensorflow_addons/layerscontainers/non-root.
58-
"remoteUser": "vscode"
58+
//"remoteUser": "vscode"
5959
}

‎.github/workflows/make_wheel_Windows_x86.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set -e -x
22

33
export TF_NEED_CUDA=0
4+
export PYTHON_BIN_PATH=$(which python)
45
export BAZEL_VC="C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/"
56

67
# Install Deps

‎.github/workflows/release.yml

+9-11
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ jobs:
4242
# https://github.com/bazelbuild/bazel/issues/14232#issuecomment-1011247429
4343
os: ['macos-10.15', 'windows-2019', 'ubuntu-18.04']
4444
py-version: ['3.7', '3.8', '3.9', '3.10']
45-
tf-version: ['2.6.3', '2.8.0']
45+
tf-version: ['2.7.2', '2.8.1', '2.9.0']
4646
cpu: ['x86']
4747
exclude:
4848
- py-version: '3.10'
49-
tf-version: '2.6.3'
49+
tf-version: '2.7.2'
5050
include:
5151
- os: 'macos-11'
5252
cpu: 'arm64'
53-
tf-version: '2.8.0'
53+
tf-version: '2.9.0'
5454
py-version: '3.8'
5555
- os: 'macos-11'
5656
cpu: 'arm64'
57-
tf-version: '2.8.0'
57+
tf-version: '2.9.0'
5858
py-version: '3.9'
5959
fail-fast: false
6060
steps:
@@ -76,8 +76,7 @@ jobs:
7676
name: Setup Bazel
7777
# Ubuntu bazel is run inside of the docker image
7878
run: bash tools/install_deps/install_bazelisk.sh ./
79-
- if: matrix.py-version != '3.9' || matrix.tf-version != '2.4.2'
80-
name: Build wheels
79+
- name: Build wheels
8180
env:
8281
OS: ${{ runner.os }}
8382
PY_VERSION: ${{ matrix.py-version }}
@@ -86,8 +85,7 @@ jobs:
8685
CPU: ${{ matrix.cpu }}
8786
shell: bash
8887
run: bash .github/workflows/make_wheel_${OS}_${CPU}.sh
89-
- if: matrix.py-version != '3.9' || matrix.tf-version != '2.4.2'
90-
uses: actions/upload-artifact@v1
88+
- uses: actions/upload-artifact@v1
9189
with:
9290
name: ${{ runner.os }}-${{ matrix.py-version }}-tf${{ matrix.tf-version }}-${{ matrix.cpu }}-wheel
9391
path: wheelhouse
@@ -99,16 +97,16 @@ jobs:
9997
matrix:
10098
os: ['macOS', 'Windows', 'Linux']
10199
py-version: ['3.7', '3.8', '3.9', '3.10']
102-
tf-version: ['2.8.0']
100+
tf-version: ['2.9.0']
103101
cpu: ['x86']
104102
include:
105103
- os: 'macOS'
106104
cpu: 'arm64'
107-
tf-version: '2.8.0'
105+
tf-version: '2.9.0'
108106
py-version: '3.8'
109107
- os: 'macOS'
110108
cpu: 'arm64'
111-
tf-version: '2.8.0'
109+
tf-version: '2.9.0'
112110
py-version: '3.9'
113111
fail-fast: false
114112
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'release'

‎CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Just run from the root:
174174

175175
```bash
176176
pip install tensorflow==2.8
177-
# you can use "pip install tensorflow-cpu==2.8.0" too if you're not testing on gpu.
177+
# you can use "pip install tensorflow-cpu==2.9.0" too if you're not testing on gpu.
178178
pip install -e ./
179179
```
180180

@@ -262,7 +262,7 @@ If you need a custom C++/Cuda op for your test, compile your ops with
262262

263263
```bash
264264
python configure.py
265-
pip install tensorflow==2.8 -e ./ -r tools/install_deps/pytest.txt
265+
pip install tensorflow==2.9 -e ./ -r tools/install_deps/pytest.txt
266266
bash tools/install_so_files.sh # Linux/macos/WSL2
267267
sh tools/install_so_files.sh # PowerShell
268268
```
@@ -290,7 +290,7 @@ docker run --gpus all --rm -it -v ${PWD}:/addons -w /addons gcr.io/tensorflow-te
290290

291291
Configure:
292292
```bash
293-
python3 -m pip install tensorflow==2.8
293+
python3 -m pip install tensorflow==2.9
294294
python3 ./configure.py # Links project with TensorFlow dependency
295295
```
296296

@@ -329,7 +329,7 @@ quickly, as Bazel has great support for caching and distributed testing.
329329
To test with Bazel:
330330

331331
```bash
332-
python3 -m pip install tensorflow==2.8
332+
python3 -m pip install tensorflow==2.9
333333
python3 configure.py
334334
python3 -m pip install -r tools/install_deps/pytest.txt
335335
bazel test -c opt -k \

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ what it was tested against.
8080
#### Python Op Compatibility Matrix
8181
| TensorFlow Addons | TensorFlow | Python |
8282
|:----------------------- |:---|:---------- |
83-
| tfa-nightly | 2.6, 2.7, 2.8 | 3.7, 3.8, 3.9, 3.10 |
83+
| tfa-nightly | 2.7, 2.8, 2.9 | 3.7, 3.8, 3.9, 3.10 |
8484
| tensorflow-addons-0.16.1 | 2.6, 2.7, 2.8 |3.7, 3.8, 3.9, 3.10 |
8585
| tensorflow-addons-0.15.0 | 2.5, 2.6, 2.7 |3.7, 3.8, 3.9 |
8686
| tensorflow-addons-0.14.0 | 2.4, 2.5, 2.6 |3.6, 3.7, 3.8, 3.9 |

‎WORKSPACE

+25
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,28 @@ tf_configure(
1818
)
1919

2020
cuda_configure(name = "local_config_cuda")
21+
22+
http_archive(
23+
name = "org_tensorflow",
24+
sha256 = "8087cb0c529f04a4bfe480e49925cd64a904ad16d8ec66b98e2aacdfd53c80ff",
25+
strip_prefix = "tensorflow-2.9.0",
26+
urls = [
27+
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.9.0.tar.gz",
28+
],
29+
)
30+
31+
load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3")
32+
33+
tf_workspace3()
34+
35+
load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2")
36+
37+
tf_workspace2()
38+
39+
load("@org_tensorflow//tensorflow:workspace1.bzl", "tf_workspace1")
40+
41+
tf_workspace1()
42+
43+
load("@org_tensorflow//tensorflow:workspace0.bzl", "tf_workspace0")
44+
45+
tf_workspace0()

‎build_deps/toolchains/gcc7_manylinux2010-nvcc-cuda11/BUILD

-118
This file was deleted.

‎build_deps/toolchains/gcc7_manylinux2010-nvcc-cuda11/cc_toolchain_config.bzl

-1,493
This file was deleted.

‎build_deps/toolchains/gcc7_manylinux2010-nvcc-cuda11/clang/bin/crosstool_wrapper_driver_is_not_gcc

-281
This file was deleted.

‎configure.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323

2424
import tensorflow as tf
2525

26+
try:
27+
from packaging.version import Version
28+
except ImportError:
29+
from distutils.version import LooseVersion as Version
30+
2631
_TFA_BAZELRC = ".bazelrc"
2732

2833

@@ -127,9 +132,16 @@ def create_build_configuration():
127132
write_action_env("TF_SHARED_LIBRARY_NAME", get_shared_lib_name())
128133
write_action_env("TF_CXX11_ABI_FLAG", tf.sysconfig.CXX11_ABI_FLAG)
129134

135+
if Version(tf.__version__) >= Version("2.9.0"):
136+
glibcxx = '"-D_GLIBCXX_USE_CXX11_ABI=1"'
137+
else:
138+
glibcxx = '"-D_GLIBCXX_USE_CXX11_ABI=0"'
139+
130140
write("build --spawn_strategy=standalone")
131141
write("build --strategy=Genrule=standalone")
142+
write("build --experimental_repo_remote_exec")
132143
write("build -c opt")
144+
write("build --cxxopt=" + glibcxx)
133145

134146
if is_windows():
135147
write("build --config=windows")
@@ -172,7 +184,9 @@ def configure_cuda():
172184
write("test --config=cuda")
173185
write("build --config=cuda")
174186
write("build:cuda --define=using_cuda=true --define=using_cuda_nvcc=true")
175-
write("build:cuda --crosstool_top=@local_config_cuda//crosstool:toolchain")
187+
write(
188+
"build:cuda --crosstool_top=@ubuntu20.04-gcc9_manylinux2014-cuda11.2-cudnn8.1-tensorrt7.2_config_cuda//crosstool:toolchain"
189+
)
176190

177191

178192
if __name__ == "__main__":

‎tensorflow_addons/utils/resource_loader.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
import tensorflow as tf
2222

23-
INCLUSIVE_MIN_TF_VERSION_FOR_ABI_COMPATIBILITY = "2.8.0"
24-
EXCLUSIVE_MAX_TF_VERSION_FOR_ABI_COMPATIBILITY = "2.9.0"
23+
INCLUSIVE_MIN_TF_VERSION_FOR_ABI_COMPATIBILITY = "2.9.0"
24+
EXCLUSIVE_MAX_TF_VERSION_FOR_ABI_COMPATIBILITY = "2.10.0"
2525
abi_warning_already_raised = False
2626
SKIP_CUSTOM_OPS = False
2727

‎tensorflow_addons/utils/test_utils.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
from tensorflow_addons import options
2626
from tensorflow_addons.utils import resource_loader
2727

28-
# TODO: copy the layer_test implementation in Addons.
29-
if tf.__version__[:3] > "2.5":
30-
from keras.testing_utils import layer_test # noqa: F401
28+
if tf.__version__[:3] > "2.8":
29+
from keras.testing_infra.test_utils import layer_test # noqa: F401
3130
else:
32-
from tensorflow.python.keras.testing_utils import layer_test # noqa: F401
31+
from keras.testing_utils import layer_test # noqa: F401
3332

3433
NUMBER_OF_WORKERS = int(os.environ.get("PYTEST_XDIST_WORKER_COUNT", "1"))
3534
WORKER_ID = int(os.environ.get("PYTEST_XDIST_WORKER", "gw0")[2])

‎tensorflow_addons/version.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"""Define TensorFlow Addons version information."""
1616

1717
# Required TensorFlow version [min, max)
18-
INCLUSIVE_MIN_TF_VERSION = "2.6.0"
19-
EXCLUSIVE_MAX_TF_VERSION = "2.9.0"
18+
INCLUSIVE_MIN_TF_VERSION = "2.7.0"
19+
EXCLUSIVE_MAX_TF_VERSION = "2.10.0"
2020

2121
# We follow Semantic Versioning (https://semver.org/)
2222
_MAJOR_VERSION = "0"

‎tools/build_dev_container.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -x -e
44

55
docker build \
66
-f tools/docker/dev_container.Dockerfile \
7-
--build-arg TF_VERSION=2.8.0 \
7+
--build-arg TF_VERSION=2.9.0 \
88
--build-arg TF_PACKAGE=tensorflow \
99
--build-arg PY_VERSION=$PY_VERSION \
1010
--no-cache \

‎tools/docker/build_wheel.Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ARG PY_VERSION
77
ARG TF_VERSION
88

99
# TODO: Remove this if tensorflow/build container removes their keras-nightly install
10+
# https://github.com/tensorflow/build/issues/78
1011
RUN python -m pip uninstall -y keras-nightly
1112

1213
RUN python -m pip install --default-timeout=1000 tensorflow==$TF_VERSION
@@ -40,13 +41,13 @@ RUN bazel build \
4041
--noshow_loading_progress \
4142
--verbose_failures \
4243
--test_output=errors \
43-
--crosstool_top=//build_deps/toolchains/gcc7_manylinux2010-nvcc-cuda11:toolchain \
44+
--crosstool_top=@ubuntu20.04-gcc9_manylinux2014-cuda11.2-cudnn8.1-tensorrt7.2_config_cuda//crosstool:toolchain \
4445
build_pip_pkg && \
4546
# Package Whl
4647
bazel-bin/build_pip_pkg artifacts $NIGHTLY_FLAG
4748

4849
RUN bash tools/releases/tf_auditwheel_patch.sh
49-
RUN python -m auditwheel repair --plat manylinux2010_x86_64 artifacts/*.whl
50+
RUN python -m auditwheel repair --plat manylinux2014_x86_64 artifacts/*.whl
5051
RUN ls -al wheelhouse/
5152

5253
# -------------------------------------------------------------------

‎tools/docker/cpu_tests.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#syntax=docker/dockerfile:1.1.5-experimental
22
FROM python:3.7 as build_wheel
33

4-
ARG TF_VERSION=2.8.0
4+
ARG TF_VERSION=2.9.0
55
RUN pip install --default-timeout=1000 tensorflow-cpu==$TF_VERSION
66

77
RUN apt-get update && apt-get install -y sudo rsync

‎tools/install_deps/tensorflow-cpu.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
tensorflow-cpu~=2.8.0
1+
tensorflow-cpu~=2.9.0

‎tools/install_deps/tensorflow.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
tensorflow~=2.8.0
1+
tensorflow~=2.9.0

‎tools/install_so_files.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set -e -x
22

33
if [ "$TF_NEED_CUDA" == "1" ]; then
4-
CUDA_FLAG="--crosstool_top=//build_deps/toolchains/gcc7_manylinux2010-nvcc-cuda11:toolchain"
4+
CUDA_FLAG="--crosstool_top=@ubuntu20.04-gcc9_manylinux2014-cuda11.2-cudnn8.1-tensorrt7.2_config_cuda//crosstool:toolchain"
55
fi
66

77
bazel build $CUDA_FLAG //tensorflow_addons/...

‎tools/run_gpu_tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export DOCKER_BUILDKIT=1
66
docker build \
77
-f tools/docker/build_wheel.Dockerfile \
88
--target tfa_gpu_tests \
9-
--build-arg TF_VERSION=2.8.0 \
9+
--build-arg TF_VERSION=2.9.0 \
1010
--build-arg PY_VERSION=3.7 \
1111
-t tfa_gpu_tests ./
1212
docker run --rm -t --gpus=all tfa_gpu_tests

0 commit comments

Comments
 (0)
Please sign in to comment.