Date: Thursday, September 10, 2020 @ 20:33:49 Author: svenstaro Revision: 702334
archrelease: copy trunk to community-x86_64 Added: tensorflow/repos/community-x86_64/PKGBUILD (from rev 702333, tensorflow/trunk/PKGBUILD) tensorflow/repos/community-x86_64/build-against-actual-mkl.patch (from rev 702333, tensorflow/trunk/build-against-actual-mkl.patch) Deleted: tensorflow/repos/community-x86_64/PKGBUILD tensorflow/repos/community-x86_64/build-against-actual-mkl.patch --------------------------------+ PKGBUILD | 584 +++++++++++++++++++-------------------- build-against-actual-mkl.patch | 74 ++-- 2 files changed, 329 insertions(+), 329 deletions(-) Deleted: PKGBUILD =================================================================== --- PKGBUILD 2020-09-10 20:33:28 UTC (rev 702333) +++ PKGBUILD 2020-09-10 20:33:49 UTC (rev 702334) @@ -1,292 +0,0 @@ -# Maintainer: Sven-Hendrik Haase <svenst...@gmail.com> -# Maintainer: Konstantin Gizdov (kgizdov) <a...@kge.pw> -# Contributor: Adria Arrufat (archdria) <adria.arrufat+...@protonmail.ch> -# Contributor: Thibault Lorrain (fredszaq) <freds...@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.3.0 -_pkgver=2.3.0 -pkgrel=3 -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' 'intel-mkl' 'onednn' 'pybind11' 'openssl-1.0' 'lmdb') -makedepends=('bazel' 'python-numpy' 'cuda' 'nvidia-utils' 'nccl' 'git' 'gcc9' - 'cudnn' 'python-pip' 'python-wheel' 'python-setuptools' 'python-h5py' - 'python-keras-applications' 'python-keras-preprocessing' - 'cython') -optdepends=('tensorboard: Tensorflow visualization toolkit') -source=("$pkgname-$pkgver.tar.gz::https://github.com/tensorflow/tensorflow/archive/v${_pkgver}.tar.gz" - numpy1.20.patch::https://github.com/tensorflow/tensorflow/commit/75ea0b31477d6ba9e990e296bbbd8ca4e7eebadf.patch - build-against-actual-mkl.patch) -sha512sums=('86aa087ea84dac1ecc1023b23a378100d41cc6778ccd20404a4b955fc67cef11b3dc08abcc5b88020124d221e6fb172b33bd5206e9c9db6bc8fbeed399917eac' - 'df2e0373e2f63b8766f31933f7db57f6a7559b8f03af1db51644fba87731451a7cd3895529a3192e5394612fcb42f245b794b1c9ca3c05881ca03a547c8c9acc' - 'e51e3f3dced121db3a09fbdaefd33555536095584b72a5eb6f302fa6fa68ab56ea45e8a847ec90ff4ba076db312c06f91ff672e08e95263c658526582494ce08') - -get_pyver () { - python -c 'import sys; print(str(sys.version_info[0]) + "." + str(sys.version_info[1]))' -} - -check_dir() { - if [ -d "${1}" ]; then - return 0 - else - >&2 echo Directory "${1}" does not exist or is a file! Exiting... - exit 1 - fi -} - -prepare() { - # Allow any bazel version - echo "*" > tensorflow-${_pkgver}/.bazelversion - - # Tensorflow actually wants to build against a slimmed down version of Intel MKL called MKLML - # See https://github.com/intel/mkl-dnn/issues/102 - # MKLML version that Tensorflow wants to use is https://github.com/intel/mkl-dnn/releases/tag/v0.21 - patch -Np1 -d tensorflow-${_pkgver} -i "$srcdir"/build-against-actual-mkl.patch - - # Compile with C++17 by default (FS#65953) - #sed -i "s/c++14/c++17/g" tensorflow-${_pkgver}/.bazelrc - - patch -Np1 -d tensorflow-${_pkgver} -i "$srcdir"/numpy1.20.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 - # See https://github.com/tensorflow/tensorflow/blob/master/third_party/systemlibs/syslibs_configure.bzl - export TF_SYSTEM_LIBS="boringssl,curl,cython,gif,icu,libjpeg_turbo,lmdb,nasm,pcre,png,pybind11,zlib" - export TF_SET_ANDROID_WORKSPACE=0 - export TF_DOWNLOAD_CLANG=0 - export TF_NCCL_VERSION=2.7 - export TF_IGNORE_MAX_BAZEL_VERSION=1 - export TF_MKL_ROOT=/opt/intel/mkl - export NCCL_INSTALL_PATH=/usr - export GCC_HOST_COMPILER_PATH=/usr/bin/gcc-9 - export HOST_C_COMPILER=/usr/bin/gcc-9 - export HOST_CXX_COMPILER=/usr/bin/g++-9 - 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_version.h) - export TF_CUDA_COMPUTE_CAPABILITIES=5.2,5.3,6.0,6.1,6.2,7.0,7.2,7.5,8.0 - - # Required until https://github.com/tensorflow/tensorflow/issues/39467 is fixed. - export CC=gcc-9 - export CXX=g++-9 - -export BAZEL_ARGS="--config=mkl -c opt --copt=-I/usr/include/openssl-1.0 --host_copt=-I/usr/include/openssl-1.0 --linkopt=-l:libssl.so.1.0.0 --linkopt=-l:libcrypto.so.1.0.0 --host_linkopt=-l:libssl.so.1.0.0 --host_linkopt=-l:libcrypto.so.1.0.0" -} - -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 ${BAZEL_ARGS[@]} \ - //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 -O3" - export TF_NEED_CUDA=0 - ./configure - bazel \ - build --config=avx2_linux \ - ${BAZEL_ARGS[@]} \ - //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 \ - ${BAZEL_ARGS[@]} \ - //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 --gpu "${srcdir}"/tmpcuda - - - echo "Building with cuda and with non-x86-64 optimizations" - cd "${srcdir}"/tensorflow-${_pkgver}-opt-cuda - export CC_OPT_FLAGS="-march=haswell -O3" - export TF_NEED_CUDA=1 - export TF_CUDA_CLANG=0 - ./configure - bazel \ - build --config=avx2_linux \ - ${BAZEL_ARGS[@]} \ - //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 --gpu "${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 - local _srch_path="${pkgdir}/usr/lib/python$(get_pyver)"/site-packages/tensorflow/include - check_dir "${_srch_path}" # we need to quit on broken search paths - find "${_srch_path}" -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 - local _srch_path="${pkgdir}/usr/lib/python$(get_pyver)"/site-packages/tensorflow/include/ - check_dir "${_srch_path}" # we need to quit on broken search paths - find "${_srch_path}" -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}" "${_srch_path}" - 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-gast python-numpy python-protobuf absl-py python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator python-opt_einsum python-astunparse python-pasta) - - 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-gast python-numpy python-protobuf absl-py python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator python-opt_einsum python-astunparse python-pasta) - 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-gast python-numpy cuda cudnn python-pycuda python-protobuf absl-py nccl python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator python-opt_einsum python-astunparse python-pasta) - 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-gast python-numpy cuda cudnn python-pycuda python-protobuf absl-py nccl python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator python-opt_einsum python-astunparse python-pasta) - 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: Copied: tensorflow/repos/community-x86_64/PKGBUILD (from rev 702333, tensorflow/trunk/PKGBUILD) =================================================================== --- PKGBUILD (rev 0) +++ PKGBUILD 2020-09-10 20:33:49 UTC (rev 702334) @@ -0,0 +1,292 @@ +# Maintainer: Sven-Hendrik Haase <svenst...@gmail.com> +# Maintainer: Konstantin Gizdov (kgizdov) <a...@kge.pw> +# Contributor: Adria Arrufat (archdria) <adria.arrufat+...@protonmail.ch> +# Contributor: Thibault Lorrain (fredszaq) <freds...@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.3.0 +_pkgver=2.3.0 +pkgrel=4 +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' 'intel-mkl' 'onednn' 'pybind11' 'openssl-1.0' 'lmdb' 'libpng' 'curl' 'giflib' 'icu' 'libjpeg-turbo') +makedepends=('bazel' 'python-numpy' 'cuda' 'nvidia-utils' 'nccl' 'git' 'gcc9' + 'cudnn' 'python-pip' 'python-wheel' 'python-setuptools' 'python-h5py' + 'python-keras-applications' 'python-keras-preprocessing' + 'cython') +optdepends=('tensorboard: Tensorflow visualization toolkit') +source=("$pkgname-$pkgver.tar.gz::https://github.com/tensorflow/tensorflow/archive/v${_pkgver}.tar.gz" + numpy1.20.patch::https://github.com/tensorflow/tensorflow/commit/75ea0b31477d6ba9e990e296bbbd8ca4e7eebadf.patch + build-against-actual-mkl.patch) +sha512sums=('86aa087ea84dac1ecc1023b23a378100d41cc6778ccd20404a4b955fc67cef11b3dc08abcc5b88020124d221e6fb172b33bd5206e9c9db6bc8fbeed399917eac' + 'df2e0373e2f63b8766f31933f7db57f6a7559b8f03af1db51644fba87731451a7cd3895529a3192e5394612fcb42f245b794b1c9ca3c05881ca03a547c8c9acc' + 'e51e3f3dced121db3a09fbdaefd33555536095584b72a5eb6f302fa6fa68ab56ea45e8a847ec90ff4ba076db312c06f91ff672e08e95263c658526582494ce08') + +get_pyver () { + python -c 'import sys; print(str(sys.version_info[0]) + "." + str(sys.version_info[1]))' +} + +check_dir() { + if [ -d "${1}" ]; then + return 0 + else + >&2 echo Directory "${1}" does not exist or is a file! Exiting... + exit 1 + fi +} + +prepare() { + # Allow any bazel version + echo "*" > tensorflow-${_pkgver}/.bazelversion + + # Tensorflow actually wants to build against a slimmed down version of Intel MKL called MKLML + # See https://github.com/intel/mkl-dnn/issues/102 + # MKLML version that Tensorflow wants to use is https://github.com/intel/mkl-dnn/releases/tag/v0.21 + patch -Np1 -d tensorflow-${_pkgver} -i "$srcdir"/build-against-actual-mkl.patch + + # Compile with C++17 by default (FS#65953) + #sed -i "s/c++14/c++17/g" tensorflow-${_pkgver}/.bazelrc + + patch -Np1 -d tensorflow-${_pkgver} -i "$srcdir"/numpy1.20.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=1 + export TF_NEED_OPENCL_SYCL=0 + export TF_NEED_AWS=1 + export TF_NEED_GCP=1 + export TF_NEED_HDFS=1 + export TF_NEED_S3=1 + 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 + # See https://github.com/tensorflow/tensorflow/blob/master/third_party/systemlibs/syslibs_configure.bzl + export TF_SYSTEM_LIBS="boringssl,curl,cython,gif,icu,libjpeg_turbo,lmdb,nasm,pcre,png,pybind11,zlib" + export TF_SET_ANDROID_WORKSPACE=0 + export TF_DOWNLOAD_CLANG=0 + export TF_NCCL_VERSION=2.7 + export TF_IGNORE_MAX_BAZEL_VERSION=1 + export TF_MKL_ROOT=/opt/intel/mkl + export NCCL_INSTALL_PATH=/usr + export GCC_HOST_COMPILER_PATH=/usr/bin/gcc-9 + export HOST_C_COMPILER=/usr/bin/gcc-9 + export HOST_CXX_COMPILER=/usr/bin/g++-9 + 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_version.h) + export TF_CUDA_COMPUTE_CAPABILITIES=5.2,5.3,6.0,6.1,6.2,7.0,7.2,7.5,8.0 + + # Required until https://github.com/tensorflow/tensorflow/issues/39467 is fixed. + export CC=gcc-9 + export CXX=g++-9 + +export BAZEL_ARGS="--config=mkl -c opt --copt=-I/usr/include/openssl-1.0 --host_copt=-I/usr/include/openssl-1.0 --linkopt=-l:libssl.so.1.0.0 --linkopt=-l:libcrypto.so.1.0.0 --host_linkopt=-l:libssl.so.1.0.0 --host_linkopt=-l:libcrypto.so.1.0.0" +} + +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 ${BAZEL_ARGS[@]} \ + //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 -O3" + export TF_NEED_CUDA=0 + ./configure + bazel \ + build --config=avx2_linux \ + ${BAZEL_ARGS[@]} \ + //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 \ + ${BAZEL_ARGS[@]} \ + //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 --gpu "${srcdir}"/tmpcuda + + + echo "Building with cuda and with non-x86-64 optimizations" + cd "${srcdir}"/tensorflow-${_pkgver}-opt-cuda + export CC_OPT_FLAGS="-march=haswell -O3" + export TF_NEED_CUDA=1 + export TF_CUDA_CLANG=0 + ./configure + bazel \ + build --config=avx2_linux \ + ${BAZEL_ARGS[@]} \ + //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 --gpu "${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 + local _srch_path="${pkgdir}/usr/lib/python$(get_pyver)"/site-packages/tensorflow/include + check_dir "${_srch_path}" # we need to quit on broken search paths + find "${_srch_path}" -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 + local _srch_path="${pkgdir}/usr/lib/python$(get_pyver)"/site-packages/tensorflow/include/ + check_dir "${_srch_path}" # we need to quit on broken search paths + find "${_srch_path}" -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}" "${_srch_path}" + 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-gast python-numpy python-protobuf absl-py python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator python-opt_einsum python-astunparse python-pasta) + + 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-gast python-numpy python-protobuf absl-py python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator python-opt_einsum python-astunparse python-pasta) + 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-gast python-numpy cuda cudnn python-pycuda python-protobuf absl-py nccl python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator python-opt_einsum python-astunparse python-pasta) + 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-gast python-numpy cuda cudnn python-pycuda python-protobuf absl-py nccl python-h5py python-keras-applications python-keras-preprocessing python-tensorflow-estimator python-opt_einsum python-astunparse python-pasta) + 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: Deleted: build-against-actual-mkl.patch =================================================================== --- build-against-actual-mkl.patch 2020-09-10 20:33:28 UTC (rev 702333) +++ build-against-actual-mkl.patch 2020-09-10 20:33:49 UTC (rev 702334) @@ -1,37 +0,0 @@ -diff --git a/third_party/mkl/build_defs.bzl b/third_party/mkl/build_defs.bzl -index 4b8fb83eb0..f4e1adfb22 100644 ---- a/third_party/mkl/build_defs.bzl -+++ b/third_party/mkl/build_defs.bzl -@@ -124,7 +124,7 @@ def _mkl_autoconf_impl(repository_ctx): - if _enable_local_mkl(repository_ctx): - # Symlink lib and include local folders. - mkl_root = repository_ctx.os.environ[_TF_MKL_ROOT] -- mkl_lib_path = "%s/lib" % mkl_root -+ mkl_lib_path = "%s/lib/intel64" % mkl_root - repository_ctx.symlink(mkl_lib_path, "lib") - mkl_include_path = "%s/include" % mkl_root - repository_ctx.symlink(mkl_include_path, "include") -diff --git a/third_party/mkl/mkl.BUILD b/third_party/mkl/mkl.BUILD -index 72370182c4..4972bb005e 100644 ---- a/third_party/mkl/mkl.BUILD -+++ b/third_party/mkl/mkl.BUILD -@@ -5,7 +5,6 @@ exports_files(["license.txt"]) - filegroup( - name = "LICENSE", - srcs = [ -- "license.txt", - ], - visibility = ["//visibility:public"], - ) -@@ -21,7 +20,10 @@ cc_library( - name = "mkl_libs_linux", - srcs = [ - "lib/libiomp5.so", -- "lib/libmklml_intel.so", -+ "lib/libmkl_core.so", -+ "lib/libmkl_rt.so", -+ "lib/libmkl_intel_thread.so", -+ "lib/libmkl_intel_lp64.so", - ], - visibility = ["//visibility:public"], - ) Copied: tensorflow/repos/community-x86_64/build-against-actual-mkl.patch (from rev 702333, tensorflow/trunk/build-against-actual-mkl.patch) =================================================================== --- build-against-actual-mkl.patch (rev 0) +++ build-against-actual-mkl.patch 2020-09-10 20:33:49 UTC (rev 702334) @@ -0,0 +1,37 @@ +diff --git a/third_party/mkl/build_defs.bzl b/third_party/mkl/build_defs.bzl +index 4b8fb83eb0..f4e1adfb22 100644 +--- a/third_party/mkl/build_defs.bzl ++++ b/third_party/mkl/build_defs.bzl +@@ -124,7 +124,7 @@ def _mkl_autoconf_impl(repository_ctx): + if _enable_local_mkl(repository_ctx): + # Symlink lib and include local folders. + mkl_root = repository_ctx.os.environ[_TF_MKL_ROOT] +- mkl_lib_path = "%s/lib" % mkl_root ++ mkl_lib_path = "%s/lib/intel64" % mkl_root + repository_ctx.symlink(mkl_lib_path, "lib") + mkl_include_path = "%s/include" % mkl_root + repository_ctx.symlink(mkl_include_path, "include") +diff --git a/third_party/mkl/mkl.BUILD b/third_party/mkl/mkl.BUILD +index 72370182c4..4972bb005e 100644 +--- a/third_party/mkl/mkl.BUILD ++++ b/third_party/mkl/mkl.BUILD +@@ -5,7 +5,6 @@ exports_files(["license.txt"]) + filegroup( + name = "LICENSE", + srcs = [ +- "license.txt", + ], + visibility = ["//visibility:public"], + ) +@@ -21,7 +20,10 @@ cc_library( + name = "mkl_libs_linux", + srcs = [ + "lib/libiomp5.so", +- "lib/libmklml_intel.so", ++ "lib/libmkl_core.so", ++ "lib/libmkl_rt.so", ++ "lib/libmkl_intel_thread.so", ++ "lib/libmkl_intel_lp64.so", + ], + visibility = ["//visibility:public"], + )