[arch-commits] Commit in python-pytorch/repos (7 files)

Evangelos Foutras foutrelis at archlinux.org
Sat May 8 15:55:12 UTC 2021


    Date: Saturday, May 8, 2021 @ 15:55:12
  Author: foutrelis
Revision: 928853

archrelease: copy trunk to community-staging-x86_64

Added:
  python-pytorch/repos/community-staging-x86_64/
  python-pytorch/repos/community-staging-x86_64/PKGBUILD
    (from rev 928852, python-pytorch/trunk/PKGBUILD)
  python-pytorch/repos/community-staging-x86_64/disable_non_x86_64.patch
    (from rev 928852, python-pytorch/trunk/disable_non_x86_64.patch)
  python-pytorch/repos/community-staging-x86_64/fix-building-for-torchvision.patch
    (from rev 928852, python-pytorch/trunk/fix-building-for-torchvision.patch)
  python-pytorch/repos/community-staging-x86_64/fix_include_system.patch
    (from rev 928852, python-pytorch/trunk/fix_include_system.patch)
  python-pytorch/repos/community-staging-x86_64/test.py
    (from rev 928852, python-pytorch/trunk/test.py)
  python-pytorch/repos/community-staging-x86_64/use-system-libuv.patch
    (from rev 928852, python-pytorch/trunk/use-system-libuv.patch)

------------------------------------+
 PKGBUILD                           |  285 +++++++++++++++++++++++++++++++++++
 disable_non_x86_64.patch           |   15 +
 fix-building-for-torchvision.patch |   25 +++
 fix_include_system.patch           |   13 +
 test.py                            |    7 
 use-system-libuv.patch             |   13 +
 6 files changed, 358 insertions(+)

Copied: python-pytorch/repos/community-staging-x86_64/PKGBUILD (from rev 928852, python-pytorch/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD	                        (rev 0)
+++ community-staging-x86_64/PKGBUILD	2021-05-08 15:55:12 UTC (rev 928853)
@@ -0,0 +1,285 @@
+# Maintainer: Sven-Hendrik Haase <svenstaro at gmail.com>
+# Contributor: Stephen Zhang <zsrkmyn at gmail dot com>
+
+pkgbase=python-pytorch
+pkgname=("python-pytorch" "python-pytorch-opt" "python-pytorch-cuda" "python-pytorch-opt-cuda")
+_pkgname="pytorch"
+pkgver=1.8.1
+_pkgver=1.8.1
+pkgrel=5
+pkgdesc="Tensors and Dynamic neural networks in Python with strong GPU acceleration"
+arch=('x86_64')
+url="https://pytorch.org"
+license=('BSD')
+depends=('google-glog' 'gflags' 'opencv' 'openmp' 'nccl' 'pybind11' 'python' 'python-yaml' 'libuv'
+         'python-numpy' 'protobuf' 'ffmpeg' 'python-future' 'qt5-base' 'onednn' 'intel-mkl'
+         'python-typing_extensions')
+makedepends=('python' 'python-setuptools' 'python-yaml' 'python-numpy' 'cmake' 'cuda'
+             'cudnn' 'git' 'magma' 'ninja' 'pkgconfig' 'doxygen')
+source=("${_pkgname}-${pkgver}::git+https://github.com/pytorch/pytorch.git#tag=v$_pkgver"
+        # generated using parse-submodules
+        "${pkgname}-ios-cmake::git+https://github.com/Yangqing/ios-cmake.git"
+        "${pkgname}-pthreadpool::git+https://github.com/Maratyszcza/pthreadpool.git"
+        "${pkgname}-FP16::git+https://github.com/Maratyszcza/FP16.git"
+        "${pkgname}-NNPACK::git+https://github.com/Maratyszcza/NNPACK.git"
+        "${pkgname}-FXdiv::git+https://github.com/Maratyszcza/FXdiv.git"
+        "${pkgname}-PeachPy::git+https://github.com/Maratyszcza/PeachPy.git"
+        "${pkgname}-cub::git+https://github.com/NVlabs/cub.git"
+        "${pkgname}-psimd::git+https://github.com/Maratyszcza/psimd.git"
+        "${pkgname}-cpuinfo::git+https://github.com/pytorch/cpuinfo.git"
+        "${pkgname}-enum34::git+https://github.com/PeachPy/enum34.git"
+        "${pkgname}-ideep::git+https://github.com/intel/ideep"
+        "${pkgname}-QNNPACK::git+https://github.com/pytorch/QNNPACK"
+        "${pkgname}-foxi::git+https://github.com/houseroad/foxi.git"
+        "${pkgname}-ARM_NEON_2_x86_SSE::git+https://github.com/intel/ARM_NEON_2_x86_SSE.git"
+        "${pkgname}-six::git+https://github.com/benjaminp/six.git"
+        "${pkgname}-eigen-git-mirror::git+https://github.com/eigenteam/eigen-git-mirror.git"
+        "${pkgname}-gloo::git+https://github.com/facebookincubator/gloo"
+        "${pkgname}-nccl::git+https://github.com/NVIDIA/nccl"
+        "${pkgname}-gemmlowp::git+https://github.com/google/gemmlowp.git"
+        "${pkgname}-kineto::git+https://github.com/pytorch/kineto"
+        "${pkgname}-sleef::git+https://github.com/shibatch/sleef"
+        "${pkgname}-onnx-tensorrt::git+https://github.com/onnx/onnx-tensorrt"
+        "${pkgname}-benchmark::git+https://github.com/google/benchmark.git"
+        "${pkgname}-tbb::git+https://github.com/01org/tbb"
+        "${pkgname}-XNNPACK::git+https://github.com/malfet/XNNPACK.git"
+        "${pkgname}-fbjni::git+https://github.com/facebookincubator/fbjni.git"
+        "${pkgname}-tensorpipe::git+https://github.com/pytorch/tensorpipe.git"
+        "${pkgname}-pybind11::git+https://github.com/pybind/pybind11.git"
+        "${pkgname}-fbgemm::git+https://github.com/pytorch/fbgemm"
+        "${pkgname}-googletest::git+https://github.com/google/googletest.git"
+        "${pkgname}-zstd::git+https://github.com/facebook/zstd.git"
+        "${pkgname}-onnx::git+https://github.com/onnx/onnx.git"
+        "${pkgname}-protobuf::git+https://github.com/protocolbuffers/protobuf.git"
+        "${pkgname}-fmt::git+https://github.com/fmtlib/fmt.git"
+        fix_include_system.patch
+        use-system-libuv.patch
+        fix-building-for-torchvision.patch
+        disable_non_x86_64.patch)
+sha256sums=('SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            '557761502bbd994d9795bef46779e4b8c60ba0b45e7d60841f477d3b7f28a00a'
+            'cd9ac4aaa9f946ac5eafc57cf66c5c16b3ea7ac8af32c2558fad0705411bb669'
+            'f4959cde995382c55ba28c8496321b0bb0a5c0f3f46abcce2e88521004993846'
+            'd3ef8491718ed7e814fe63e81df2f49862fffbea891d2babbcb464796a1bd680')
+
+prepare() {
+  cd "${_pkgname}-${pkgver}"
+
+  # generated using parse-submodules
+  git submodule init
+
+  git config submodule."third_party/pybind11".url "${srcdir}/${pkgname}"-pybind11
+  git config submodule."third_party/cub".url "${srcdir}/${pkgname}"-cub
+  git config submodule."third_party/eigen".url "${srcdir}/${pkgname}"-eigen-git-mirror
+  git config submodule."third_party/googletest".url "${srcdir}/${pkgname}"-googletest
+  git config submodule."third_party/benchmark".url "${srcdir}/${pkgname}"-benchmark
+  git config submodule."third_party/protobuf".url "${srcdir}/${pkgname}"-protobuf
+  git config submodule."third_party/ios-cmake".url "${srcdir}/${pkgname}"-ios-cmake
+  git config submodule."third_party/NNPACK".url "${srcdir}/${pkgname}"-NNPACK
+  git config submodule."third_party/gloo".url "${srcdir}/${pkgname}"-gloo
+  git config submodule."third_party/NNPACK_deps/pthreadpool".url "${srcdir}/${pkgname}"-pthreadpool
+  git config submodule."third_party/NNPACK_deps/FXdiv".url "${srcdir}/${pkgname}"-FXdiv
+  git config submodule."third_party/NNPACK_deps/FP16".url "${srcdir}/${pkgname}"-FP16
+  git config submodule."third_party/NNPACK_deps/psimd".url "${srcdir}/${pkgname}"-psimd
+  git config submodule."third_party/zstd".url "${srcdir}/${pkgname}"-zstd
+  git config submodule."third-party/cpuinfo".url "${srcdir}/${pkgname}"-cpuinfo
+  git config submodule."third_party/python-enum".url "${srcdir}/${pkgname}"-enum34
+  git config submodule."third_party/python-peachpy".url "${srcdir}/${pkgname}"-PeachPy
+  git config submodule."third_party/python-six".url "${srcdir}/${pkgname}"-six
+  git config submodule."third_party/onnx".url "${srcdir}/${pkgname}"-onnx
+  git config submodule."third_party/onnx-tensorrt".url "${srcdir}/${pkgname}"-onnx-tensorrt
+  git config submodule."third_party/sleef".url "${srcdir}/${pkgname}"-sleef
+  git config submodule."third_party/ideep".url "${srcdir}/${pkgname}"-ideep
+  git config submodule."third_party/nccl/nccl".url "${srcdir}/${pkgname}"-nccl
+  git config submodule."third_party/gemmlowp/gemmlowp".url "${srcdir}/${pkgname}"-gemmlowp
+  git config submodule."third_party/QNNPACK".url "${srcdir}/${pkgname}"-QNNPACK
+  git config submodule."third_party/neon2sse".url "${srcdir}/${pkgname}"-ARM_NEON_2_x86_SSE
+  git config submodule."third_party/fbgemm".url "${srcdir}/${pkgname}"-fbgemm
+  git config submodule."third_party/foxi".url "${srcdir}/${pkgname}"-foxi
+  git config submodule."third_party/tbb".url "${srcdir}/${pkgname}"-tbb
+  git config submodule."android/libs/fbjni".url "${srcdir}/${pkgname}"-fbjni
+  git config submodule."third_party/XNNPACK".url "${srcdir}/${pkgname}"-XNNPACK
+  git config submodule."third_party/fmt".url "${srcdir}/${pkgname}"-fmt
+  git config submodule."third_party/tensorpipe".url "${srcdir}/${pkgname}"-tensorpipe
+  git config submodule."third_party/kineto".url "${srcdir}/${pkgname}"-kineto
+
+  git submodule update --init --recursive
+
+  # https://bugs.archlinux.org/task/64981
+  patch -N torch/utils/cpp_extension.py "${srcdir}"/fix_include_system.patch
+
+  # Use system libuv
+  patch -Np1 -i "${srcdir}"/use-system-libuv.patch
+
+  # fix https://github.com/pytorch/vision/issues/3695
+  patch -Np1 -i "${srcdir}/fix-building-for-torchvision.patch"
+
+  # remove local nccl
+  rm -rf third_party/nccl/nccl
+
+  cd ..
+
+  cp -a "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-opt"
+  cp -a "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-cuda"
+  cp -a "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-opt-cuda"
+
+  export VERBOSE=1
+  export PYTORCH_BUILD_VERSION="${pkgver}"
+  export PYTORCH_BUILD_NUMBER=1
+
+  # Check tools/setup_helpers/cmake.py, setup.py and CMakeLists.txt for a list of flags that can be set via env vars.
+  export USE_MKLDNN=ON
+  export BUILD_CUSTOM_PROTOBUF=OFF
+  # export BUILD_SHARED_LIBS=OFF
+  export USE_FFMPEG=ON
+  export USE_GFLAGS=ON
+  export USE_GLOG=ON
+  export BUILD_BINARY=ON
+  export USE_OPENCV=ON
+  export USE_SYSTEM_NCCL=ON
+  # export USE_SYSTEM_LIBS=ON
+  export NCCL_VERSION=$(pkg-config nccl --modversion)
+  export NCCL_VER_CODE=$(sed -n 's/^#define NCCL_VERSION_CODE\s*\(.*\).*/\1/p' /usr/include/nccl.h)
+  export CUDAHOSTCXX=g++
+  export CUDA_HOME=/opt/cuda
+  export CUDNN_LIB_DIR=/usr/lib
+  export CUDNN_INCLUDE_DIR=/usr/include
+  # export TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
+  export TORCH_CUDA_ARCH_LIST="5.2;5.3;6.0;6.1;6.2;7.0;7.0+PTX;7.2;7.2+PTX;7.5;7.5+PTX;8.0;8.0+PTX;8.6;8.6+PTX"
+}
+
+build() {
+  echo "Building without cuda and without non-x86-64 optimizations"
+  export USE_CUDA=0
+  export USE_CUDNN=0
+  cd "${srcdir}/${_pkgname}-${pkgver}"
+  echo "add_definitions(-march=x86-64)" >> cmake/MiscCheck.cmake
+  patch -Np1 -i "${srcdir}/disable_non_x86_64.patch"
+  python setup.py build
+
+
+  echo "Building without cuda and with non-x86-64 optimizations"
+  export USE_CUDA=0
+  export USE_CUDNN=0
+  cd "${srcdir}/${_pkgname}-${pkgver}-opt"
+  echo "add_definitions(-march=haswell)" >> cmake/MiscCheck.cmake
+  python setup.py build
+
+
+  echo "Building with cuda and without non-x86-64 optimizations"
+  export USE_CUDA=1
+  export USE_CUDNN=1
+  cd "${srcdir}/${_pkgname}-${pkgver}-cuda"
+  patch -Np1 -i "${srcdir}/disable_non_x86_64.patch"
+  echo "add_definitions(-march=x86-64)" >> cmake/MiscCheck.cmake
+  python setup.py build
+
+
+  echo "Building with cuda and with non-x86-64 optimizations"
+  export USE_CUDA=1
+  export USE_CUDNN=1
+  cd "${srcdir}/${_pkgname}-${pkgver}-opt-cuda"
+  echo "add_definitions(-march=haswell)" >> cmake/MiscCheck.cmake
+  python setup.py build
+}
+
+_package() {
+  # Prevent setup.py from re-running CMake and rebuilding
+  sed -e 's/RUN_BUILD_DEPS = True/RUN_BUILD_DEPS = False/g' -i setup.py
+
+  python setup.py install --root="${pkgdir}"/ --optimize=1 --skip-build
+
+  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+
+  pytorchpath="usr/lib/python3.9/site-packages/torch"
+  install -d "${pkgdir}/usr/lib"
+
+  # put CMake files in correct place
+  mv "${pkgdir}/${pytorchpath}/share/cmake" "${pkgdir}/usr/lib/cmake"
+
+  # put C++ API in correct place
+  mv "${pkgdir}/${pytorchpath}/include" "${pkgdir}/usr/include"
+  mv "${pkgdir}/${pytorchpath}/lib"/*.so* "${pkgdir}/usr/lib/"
+
+  # clean up duplicates
+  # TODO: move towards direct shared library dependecy of:
+  #   c10, caffe2, libcpuinfo, CUDA RT, gloo, GTest, Intel MKL,
+  #   NVRTC, ONNX, protobuf, libthreadpool, QNNPACK
+  rm -rf "${pkgdir}/usr/include/pybind11"
+
+  # python module is hardcoded to look there at runtime
+  ln -s /usr/include "${pkgdir}/${pytorchpath}/include"
+  find "${pkgdir}"/usr/lib -type f -name "*.so*" -print0 | while read -rd $'\0' _lib; do
+    ln -s ${_lib#"$pkgdir"} "${pkgdir}/${pytorchpath}/lib/"
+  done
+}
+
+package_python-pytorch() {
+  cd "${srcdir}/${_pkgname}-${pkgver}"
+  _package
+}
+
+package_python-pytorch-opt() {
+  pkgdesc="Tensors and Dynamic neural networks in Python with strong GPU acceleration (with AVX2 CPU optimizations)"
+  conflicts=(python-pytorch)
+  provides=(python-pytorch)
+
+  cd "${srcdir}/${_pkgname}-${pkgver}-opt"
+  _package
+}
+
+package_python-pytorch-cuda() {
+  pkgdesc="Tensors and Dynamic neural networks in Python with strong GPU acceleration (with CUDA)"
+  depends+=(cuda cudnn magma)
+  conflicts=(python-pytorch)
+  provides=(python-pytorch)
+
+  cd "${srcdir}/${_pkgname}-${pkgver}-cuda"
+  _package
+}
+
+package_python-pytorch-opt-cuda() {
+  pkgdesc="Tensors and Dynamic neural networks in Python with strong GPU acceleration (with CUDA and AVX2 CPU optimizations)"
+  depends+=(cuda cudnn magma)
+  conflicts=(python-pytorch)
+  provides=(python-pytorch python-pytorch-cuda)
+
+  cd "${srcdir}/${_pkgname}-${pkgver}-opt-cuda"
+  _package
+}
+
+# vim:set ts=2 sw=2 et:

Copied: python-pytorch/repos/community-staging-x86_64/disable_non_x86_64.patch (from rev 928852, python-pytorch/trunk/disable_non_x86_64.patch)
===================================================================
--- community-staging-x86_64/disable_non_x86_64.patch	                        (rev 0)
+++ community-staging-x86_64/disable_non_x86_64.patch	2021-05-08 15:55:12 UTC (rev 928853)
@@ -0,0 +1,15 @@
+diff --git a/tools/setup_helpers/cmake.py b/tools/setup_helpers/cmake.py
+index d5db749d15..fd54cca6b8 100644
+--- a/tools/setup_helpers/cmake.py
++++ b/tools/setup_helpers/cmake.py
+@@ -295,6 +295,10 @@ class CMake:
+         build_options.update(cmake__options)
+ 
+         CMake.defines(args,
++                      DISABLE_AVX2=1,
++                      DISABLE_AVX512F=1,
++                      DISABLE_FMA4=1,
++                      DISABLE_SSE4=1,
+                       PYTHON_EXECUTABLE=sys.executable,
+                       PYTHON_LIBRARY=cmake_python_library,
+                       PYTHON_INCLUDE_DIR=distutils.sysconfig.get_python_inc(),

Copied: python-pytorch/repos/community-staging-x86_64/fix-building-for-torchvision.patch (from rev 928852, python-pytorch/trunk/fix-building-for-torchvision.patch)
===================================================================
--- community-staging-x86_64/fix-building-for-torchvision.patch	                        (rev 0)
+++ community-staging-x86_64/fix-building-for-torchvision.patch	2021-05-08 15:55:12 UTC (rev 928853)
@@ -0,0 +1,25 @@
+From 011495d8045c44527fbd7796ce860618120ae127 Mon Sep 17 00:00:00 2001
+From: Butui Hu <hot123tea123 at gmail.com>
+Date: Fri, 30 Apr 2021 11:36:30 +0800
+Subject: [PATCH] fix building torchvision
+
+---
+ aten/src/ATen/core/op_registration/op_whitelist.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/aten/src/ATen/core/op_registration/op_whitelist.h b/aten/src/ATen/core/op_registration/op_whitelist.h
+index f93462bb2cf..12903d1cc09 100644
+--- a/aten/src/ATen/core/op_registration/op_whitelist.h
++++ b/aten/src/ATen/core/op_registration/op_whitelist.h
+@@ -59,7 +59,7 @@ constexpr bool op_whitelist_contains(string_view allowlist, string_view item) {
+ // Returns true iff the given op name is on the allowlist
+ // and should be registered
+ constexpr bool op_whitelist_check(string_view op_name) {
+-  assert(op_name.find("::") != string_view::npos);
++//  assert(op_name.find("::") != string_view::npos);
+ #if !defined(TORCH_OPERATOR_WHITELIST)
+   // If the TORCH_OPERATOR_WHITELIST parameter is not defined,
+   // all ops are to be registered
+-- 
+2.31.1
+

Copied: python-pytorch/repos/community-staging-x86_64/fix_include_system.patch (from rev 928852, python-pytorch/trunk/fix_include_system.patch)
===================================================================
--- community-staging-x86_64/fix_include_system.patch	                        (rev 0)
+++ community-staging-x86_64/fix_include_system.patch	2021-05-08 15:55:12 UTC (rev 928853)
@@ -0,0 +1,13 @@
+diff --git a/torch/utils/cpp_extension.py b/torch/utils/cpp_extension.py
+index ca673033e1..c79ce8d37b 100644
+--- a/torch/utils/cpp_extension.py
++++ b/torch/utils/cpp_extension.py
+@@ -1760,7 +1760,7 @@ def _write_ninja_file_to_build_library(path,
+             common_cflags.append(f'-DPYBIND11_{pname}=\\"{pval}\\"')
+ 
+     common_cflags += [f'-I{include}' for include in user_includes]
+-    common_cflags += [f'-isystem {include}' for include in system_includes]
++    common_cflags += [f'-I{include}' for include in system_includes]
+ 
+     common_cflags += ['-D_GLIBCXX_USE_CXX11_ABI=' + str(int(torch._C._GLIBCXX_USE_CXX11_ABI))]
+ 

Copied: python-pytorch/repos/community-staging-x86_64/test.py (from rev 928852, python-pytorch/trunk/test.py)
===================================================================
--- community-staging-x86_64/test.py	                        (rev 0)
+++ community-staging-x86_64/test.py	2021-05-08 15:55:12 UTC (rev 928853)
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+import torch
+
+d = torch.device('cuda')
+a = torch.rand(1, 2).to(d)
+print(a + 0)

Copied: python-pytorch/repos/community-staging-x86_64/use-system-libuv.patch (from rev 928852, python-pytorch/trunk/use-system-libuv.patch)
===================================================================
--- community-staging-x86_64/use-system-libuv.patch	                        (rev 0)
+++ community-staging-x86_64/use-system-libuv.patch	2021-05-08 15:55:12 UTC (rev 928853)
@@ -0,0 +1,13 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 06464e799a..93410bc210 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -1346,7 +1346,7 @@ if(USE_DISTRIBUTED AND USE_TENSORPIPE)
+       set(TP_USE_CUDA ON CACHE BOOL "" FORCE)
+       set(TP_ENABLE_CUDA_IPC ON CACHE BOOL "" FORCE)
+     endif()
+-    set(TP_BUILD_LIBUV ON CACHE BOOL "" FORCE)
++    set(TP_BUILD_LIBUV OFF CACHE BOOL "" FORCE)
+     set(TP_STATIC_OR_SHARED STATIC CACHE STRING "" FORCE)
+ 
+     add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/tensorpipe)



More information about the arch-commits mailing list