Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: update to TF 2.10 #1160

Merged
merged 6 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
python-version:
- 3.7
tf-version:
# Below we have a newer TF version for the TF tests.
# However, it seems somewhat broken for the inspections,
# so we keep this older TF version for now just for the inspections.
- 2.4.2

steps:
Expand Down Expand Up @@ -181,7 +184,7 @@ jobs:
python-version:
- 3.7
tf-version:
- 2.4.2
- 2.10.0
action:
- TEST=TFEngine
- TEST=TFNativeOp
Expand Down Expand Up @@ -280,6 +283,13 @@ jobs:
pip install --user nose
fi

if [[ "${{matrix.python-version}}" == 3.* ]]; then
if [[ "${{matrix.tf-version}}" == 2.[0123].* || "${{matrix.tf-version}}" == 1.* ]]; then
# Older TF needs older NumPy version.
# https://github.com/rwth-i6/returnn/pull/1160#issuecomment-1284537803
pip install --user numpy==1.19.5
fi
fi
pip install --user -r requirements.txt | cat
pip install --user --upgrade tensorflow==${{ matrix.tf-version }} | cat

Expand Down
19 changes: 12 additions & 7 deletions returnn/tf/util/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2889,21 +2889,26 @@ def _transform_compiler_opts(self, opts):
return nvcc_opts
return super(OpCodeCompiler, self)._transform_compiler_opts(opts)

@classmethod
def _cpp_common_opts(cls):
@staticmethod
def _cpp_std_version_opt():
tf_gcc_version = get_tf_gcc_version()
if tf_gcc_version and int(tf_gcc_version[0]) <= 5:
# GCC4 does not support c++14, needed to support TF 1.14 and earlier
# https://github.com/rwth-i6/returnn/pull/875
# GCC5 also has problems. https://github.com/rwth-i6/returnn/issues/890
cpp_version_opt = "-std=c++11"
return "-std=c++11"
elif have_min_tf_version((2, 10)):
# TF >=2.10 uses C++17 by default.
# https://github.com/tensorflow/tensorflow/blob/v2.10.0/.bazelrc#L334
# This we need to use this as well to avoid any abseil errors such as:
# undefined symbol: _ZN10tensorflow8str_util13StringReplaceB5cxx11EN4absl12lts_2022062311string_viewES3_S3_b
return "-std=c++17"
else:
cpp_version_opt = "-std=c++14"
return [cpp_version_opt]
return "-std=c++14"

def _extra_common_opts(self):
if self.is_cpp:
return self._cpp_common_opts()
return [self._cpp_std_version_opt()]
return []

def load_tf_module(self):
Expand Down Expand Up @@ -2949,7 +2954,7 @@ def __init__(self, include_paths=(), ld_flags=(), c_macro_defines=None, **kwargs
def _extra_common_opts(self):
if self.is_cpp:
# noinspection PyProtectedMember
return OpCodeCompiler._cpp_common_opts()
return [OpCodeCompiler._cpp_std_version_opt()]
return []

def _make_info_dict(self):
Expand Down