Skip to content

Commit 97a574b

Browse files
smuzaffariarspider
andauthored
[TF] Update TF v2.16.1 (#9241)
* Update TF v2.16.1 * update abseil-cpp 20230802.2 * update bazel-absl patch * TF2.16: Apply abseil aarch64 patch * Update py3-scipy * Update cython as well * Try updating py3-blosc2 * Update py3-tables * Add symlink for cudnn_frontend_archive * Update tensorflow.spec * Remove more files with broken symbols * Update keras * Add missing keras dependencies * Build fft in tensorflow * Update tensorflow-sources.file * Update tensorflow-xla-runtime recipe to link with libfft_wrapper * Try fixing unit tests * Revert "Try fixing unit tests" This reverts commit cd1a82e. * Revert "Update tensorflow-xla-runtime recipe to link with libfft_wrapper" This reverts commit cd38c1d. * Changes from review * Update tensorflow-xla-runtime.spec * Update tensorflow-xla-runtime.spec * Update tensorflow-xla-runtime.spec * Try packing libfft* into wheel * Update tensroflow-xla-runtime recipe * Update tensorflow-sources.spec * Remove relocation for missing files * [TF][el7]: patch to avoid undeclared va_list * Fix optree recipe * Update tensorflow-sources.file --------- Co-authored-by: Ivan Razumov <[email protected]> Co-authored-by: Ivan Razumov <[email protected]>
1 parent 1778186 commit 97a574b

11 files changed

+53
-29
lines changed

abseil-cpp.spec

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
### RPM external abseil-cpp 20230125.3
1+
### RPM external abseil-cpp 20230802.2
22
## INCLUDE cpp-standard
33

44
Source: https://github.com/abseil/abseil-cpp/archive/%{realversion}.tar.gz
55
Source2: https://patch-diff.githubusercontent.com/raw/abseil/abseil-cpp/pull/1732.diff
6+
67
BuildRequires: cmake gmake
78

89
%prep

bazel-absl.patch

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ index b896f1b..0646f73 100755
88
"com_google_absl": {
99
- "archive": "20211102.0.tar.gz",
1010
- "sha256": "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4",
11-
+ "archive": "20230125.3.tar.gz",
12-
+ "sha256": "5366d7e7fa7ba0d915014d387b66d0d002c03236448e1ba9ef98122c13b35c36",
11+
+ "archive": "20230802.2.tar.gz",
12+
+ "sha256": "7c11539617af1f332f0854a6fb21e296a1b29c27d03f23c7b49d4adefcd102cc",
1313
"urls": [
1414
- "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
1515
- "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
16-
+ "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20230125.3.tar.gz",
17-
+ "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230125.3.tar.gz",
16+
+ "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20230802.2.tar.gz",
17+
+ "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.2.tar.gz",
1818
],
1919
"used_in": [
2020
"additional_distfiles",
2121
"test_WORKSPACE_files",
2222
],
2323
- "strip_prefix": "abseil-cpp-20211102.0",
24-
+ "strip_prefix": "abseil-cpp-20230125.3",
24+
+ "strip_prefix": "abseil-cpp-20230802.2",
2525
},
2626
"zstd-jni": {
2727
"archive": "v1.5.2-3.zip",

pip/blosc2.file

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
Requires: py3-scikit-build py3-cython py3-numpy py3-msgpack py3-ndindex py3-py-cpuinfo py3-rich
22
BuildRequires: cmake ninja
3-
4-
%define PipPostPost \
5-
%{relocateConfig}lib64/pkgconfig/blosc2.pc

pip/keras.file

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
%define PipDownloadSourceType none
22
Requires: py3-PyYAML py3-six
33
Requires: py3-h5py py3-keras-applications py3-keras-preprocessing
4+
Requires: py3-absl-py py3-ml_dtypes py3-namex py3-optree py3-rich

pip/numpy.file

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
BuildRequires: py3-meson-python
12
Requires: py3-cython
23
Requires: zlib OpenBLAS
34

@@ -28,8 +29,6 @@ EOF
2829
ln -s ${numpy_core} %{i}/c-api/core
2930

3031
%define PipPostPost \
31-
%{relocateConfig}lib/python*/site-packages/numpy/__config__.py \
32-
%{relocateConfig}lib/python*/site-packages/numpy/distutils/__config__.py \
33-
%{relocateConfig}lib/python*/site-packages/numpy/distutils/site.cfg
32+
%{relocateConfig}lib/python*/site-packages/numpy/__config__.py
3433

3534
%define PipPostBuildPy rm -f %{i}/bin/f2py

pip/optree.file

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BuildRequires: cmake
2+
Requires: py3-typing-extensions

pip/requirements.txt

+11-11
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ beautifulsoup4==4.12.3
4545
beniget==0.4.1
4646
bleach==6.1.0
4747
# NO_AUTO_UPDATE: needs Python 3.10
48-
blosc2==2.2.0
48+
blosc2==2.5.1
4949
bokeh==3.4.1
5050
boost-histogram==1.4.1
5151
bottle==0.12.25
@@ -84,7 +84,7 @@ cryptography==42.0.5
8484
cx-Oracle==8.3.0
8585
cycler==0.12.1
8686
# NO_AUTO_UPDATE: numpy 1.24.3 doesn't support cython 3.x
87-
cython==0.29.35
87+
cython==3.0.10
8888
dask==2024.4.2
8989
dask-awkward==2024.3.0
9090
decorator==5.1.1
@@ -185,8 +185,7 @@ jupyter-server-mathjax==0.2.6
185185
jupyter-server-terminals==0.5.3
186186
jupyterlab==4.1.8
187187
jupyterlab-widgets==3.0.10
188-
#NO_AUTO_UPDATE: needs newer TF
189-
keras==2.15.0
188+
keras==3.5.0
190189
keras-applications==1.0.8
191190
keras-preprocessing==1.1.2
192191
keras2onnx==1.7.0
@@ -224,6 +223,7 @@ mplhep-data==0.0.3
224223
mpmath==1.3.0
225224
msgpack==1.0.8
226225
multidict==6.0.5
226+
namex==0.0.8
227227
nbclassic==1.0.0
228228
nbclient==0.10.0
229229
nbconvert==7.16.4
@@ -244,12 +244,13 @@ nvidia-ml-py==12.550.52
244244
numexpr==2.8.4
245245
# setuptools version <64 is needed by numpy: https://github.com/pypa/setuptools/issues/3549
246246
# NO_AUTO_UPDATE: update together with tensorflow
247-
numpy==1.24.3
247+
numpy==1.26.4
248248
# NO_AUTO_UPDATE:1
249249
onnx==1.16.0
250250
onnxmltools==1.12.0
251251
onnxconverter-common==1.14.0
252252
oauthlib==3.2.2
253+
optree==0.12.1
253254
opt-einsum==3.3.0
254255
pkginfo==1.10.0
255256
packaging==24.0
@@ -349,7 +350,7 @@ scikit-build==0.16.7
349350
scikit-build-core==0.9.3
350351
scikit-learn==1.2.2
351352
scinum==2.1.0
352-
scipy==1.10.0
353+
scipy==1.12.0
353354
secretstorage==3.3.3
354355
semantic-version==2.10.0
355356
threadpoolctl==3.5.0
@@ -371,14 +372,13 @@ stack-data==0.6.3
371372
stevedore==5.2.0
372373
subprocess32==3.5.4
373374
sympy==1.12
374-
# NO_AUTO_UPDATE: Needs newer blosc2
375-
tables==3.8.0
375+
tables==3.9.0
376376
tblib==1.7.0
377377
tabulate==0.9.0
378378
tenacity==8.2.3
379-
#NO_AUTO_UPDATE:1: Force to use tensorflow 2.15x; this should match the version in tensorflow-sources.spec
380-
tensorflow==2.15.0
381-
tensorboard==2.16.2
379+
#NO_AUTO_UPDATE:1: Force to use tensorflow 2.16.1; this should match the version in tensorflow-sources.spec
380+
tensorflow==2.16.1
381+
tensorboard==2.17.0
382382
tensorflow-io-gcs-filesystem==0.37.0
383383
tensorflow-estimator==2.15.0
384384
tensorboard-data-server==0.7.2

tensorflow-sources.file

+22-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ Source: git+https://github.com/%{github_user}/tensorflow.git?obj=%{branch}/%{tag
3636
%setup -q -n tensorflow-%{realversion}
3737
sed -i -e 's|lib/python[^/]*/site-packages/|lib/python%{cms_python3_major_minor_version}/site-packages/|' third_party/systemlibs/pybind11.BUILD
3838

39+
#EL7: Include stdarg.h before zlib.h to avoid 'va_list' has not been declared error.
40+
%if 0%{?rhel} == 7
41+
sed -i -e 's|#include <zlib.h>|#include <stdarg.h>\n#include <zlib.h>|' \
42+
third_party/xla/third_party/tsl/tsl/lib/io/zlib_outputbuffer.h \
43+
tensorflow/core/lib/png/png_io.cc
44+
%endif
45+
3946
%build
4047

4148
export PYTHON_BIN_PATH="$(which python3)"
@@ -144,6 +151,8 @@ export PYTHONPATH=$PYTHON3PATH
144151

145152
./configure
146153
# build tensorflow python targets
154+
bazel $BAZEL_OPTS @ducc//:fft
155+
bazel $BAZEL_OPTS @ducc//:fft_wrapper
147156
bazel $BAZEL_OPTS //tensorflow/tools/pip_package:build_pip_package
148157
bazel $BAZEL_OPTS //tensorflow:tensorflow
149158
bazel $BAZEL_OPTS //tensorflow:tensorflow_cc
@@ -180,10 +189,13 @@ mkdir -p $bindir $incdir $libdir
180189

181190
# copy targets
182191
srcdir="$PWD/bazel-bin/tensorflow"
192+
srcdir_ext="$PWD/bazel-bin/external"
183193

184194
cp -p $srcdir/libtensorflow*.so* $libdir/
185195
cp -p $srcdir/compiler/tf2xla/lib*.so* $libdir/
186196

197+
cp -p ${srcdir_ext}/ducc/*.so $libdir/
198+
187199
for l in tensorflow_cc tensorflow_framework tensorflow ; do
188200
# check if the actual lib exists
189201
[ -f $libdir/lib${l}.so.%{tfversion} ] || exit 1
@@ -225,7 +237,7 @@ popd
225237
#FIXME: Create missing externals links
226238
pushd bazel-tensorflow-%{realversion}/external
227239
srcdir=$(dirname $(readlink zlib))
228-
for e in ducc farmhash_gpu_archive stablehlo ; do
240+
for e in ducc farmhash_gpu_archive stablehlo cudnn_frontend_archive ; do
229241
echo "Check external link: $e"
230242
if [ -e ${srcdir}/$e ] ; then
231243
if [ ! -e $e ] ; then
@@ -236,6 +248,14 @@ pushd bazel-tensorflow-%{realversion}/external
236248
done
237249
popd
238250

239-
# create the wheel file that is installed in py2-tensorflow
251+
# create the wheel file that is installed in py3-tensorflow
240252
export PYTHONPATH=$PYTHON3PATH
241253
bash -ex bazel-bin/tensorflow/tools/pip_package/build_pip_package %{i}
254+
255+
mkdir %{i}/lib-xla-runtime
256+
cp $outdir/lib/libfft.so %{i}/lib-xla-runtime
257+
cp $outdir/lib/libfft_wrapper.so %{i}/lib-xla-runtime
258+
find $srcdir/.. -name 'libmutex.pic.a' -path '*k8-opt/bin/external/local_tsl*' -exec cp {} %{i}/lib-xla-runtime \;
259+
find $srcdir/.. -name 'libnsync_cpp.pic.a' -path '*k8-opt*' -exec cp {} %{i}/lib-xla-runtime \;
260+
[ -e %{i}/lib-xla-runtime/libmutex.pic.a ]
261+
[ -e %{i}/lib-xla-runtime/libnsync_cpp.pic.a ]

tensorflow-sources.spec

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
### RPM external tensorflow-sources 2.15.0
2-
%define tag 3f5b9e20a2e5f678f79baffc9c2a59ac554053b2
1+
### RPM external tensorflow-sources 2.16.1
2+
%define tag e21a182cfa2cfbb37125054201c2ccc12076d56b
33
%define branch cms/v%{realversion}
44
%define github_user cms-externals
55
%define build_type opt

tensorflow-xla-runtime.spec

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ Source99: scram-tools.file/tools/eigen/env
88
Patch0: tensorflow-xla-runtime-absl
99

1010
Requires: eigen py3-tensorflow abseil-cpp
11-
BuildRequires: cmake
11+
BuildRequires: cmake tensorflow-sources
1212

1313
%prep
1414

1515
cp -r ${PY3_TENSORFLOW_ROOT}/lib/python%{cms_python3_major_minor_version}/site-packages/tensorflow .
16+
mkdir -p tensorflow/lib
17+
cp ${TENSORFLOW_SOURCES_ROOT}/lib-xla-runtime/* tensorflow/lib/
1618
%patch -p0
1719

1820
%build
@@ -30,11 +32,13 @@ pushd tensorflow/xla_aot_runtime_src
3032
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
3133
-DCMAKE_CXX_STANDARD=%{cms_cxx_standard} \
3234
-DCMAKE_PREFIX_PATH=${ABSEIL_CPP_ROOT} \
35+
-DCMAKE_SHARED_LINKER_FLAGS="-L../lib -lfft -lfft_wrapper -l:libmutex.pic.a -l:libnsync_cpp.pic.a" \
3336
-DBUILD_SHARED_LIBS=ON
3437
make %{makeprocesses}
3538
popd
3639

3740
%install
3841

3942
mkdir -p %{i}/lib
43+
mv tensorflow/lib/libfft*.so %{i}/lib/
4044
mv tensorflow/xla_aot_runtime_src/libtf_xla_runtime.so %{i}/lib/

tensorflow.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### RPM external tensorflow 2.15.0
1+
### RPM external tensorflow 2.16.1
22
%if "%{?vectorized_package:set}" != "set"
33
%define source_package tensorflow-sources
44
%else

0 commit comments

Comments
 (0)