[arch-commits] Commit in tensorflow/repos (4 files)

Lukas Fleischer lfleischer at archlinux.org
Thu Dec 12 03:12:33 UTC 2019


    Date: Thursday, December 12, 2019 @ 03:12:33
  Author: lfleischer
Revision: 537159

db-move: moved tensorflow from [community-staging] to [community-testing] (x86_64)

Added:
  tensorflow/repos/community-testing-x86_64/
  tensorflow/repos/community-testing-x86_64/Add-grpc-fix-for-gettid.patch
    (from rev 537158, tensorflow/repos/community-staging-x86_64/Add-grpc-fix-for-gettid.patch)
  tensorflow/repos/community-testing-x86_64/PKGBUILD
    (from rev 537158, tensorflow/repos/community-staging-x86_64/PKGBUILD)
Deleted:
  tensorflow/repos/community-staging-x86_64/

-------------------------------+
 Add-grpc-fix-for-gettid.patch |  113 +++++++++++++++++
 PKGBUILD                      |  253 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 366 insertions(+)

Copied: tensorflow/repos/community-testing-x86_64/Add-grpc-fix-for-gettid.patch (from rev 537158, tensorflow/repos/community-staging-x86_64/Add-grpc-fix-for-gettid.patch)
===================================================================
--- community-testing-x86_64/Add-grpc-fix-for-gettid.patch	                        (rev 0)
+++ community-testing-x86_64/Add-grpc-fix-for-gettid.patch	2019-12-12 03:12:33 UTC (rev 537159)
@@ -0,0 +1,113 @@
+From e50d1fa554154b7e398ef7a0357f646e22cd51cf Mon Sep 17 00:00:00 2001
+From: Jianjun Liu <jianjun.liu at intel.com>
+Date: Thu, 29 Aug 2019 14:56:13 +0800
+Subject: [PATCH] Add grpc fix for gettid
+
+Add gettid fix on gettid conflict because of glibc
+
+Signed-off-by: Jianjun Liu <jianjun.liu at intel.com>
+---
+ tensorflow/workspace.bzl                  |  1 +
+ third_party/Rename-gettid-functions.patch | 78 +++++++++++++++++++++++
+ 2 files changed, 79 insertions(+)
+ create mode 100644 third_party/Rename-gettid-functions.patch
+
+diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
+index 55d7eb93..33e86087 100755
+--- a/tensorflow/workspace.bzl
++++ b/tensorflow/workspace.bzl
+@@ -486,6 +486,7 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
+     # WARNING: make sure ncteisen@ and vpai@ are cc-ed on any CL to change the below rule
+     tf_http_archive(
+         name = "grpc",
++	patch_file = clean_dep("//third_party:Rename-gettid-functions.patch"),
+         sha256 = "67a6c26db56f345f7cee846e681db2c23f919eba46dd639b09462d1b6203d28c",
+         strip_prefix = "grpc-4566c2a29ebec0835643b972eb99f4306c4234a3",
+         system_build_file = clean_dep("//third_party/systemlibs:grpc.BUILD"),
+diff --git a/third_party/Rename-gettid-functions.patch b/third_party/Rename-gettid-functions.patch
+new file mode 100644
+index 00000000..90bd9115
+--- /dev/null
++++ b/third_party/Rename-gettid-functions.patch
+@@ -0,0 +1,78 @@
++From d1d017390b799c59d6fdf7b8afa6136d218bdd61 Mon Sep 17 00:00:00 2001
++From: Benjamin Peterson <benjamin at dropbox.com>
++Date: Fri, 3 May 2019 08:11:00 -0700
++Subject: [PATCH] Rename gettid() functions.
++
++glibc 2.30 will declare its own gettid; see https://sourceware.org/git/?p=glibc.git;a=commit;h=1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92. Rename the grpc versions to avoid naming conflicts.
++---
++ src/core/lib/gpr/log_linux.cc          | 4 ++--
++ src/core/lib/gpr/log_posix.cc          | 4 ++--
++ src/core/lib/iomgr/ev_epollex_linux.cc | 4 ++--
++ 3 files changed, 6 insertions(+), 6 deletions(-)
++
++diff --git a/src/core/lib/gpr/log_linux.cc b/src/core/lib/gpr/log_linux.cc
++index 561276f0c20..8b597b4cf2f 100644
++--- a/src/core/lib/gpr/log_linux.cc
+++++ b/src/core/lib/gpr/log_linux.cc
++@@ -40,7 +40,7 @@
++ #include <time.h>
++ #include <unistd.h>
++ 
++-static long gettid(void) { return syscall(__NR_gettid); }
+++static long sys_gettid(void) { return syscall(__NR_gettid); }
++ 
++ void gpr_log(const char* file, int line, gpr_log_severity severity,
++              const char* format, ...) {
++@@ -70,7 +70,7 @@ void gpr_default_log(gpr_log_func_args* args) {
++   gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
++   struct tm tm;
++   static __thread long tid = 0;
++-  if (tid == 0) tid = gettid();
+++  if (tid == 0) tid = sys_gettid();
++ 
++   timer = static_cast<time_t>(now.tv_sec);
++   final_slash = strrchr(args->file, '/');
++diff --git a/src/core/lib/gpr/log_posix.cc b/src/core/lib/gpr/log_posix.cc
++index b6edc14ab6b..2f7c6ce3760 100644
++--- a/src/core/lib/gpr/log_posix.cc
+++++ b/src/core/lib/gpr/log_posix.cc
++@@ -31,7 +31,7 @@
++ #include <string.h>
++ #include <time.h>
++ 
++-static intptr_t gettid(void) { return (intptr_t)pthread_self(); }
+++static intptr_t sys_gettid(void) { return (intptr_t)pthread_self(); }
++ 
++ void gpr_log(const char* file, int line, gpr_log_severity severity,
++              const char* format, ...) {
++@@ -86,7 +86,7 @@ void gpr_default_log(gpr_log_func_args* args) {
++   char* prefix;
++   gpr_asprintf(&prefix, "%s%s.%09d %7" PRIdPTR " %s:%d]",
++                gpr_log_severity_string(args->severity), time_buffer,
++-               (int)(now.tv_nsec), gettid(), display_file, args->line);
+++               (int)(now.tv_nsec), sys_gettid(), display_file, args->line);
++ 
++   fprintf(stderr, "%-70s %s\n", prefix, args->message);
++   gpr_free(prefix);
++diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc
++index 08116b3ab53..76f59844312 100644
++--- a/src/core/lib/iomgr/ev_epollex_linux.cc
+++++ b/src/core/lib/iomgr/ev_epollex_linux.cc
++@@ -1102,7 +1102,7 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
++ }
++ 
++ #ifndef NDEBUG
++-static long gettid(void) { return syscall(__NR_gettid); }
+++static long sys_gettid(void) { return syscall(__NR_gettid); }
++ #endif
++ 
++ /* pollset->mu lock must be held by the caller before calling this.
++@@ -1122,7 +1122,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
++ #define WORKER_PTR (&worker)
++ #endif
++ #ifndef NDEBUG
++-  WORKER_PTR->originator = gettid();
+++  WORKER_PTR->originator = sys_gettid();
++ #endif
++   if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
++     gpr_log(GPR_INFO,
+-- 
+2.22.0
+

Copied: tensorflow/repos/community-testing-x86_64/PKGBUILD (from rev 537158, tensorflow/repos/community-staging-x86_64/PKGBUILD)
===================================================================
--- community-testing-x86_64/PKGBUILD	                        (rev 0)
+++ community-testing-x86_64/PKGBUILD	2019-12-12 03:12:33 UTC (rev 537159)
@@ -0,0 +1,253 @@
+# Maintainer: Sven-Hendrik Haase <svenstaro at gmail.com>
+# Maintainer: Konstantin Gizdov (kgizdov) <arch at kge.pw>
+# Contributor: Adria Arrufat (archdria) <adria.arrufat+AUR at protonmail.ch>
+# Contributor: Thibault Lorrain (fredszaq) <fredszaq at gmail.com>
+
+pkgbase=tensorflow
+pkgname=(tensorflow tensorflow-opt tensorflow-cuda tensorflow-opt-cuda python-tensorflow python-tensorflow-opt python-tensorflow-cuda python-tensorflow-opt-cuda)
+pkgver=2.1.0rc0
+_pkgver=2.1.0-rc0
+pkgrel=2
+pkgdesc="Library for computation using data flow graphs for scalable machine learning"
+url="https://www.tensorflow.org/"
+license=('APACHE')
+arch=('x86_64')
+depends=('c-ares')
+makedepends=('bazel' 'python-numpy' 'cuda' 'nvidia-utils' 'nccl' 'git' 'gcc'
+             'cudnn' 'python-pip' 'python-wheel' 'python-setuptools' 'python-h5py'
+             'python-keras-applications' 'python-keras-preprocessing')
+optdepends=('tensorboard: Tensorflow visualization toolkit'
+            'python-pasta: tf_upgrade_v2 tool')
+source=("https://github.com/tensorflow/tensorflow/archive/v${_pkgver}.tar.gz"
+        Add-grpc-fix-for-gettid.patch)
+sha512sums=('1481af1ed43ff03f6a0eeaad9896e2ec021d763bc69bf03e33353d6188074fdfaa1b6c3bba1d4e2496207f468e6a555fe2c962ae15eddd30ef872a3d76e19911'
+            '64442ef4cf0527cc321b7425273fd998c8e961af0ffbf1bb0a401cdd9237e95cdcebd8c18416e02a5225fabfd53cf0b694a3486791fffbc3e472a8ffaa4b28ff')
+
+get_pyver () {
+  python -c 'import sys; print(str(sys.version_info[0]) + "." + str(sys.version_info[1]))'
+}
+
+prepare() {
+  patch -Np1 -d tensorflow-${_pkgver} -i "$srcdir"/Add-grpc-fix-for-gettid.patch
+
+  cp -r tensorflow-${_pkgver} tensorflow-${_pkgver}-opt
+  cp -r tensorflow-${_pkgver} tensorflow-${_pkgver}-cuda
+  cp -r tensorflow-${_pkgver} tensorflow-${_pkgver}-opt-cuda
+
+  # These environment variables influence the behavior of the configure call below.
+  export PYTHON_BIN_PATH=/usr/bin/python
+  export USE_DEFAULT_PYTHON_LIB_PATH=1
+  export TF_NEED_JEMALLOC=1
+  export TF_NEED_KAFKA=0
+  export TF_NEED_OPENCL_SYCL=0
+  export TF_NEED_AWS=0
+  export TF_NEED_GCP=0
+  export TF_NEED_HDFS=0
+  export TF_NEED_S3=0
+  export TF_ENABLE_XLA=1
+  export TF_NEED_GDR=0
+  export TF_NEED_VERBS=0
+  export TF_NEED_OPENCL=0
+  export TF_NEED_MPI=0
+  export TF_NEED_TENSORRT=0
+  export TF_NEED_NGRAPH=0
+  export TF_NEED_IGNITE=0
+  export TF_NEED_ROCM=0
+  export TF_SET_ANDROID_WORKSPACE=0
+  export TF_DOWNLOAD_CLANG=0
+  export TF_NCCL_VERSION=2.5
+  export TF_IGNORE_MAX_BAZEL_VERSION=1
+  export NCCL_INSTALL_PATH=/usr
+  export GCC_HOST_COMPILER_PATH=/usr/bin/gcc-8
+  export HOST_CXX_COMPILER_PATH=/usr/bin/gcc-8
+  export TF_CUDA_CLANG=0  # Clang currently disabled because it's not compatible at the moment.
+  export CLANG_CUDA_COMPILER_PATH=/usr/bin/clang
+  export TF_CUDA_PATHS=/opt/cuda,/usr/lib,/usr
+  export TF_CUDA_VERSION=$(/opt/cuda/bin/nvcc --version | sed -n 's/^.*release \(.*\),.*/\1/p')
+  export TF_CUDNN_VERSION=$(sed -n 's/^#define CUDNN_MAJOR\s*\(.*\).*/\1/p' /usr/include/cudnn.h)
+  export TF_CUDA_COMPUTE_CAPABILITIES=3.5,3.7,5.0,5.2,5.3,6.0,6.1,6.2,7.0,7.2,7.5
+}
+
+build() {
+  echo "Building without cuda and without non-x86-64 optimizations"
+  cd "${srcdir}"/tensorflow-${_pkgver}
+  export CC_OPT_FLAGS="-march=x86-64"
+  export TF_NEED_CUDA=0
+  ./configure
+  bazel \
+    build --config=opt \
+      //tensorflow:libtensorflow.so \
+      //tensorflow:libtensorflow_cc.so \
+      //tensorflow:install_headers \
+      //tensorflow/tools/pip_package:build_pip_package
+  bazel-bin/tensorflow/tools/pip_package/build_pip_package "${srcdir}"/tmp
+
+
+  echo "Building without cuda and with non-x86-64 optimizations"
+  cd "${srcdir}"/tensorflow-${_pkgver}-opt
+  export CC_OPT_FLAGS="-march=haswell"
+  export TF_NEED_CUDA=0
+  ./configure
+  bazel \
+    build --config=opt \
+      //tensorflow:libtensorflow.so \
+      //tensorflow:libtensorflow_cc.so \
+      //tensorflow:install_headers \
+      //tensorflow/tools/pip_package:build_pip_package
+  bazel-bin/tensorflow/tools/pip_package/build_pip_package "${srcdir}"/tmpopt
+
+
+  echo "Building with cuda and without non-x86-64 optimizations"
+  cd "${srcdir}"/tensorflow-${_pkgver}-cuda
+  export CC_OPT_FLAGS="-march=x86-64"
+  export TF_NEED_CUDA=1
+  ./configure
+  bazel \
+    build --config=opt \
+      //tensorflow:libtensorflow.so \
+      //tensorflow:libtensorflow_cc.so \
+      //tensorflow:install_headers \
+      //tensorflow/tools/pip_package:build_pip_package
+  bazel-bin/tensorflow/tools/pip_package/build_pip_package "${srcdir}"/tmpcuda
+
+
+  echo "Building with cuda and without non-x86-64 optimizations"
+  cd "${srcdir}"/tensorflow-${_pkgver}-opt-cuda
+  export CC_OPT_FLAGS="-march=haswell"
+  export TF_NEED_CUDA=1
+  export TF_CUDA_CLANG=0
+  ./configure
+  bazel \
+    build --config=opt \
+      //tensorflow:libtensorflow.so \
+      //tensorflow:libtensorflow_cc.so \
+      //tensorflow:install_headers \
+      //tensorflow/tools/pip_package:build_pip_package
+  bazel-bin/tensorflow/tools/pip_package/build_pip_package "${srcdir}"/tmpoptcuda
+}
+
+_package() {
+  # install headers first
+  install -d "${pkgdir}"/usr/include/tensorflow
+  cp -r bazel-bin/tensorflow/include/* "${pkgdir}"/usr/include/tensorflow/
+  # install python-version to get all extra headers
+  WHEEL_PACKAGE=$(find "${srcdir}"/$1 -name "tensor*.whl")
+  pip install --ignore-installed --upgrade --root "${pkgdir}"/ $WHEEL_PACKAGE --no-dependencies
+  # move extra headers to correct location
+  find "${pkgdir}/usr/lib/python$(get_pyver)"/site-packages/tensorflow/include -maxdepth 1 -mindepth 1 -type d -print0 | while read -rd $'\0' _folder; do
+    cp -nr "${_folder}" "${pkgdir}"/usr/include/tensorflow/
+  done
+  # clean up unneeded files
+  rm -rf "${pkgdir}"/usr/bin
+  rm -rf "${pkgdir}"/usr/lib
+  rm -rf "${pkgdir}"/usr/share
+
+  # install the rest of tensorflow
+  tensorflow/c/generate-pc.sh --prefix=/usr --version=${pkgver}
+  sed -e 's@/include$@/include/tensorflow@' -i tensorflow.pc -i tensorflow_cc.pc
+  install -Dm644 tensorflow.pc "${pkgdir}"/usr/lib/pkgconfig/tensorflow.pc
+  install -Dm644 tensorflow_cc.pc "${pkgdir}"/usr/lib/pkgconfig/tensorflow_cc.pc
+  install -Dm755 bazel-bin/tensorflow/libtensorflow.so "${pkgdir}"/usr/lib/libtensorflow.so.${pkgver}
+  ln -s libtensorflow.so.${pkgver} "${pkgdir}"/usr/lib/libtensorflow.so.${pkgver:0:1}
+  ln -s libtensorflow.so.${pkgver:0:1} "${pkgdir}"/usr/lib/libtensorflow.so
+  install -Dm755 bazel-bin/tensorflow/libtensorflow_cc.so "${pkgdir}"/usr/lib/libtensorflow_cc.so.${pkgver}
+  ln -s libtensorflow_cc.so.${pkgver} "${pkgdir}"/usr/lib/libtensorflow_cc.so.${pkgver:0:1}
+  ln -s libtensorflow_cc.so.${pkgver:0:1} "${pkgdir}"/usr/lib/libtensorflow_cc.so
+  install -Dm755 bazel-bin/tensorflow/libtensorflow_framework.so "${pkgdir}"/usr/lib/libtensorflow_framework.so.${pkgver}
+  ln -s libtensorflow_framework.so.${pkgver} "${pkgdir}"/usr/lib/libtensorflow_framework.so.${pkgver:0:1}
+  ln -s libtensorflow_framework.so.${pkgver:0:1} "${pkgdir}"/usr/lib/libtensorflow_framework.so
+  install -Dm644 tensorflow/c/c_api.h "${pkgdir}"/usr/include/tensorflow/tensorflow/c/c_api.h
+  install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
+}
+
+_python_package() {
+  WHEEL_PACKAGE=$(find "${srcdir}"/$1 -name "tensor*.whl")
+  pip install --ignore-installed --upgrade --root "${pkgdir}"/ $WHEEL_PACKAGE --no-dependencies
+
+  # create symlinks to headers
+  find "${pkgdir}/usr/lib/python$(get_pyver)"/site-packages/tensorflow/include/ -maxdepth 1 -mindepth 1 -type d -print0 | while read -rd $'\0' _folder; do
+    rm -rf "${_folder}"
+    _smlink="$(basename "${_folder}")"
+    ln -s /usr/include/tensorflow/"${_smlink}" "${pkgdir}/usr/lib/python$(get_pyver)"/site-packages/tensorflow/include/
+  done
+
+  # tensorboard has been separated from upstream but they still install it with
+  # tensorflow. I don't know what kind of sense that makes but we have to clean
+  # it out from this pacakge.
+  rm -rf "${pkgdir}"/usr/bin/tensorboard
+
+  install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
+}
+
+package_tensorflow() {
+  cd "${srcdir}"/tensorflow-${_pkgver}
+  _package tmp
+}
+
+package_tensorflow-opt() {
+  pkgdesc="Library for computation using data flow graphs for scalable machine learning (with CPU optimizations)"
+  conflicts=(tensorflow)
+  provides=(tensorflow)
+
+  cd "${srcdir}"/tensorflow-${_pkgver}-opt
+  _package tmpopt
+}
+
+package_tensorflow-cuda() {
+  pkgdesc="Library for computation using data flow graphs for scalable machine learning (with CUDA)"
+  depends+=(cuda cudnn nccl)
+  conflicts=(tensorflow)
+  provides=(tensorflow)
+
+  cd "${srcdir}"/tensorflow-${_pkgver}-cuda
+  _package tmpcuda
+}
+
+package_tensorflow-opt-cuda() {
+  pkgdesc="Library for computation using data flow graphs for scalable machine learning (with CUDA and CPU optimizations)"
+  depends+=(cuda cudnn nccl)
+  conflicts=(tensorflow)
+  provides=(tensorflow tensorflow-cuda)
+
+  cd "${srcdir}"/tensorflow-${_pkgver}-opt-cuda
+  _package tmpoptcuda
+}
+
+package_python-tensorflow() {
+  depends+=(tensorflow python-termcolor python-astor python-gast02 python-numpy python-protobuf absl-py python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator)
+
+  cd "${srcdir}"/tensorflow-${_pkgver}
+  _python_package tmp
+}
+
+package_python-tensorflow-opt() {
+  pkgdesc="Library for computation using data flow graphs for scalable machine learning (with CPU optimizations)"
+  depends+=(tensorflow-opt python-termcolor python-astor python-gast02 python-numpy python-protobuf absl-py python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator)
+  conflicts=(python-tensorflow)
+  provides=(python-tensorflow)
+
+  cd "${srcdir}"/tensorflow-${_pkgver}-opt
+  _python_package tmpopt
+}
+
+package_python-tensorflow-cuda() {
+  pkgdesc="Library for computation using data flow graphs for scalable machine learning (with CUDA)"
+  depends+=(tensorflow-cuda python-termcolor python-astor python-gast02 python-numpy cuda cudnn python-pycuda python-protobuf absl-py nccl python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator)
+  conflicts=(python-tensorflow)
+  provides=(python-tensorflow)
+
+  cd "${srcdir}"/tensorflow-${_pkgver}-cuda
+  _python_package tmpcuda
+}
+
+package_python-tensorflow-opt-cuda() {
+  pkgdesc="Library for computation using data flow graphs for scalable machine learning (with CUDA and CPU optimizations)"
+  depends+=(tensorflow-opt-cuda python-termcolor python-astor python-gast02 python-numpy cuda cudnn python-pycuda python-protobuf absl-py nccl python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator)
+  conflicts=(python-tensorflow)
+  provides=(python-tensorflow python-tensorflow-cuda)
+
+  cd "${srcdir}"/tensorflow-${_pkgver}-opt-cuda
+  _python_package tmpoptcuda
+}
+
+# vim:set ts=2 sw=2 et:


More information about the arch-commits mailing list