[packages/tensorflow] - initial, not finished, just saving work; bazel tends to take one of the top places in distro-unf

qboosh qboosh at pld-linux.org
Sat Feb 1 08:15:47 CET 2020


commit 82d5430173c09d659191b776f400ae30671e4f45
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat Feb 1 08:15:58 2020 +0100

    - initial, not finished, just saving work;
      bazel tends to take one of the top places in distro-unfriendly build tool competition

 tensorflow-bazel.patch |  87 +++++++++++++++++++++++++++++++++
 tensorflow.spec        | 127 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 214 insertions(+)
---
diff --git a/tensorflow.spec b/tensorflow.spec
new file mode 100644
index 0000000..bc4d84d
--- /dev/null
+++ b/tensorflow.spec
@@ -0,0 +1,127 @@
+# TODO:
+# - mkl_dnn only on %{x8664}
+# - use system libs
+# - fix install and packaging
+#
+# Conditional build:
+%bcond_without	static_libs	# static library
+#
+Summary:	Open source library for numerical computation using data flow graphs
+Summary(pl.UTF-8):	Mająca otwarte źródła biblioteka do obliczeń numerycznych przy użyciu grafów przepływu danych
+Name:		tensorflow
+Version:	2.0.0
+Release:	1
+License:	Apache v2.0
+Group:		Libraries
+#Source0Download: https://github.com/tensorflow/tensorflow/releases
+Source0:	https://github.com/tensorflow/tensorflow/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5:	86319b28bc9d0dc07685e09fcc79172e
+Patch0:		%{name}-bazel.patch
+URL:		https://tensorflow.org/
+BuildRequires:	bazel
+BuildRequires:	python3-devel >= 1:3.2
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+TensorFlow is an open source software library for numerical
+computation using data flow graphs. The graph nodes represent
+mathematical operations, while the graph edges represent the
+multidimensional data arrays (tensors) that flow between them. This
+flexible architecture enables you to deploy computation to one or more
+CPUs or GPUs in a desktop, server, or mobile device without rewriting
+code. TensorFlow also includes TensorBoard data visualization toolkit:
+<https://github.com/tensorflow/tensorboard>.
+
+%description -l pl.UTF-8
+TensorFlow to mająca otwarte źródła biblioteka do obliczeń
+numerycznych przy użyciu grafów przepływu danych. Węzeł grafu
+reprezentuje działania matematyczne, a krawędzie grafu reprezentują
+wielowymiarowe tablice danych (tensory) przepływające między nimi. Ta
+elastyczna architektura pozwala uruchamiać obliczenia na jednym lub
+większej liczbie CPU lub GPU komputera osobistego, serwera lub
+urządzenia przenośnego bez przepisywania kodu. TensorFlow zawiera
+także narzędzia do wizualizacji danych TensorBoard:
+<https://github.com/tensorflow/tensorboard>.
+
+%package devel
+Summary:	Header files for TensorFlow library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki TensorFlow
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description devel
+Header files for TensorFlow library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki TensorFlow.
+
+%package static
+Summary:	Static TensorFlow library
+Summary(pl.UTF-8):	Statyczna biblioteka TensorFlow
+Group:		Development/Libraries
+Requires:	%{name}-devel = %{version}-%{release}
+
+%description static
+Static TensorFlow library.
+
+%description static -l pl.UTF-8
+Statyczna biblioteka TensorFlow.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%build
+# choose one:
+# - OpenCL SYCL: TF_NEED_OPENCL_SYCL=1 TF_NEED_COMPUTECPP=1?
+# - ROCm: TF_NEED_ROCM=1
+# - CUDA: TF_NEED_CUDA=1 TF_NEED_TENSORRT=1?
+# MPI: TF_NEED+MPI=1
+CC_OPT_FLAGS="%{rpmcflags}" \
+HOST_C_COMPILER="%{__cc}" \
+HOST_CXX_COMPILER="%{__cxx}" \
+PYTHON_BIN_PATH="%{__python3}" \
+PYTHON_LIB_PATH="%{py3_sitedir}" \
+TF_DOWNLOAD_CLANG=0 \
+TF_ENABLE_XLA=1 \
+TF_NEED_CUDA=0 \
+TF_NEED_MPI=0 \
+TF_NEED_OPENCL_SYCL=0 \
+TF_NEED_ROCM=0 \
+TF_SET_ANDROID_WORKSPACE=0 \
+%{__python3} configure.py
+
+bazel build //tensorflow \
+%ifnarch %{x8664}
+	--config=mkl=false
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+# FIXME: not make
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	-p /sbin/ldconfig
+%postun	-p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc ACKNOWLEDGMENTS ADOPTERS.md AUTHORS ISSUES.md ISSUE_TEMPLATE.md README.md RELEASE.md SECURITY.md
+%attr(755,root,root) %{_libdir}/libtensorflow.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libtensorflow.so.N
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libtensorflow.so
+%{_includedir}/tensorflow
+
+%if %{with static_libs}
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libtensorflow.a
+%endif
diff --git a/tensorflow-bazel.patch b/tensorflow-bazel.patch
new file mode 100644
index 0000000..3c7fad8
--- /dev/null
+++ b/tensorflow-bazel.patch
@@ -0,0 +1,87 @@
+--- tensorflow-2.0.0/configure.py.orig	2019-12-14 21:12:55.692079992 +0100
++++ tensorflow-2.0.0/configure.py	2019-12-14 21:13:04.498698949 +0100
+@@ -50,7 +50,7 @@
+ _TF_BAZELRC = ''
+ _TF_CURRENT_BAZEL_VERSION = None
+ _TF_MIN_BAZEL_VERSION = '0.24.1'
+-_TF_MAX_BAZEL_VERSION = '0.26.1'
++_TF_MAX_BAZEL_VERSION = '2.0.0'
+ 
+ NCCL_LIB_PATHS = [
+     'lib64/', 'lib/powerpc64le-linux-gnu/', 'lib/x86_64-linux-gnu/', ''
+--- tensorflow-2.0.0/third_party/jpeg/BUILD.bazel.orig	2019-09-27 23:56:33.000000000 +0200
++++ tensorflow-2.0.0/third_party/jpeg/BUILD.bazel	2019-12-23 20:30:08.993364429 +0100
+@@ -7,8 +7,6 @@
+ 
+ load("@org_tensorflow//third_party:common.bzl", "template_rule")
+ 
+-libjpegturbo_nocopts = "-[W]error"
+-
+ WIN_COPTS = [
+     "/Ox",
+     "-DWITH_SIMD",
+@@ -120,7 +118,6 @@
+         "jstdhuff.c",  # should have been named .inc
+     ],
+     copts = libjpegturbo_copts,
+-    nocopts = libjpegturbo_nocopts,
+     visibility = ["//visibility:public"],
+     deps = select({
+         ":k8": [":simd_x86_64"],
+@@ -168,7 +165,6 @@
+         "simd/powerpc/jsimd_altivec.h",
+     ],
+     copts = libjpegturbo_copts,
+-    nocopts = libjpegturbo_nocopts,
+ )
+ 
+ cc_library(
+@@ -217,7 +213,6 @@
+     ],
+     copts = libjpegturbo_copts,
+     linkstatic = 1,
+-    nocopts = libjpegturbo_nocopts,
+ )
+ 
+ genrule(
+@@ -327,7 +322,6 @@
+         "simd/jsimd.h",
+     ],
+     copts = libjpegturbo_copts,
+-    nocopts = libjpegturbo_nocopts,
+ )
+ 
+ cc_library(
+@@ -348,7 +342,6 @@
+         "simd/jsimd.h",
+     ],
+     copts = libjpegturbo_copts,
+-    nocopts = libjpegturbo_nocopts,
+ )
+ 
+ cc_library(
+@@ -501,7 +494,6 @@
+         "jsimddct.h",
+     ],
+     copts = libjpegturbo_copts,
+-    nocopts = libjpegturbo_nocopts,
+ )
+ 
+ template_rule(
+--- third_party/mkl_dnn/mkldnn.BUILD.orig	2019-09-27 23:56:33.000000000 +0200
++++ third_party/mkl_dnn/mkldnn.BUILD	2019-12-24 08:25:22.367549411 +0100
+@@ -91,7 +91,6 @@
+         "src/cpu/gemm",
+         "src/cpu/xbyak",
+     ],
+-    nocopts = "-fno-exceptions",
+     visibility = ["//visibility:public"],
+     deps = select({
+         "@org_tensorflow//tensorflow:linux_x86_64": [
+@@ -134,6 +133,5 @@
+         "src/cpu/gemm",
+         "src/cpu/xbyak",
+     ],
+-    nocopts = "-fno-exceptions",
+     visibility = ["//visibility:public"],
+ )
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/tensorflow.git/commitdiff/82d5430173c09d659191b776f400ae30671e4f45



More information about the pld-cvs-commit mailing list