summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-04-15 10:02:02 +0000
committerCoprDistGit <infra@openeuler.org>2024-04-15 10:02:02 +0000
commit9e9e6d832e5ef2d9591b2b60bb6600e8ed1c6abf (patch)
treedecf60786588d406f8fca90b8c379fcba5c85d66
parent9f6a79286d35c8bc58bd4f843f6f5bf84cadf899 (diff)
automatic import of python-pytorchopeneuler23.09
-rw-r--r--.gitignore20
-rw-r--r--0001-add-Wno-error-nonnull-for-test-cpp-api.patch29
-rw-r--r--0002-disable-git-submodule.patch60
-rw-r--r--python-pytorch.spec94
-rw-r--r--pytorch.spec142
-rw-r--r--sources21
6 files changed, 271 insertions, 95 deletions
diff --git a/.gitignore b/.gitignore
index 19d3ca2..2b10723 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,21 @@
/python-pytorch-2.1.2.tar.gz
+/FP16.tar.gz
+/FXdiv.tar.gz
+/NNPACK.tar.gz
+/QNNPACK.tar.gz
+/XNNPACK.tar.gz
+/benchmark.tar.gz
+/cpuinfo.tar.gz
+/fbgemm.tar.gz
+/fmt.tar.gz
+/foxi.tar.gz
+/gloo.tar.gz
+/googletest.tar.gz
+/onnx.tar.gz
+/pocketfft.tar.gz
+/psimd.tar.gz
+/pthreadpool.tar.gz
+/pybind11.tar.gz
+/pytorch-v2.2.2.tar.gz
+/sleef.tar.gz
+/tensorpipe.tar.gz
diff --git a/0001-add-Wno-error-nonnull-for-test-cpp-api.patch b/0001-add-Wno-error-nonnull-for-test-cpp-api.patch
new file mode 100644
index 0000000..b498726
--- /dev/null
+++ b/0001-add-Wno-error-nonnull-for-test-cpp-api.patch
@@ -0,0 +1,29 @@
+From 367387bab836c73c23719f97d929572c8b4e0fad Mon Sep 17 00:00:00 2001
+From: Nick Rossenbach <rossenbach@cs.rwth-aachen.de>
+Date: Tue, 18 Apr 2023 23:31:51 +0200
+Subject: [PATCH] Add -Wno-error=nonnull for test/cpp/api/
+
+On some platforms the build might fail due to the nonnull error
+being triggered by different compiler behavior.
+
+Fix for #99278.
+---
+ test/cpp/api/CMakeLists.txt | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/test/cpp/api/CMakeLists.txt b/test/cpp/api/CMakeLists.txt
+index 6b801a073182794..181139b01360c30 100644
+--- a/test/cpp/api/CMakeLists.txt
++++ b/test/cpp/api/CMakeLists.txt
+@@ -80,6 +80,11 @@ if(NOT MSVC)
+ target_compile_options_if_supported(test_api "-Wno-maybe-uninitialized")
+ # gcc gives nonsensical warnings about variadic.h
+ target_compile_options_if_supported(test_api "-Wno-unused-but-set-parameter")
++ # the nonnull check might trigger for some build configurations,
++ # probably happening due to different code optimization
++ # (see e.g. https://rkoucha.fr/tech_corner/nonnull_gcc_attribute.html)
++ # this happened for a riscv build: https://github.com/pytorch/pytorch/issues/99278
++ target_compile_options_if_supported(test_api "-Wno-error=nonnull")
+ endif()
+
+ if(INSTALL_TEST)
diff --git a/0002-disable-git-submodule.patch b/0002-disable-git-submodule.patch
new file mode 100644
index 0000000..4c2ef4d
--- /dev/null
+++ b/0002-disable-git-submodule.patch
@@ -0,0 +1,60 @@
+From 79bb84fb47a5dcd689f0bbee4b41df2230ddce91 Mon Sep 17 00:00:00 2001
+From: menmazqj <1316818279@qq.com>
+Date: Sun, 14 Apr 2024 21:22:18 +0800
+Subject: [PATCH] disable-git-submodule
+
+---
+ cmake/Dependencies.cmake | 23 ++++++++++++-----------
+ setup.py | 2 +-
+ 2 files changed, 13 insertions(+), 12 deletions(-)
+
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index acc95842b63..e86e7664f6f 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -282,17 +282,18 @@ endif()
+
+ # --- [ PocketFFT
+ set(AT_POCKETFFT_ENABLED 0)
+-if(NOT AT_MKL_ENABLED)
+- set(POCKETFFT_INCLUDE_DIR "${Torch_SOURCE_DIR}/third_party/pocketfft/")
+- if(NOT EXISTS "${POCKETFFT_INCLUDE_DIR}")
+- message(FATAL_ERROR "pocketfft directory not found, expected ${POCKETFFT_INCLUDE_DIR}")
+- elif(NOT EXISTS "${POCKETFFT_INCLUDE_DIR}/pocketfft_hdronly.h")
+- message(FATAL_ERROR "pocketfft headers not found in ${POCKETFFT_INCLUDE_DIR}")
+- endif()
+-
+- set(AT_POCKETFFT_ENABLED 1)
+- message(STATUS "Using pocketfft in directory: ${POCKETFFT_INCLUDE_DIR}")
+-endif()
++set(POCKETFFT_INCLUDE_DIR "${Torch_SOURCE_DIR}/third_party/pocketfft/")
++#if(NOT AT_MKL_ENABLED)
++# #set(POCKETFFT_INCLUDE_DIR "${Torch_SOURCE_DIR}/third_party/pocketfft/")
++# if(NOT EXISTS "${POCKETFFT_INCLUDE_DIR}")
++# message(FATAL_ERROR "pocketfft directory not found, expected ${POCKETFFT_INCLUDE_DIR}")
++# elif(NOT EXISTS "${POCKETFFT_INCLUDE_DIR}/pocketfft_hdronly.h")
++# message(FATAL_ERROR "pocketfft headers not found in ${POCKETFFT_INCLUDE_DIR}")
++# endif()
++#
++# set(AT_POCKETFFT_ENABLED 1)
++# message(STATUS "Using pocketfft in directory: ${POCKETFFT_INCLUDE_DIR}")
++#endif()
+
+ # ---[ Dependencies
+ # NNPACK and family (QNNPACK, PYTORCH_QNNPACK, and XNNPACK) can download and
+diff --git a/setup.py b/setup.py
+index 81f3c6cbaac..d017604d103 100644
+--- a/setup.py
++++ b/setup.py
+@@ -458,7 +458,7 @@ def mirror_files_into_torchgen():
+ def build_deps():
+ report("-- Building version " + version)
+
+- check_submodules()
++ #check_submodules()
+ check_pydep("yaml", "pyyaml")
+
+ build_caffe2(
+--
+2.41.0
+
diff --git a/python-pytorch.spec b/python-pytorch.spec
deleted file mode 100644
index 71efff9..0000000
--- a/python-pytorch.spec
+++ /dev/null
@@ -1,94 +0,0 @@
-%global _empty_manifest_terminate_build 0
-%global pypi_name pytorch
-%global source_name pytorch
-
-Name: python-%{pypi_name}
-Version: 2.1.2
-Release: 1%{?dist}
-Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
-License: BSD-3-Clause
-URL: https://pytorch.org/
-Source0: https://github.com/pytorch/pytorch/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
-
-BuildRequires: g++
-Requires: python3-future
-Requires: python3-filelock
-Requires: python3-sympy
-Requires: python3-networkx
-Requires: python3-fsspec
-
-%description
-PyTorch is a Python package that provides two high-level features:
-- Tensor computation (like NumPy) with strong GPU acceleration
-- Deep neural networks built on a tape-based autograd system
-You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend PyTorch when needed.
-
-%package -n python3-%{pypi_name}
-Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
-Provides: python-torch
-BuildRequires: python3-devel
-BuildRequires: python3-setuptools
-BuildRequires: python3-setuptools_scm
-BuildRequires: python3-pbr
-BuildRequires: python3-pip
-BuildRequires: python3-wheel
-BuildRequires: python3-hatchling
-
-BuildRequires: python3-astunparse
-BuildRequires: python3-numpy
-BuildRequires: python3-pyyaml
-BuildRequires: cmake
-BuildRequires: python3-typing-extensions
-BuildRequires: python3-requests
-
-%description -n python3-%{pypi_name}
-PyTorch is a Python package that provides two high-level features:
-- Tensor computation (like NumPy) with strong GPU acceleration
-- Deep neural networks built on a tape-based autograd system
-You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend PyTorch when needed.
-
-%package help
-Summary: Development documents and examples for torch
-Provides: python3-%{pypi_name}-doc
-%description help
-PyTorch is a Python package that provides two high-level features:
-- Tensor computation (like NumPy) with strong GPU acceleration
-- Deep neural networks built on a tape-based autograd system
-You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend PyTorch when needed.
-
-%prep
-%autosetup -p1 -n %{pypi_name}-%{version}
-
-%build
-%pyproject_build
-
-%install
-%pyproject_install
-install -d -m755 %{buildroot}/%{_pkgdocdir}
-if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
-if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
-if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
-if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
-pushd %{buildroot}
-touch doclist.lst
-if [ -d usr/share/man ]; then
- find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
-fi
-popd
-mv %{buildroot}/doclist.lst .
-
-%files -n python3-pytorch
-%doc *.md
-%license LICENSE
-%{_bindir}/convert-caffe2-to-onnx
-%{_bindir}/convert-onnx-to-caffe2
-%{_bindir}/torchrun
-%{python3_sitearch}/*
-
-%files help -f doclist.lst
-%{_docdir}/*
-
-
-%changelog
-* Mon Jan 22 2024 menma <1316818279@qq.com> - 0.9.5-1
-- Package init
diff --git a/pytorch.spec b/pytorch.spec
new file mode 100644
index 0000000..70350d7
--- /dev/null
+++ b/pytorch.spec
@@ -0,0 +1,142 @@
+%global _empty_manifest_terminate_build 0
+Name: python-pytorch
+Version: 2.2.2
+Release: 1
+Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
+License: BSD-3-Clause
+URL: https://pytorch.org/
+Source0: https://github.com/pytorch/pytorch/releases/download/v%{version}/pytorch-v%{version}.tar.gz
+Source1: pocketfft.tar.gz
+Source2: pthreadpool.tar.gz
+Source3: cpuinfo.tar.gz
+Source4: QNNPACK.tar.gz
+Source5: FXdiv.tar.gz
+Source6: tensorpipe.tar.gz
+Source7: FP16.tar.gz
+Source8: psimd.tar.gz
+Source9: onnx.tar.gz
+Source10: foxi.tar.gz
+Source11: gloo.tar.gz
+Source12: fbgemm.tar.gz
+Source13: googletest.tar.gz
+Source14: benchmark.tar.gz
+Source15: NNPACK.tar.gz
+Source16: XNNPACK.tar.gz
+Source17: sleef.tar.gz
+Source18: fmt.tar.gz
+Source19: pybind11.tar.gz
+
+Patch1: 0001-add-Wno-error-nonnull-for-test-cpp-api.patch
+Patch2: 0002-disable-git-submodule.patch
+Requires: python3-future
+Requires: python3-filelock
+Requires: python3-sympy
+Requires: python3-networkx
+Requires: python3-fsspec
+
+%description
+PyTorch is a Python package that provides two high-level features:
+- Tensor computation (like NumPy) with strong GPU acceleration
+- Deep neural networks built on a tape-based autograd system
+You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend PyTorch when needed.
+
+%package -n python3-pytorch
+Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
+Provides: python-torch
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-setuptools_scm
+BuildRequires: python3-pbr
+BuildRequires: python3-pip
+BuildRequires: python3-wheel
+BuildRequires: python3-hatchling
+
+BuildRequires: python3-astunparse
+BuildRequires: python3-numpy
+BuildRequires: python3-pyyaml
+BuildRequires: cmake
+BuildRequires: python3-typing-extensions
+BuildRequires: python3-requests
+BuildRequires: g++
+
+%description -n python3-pytorch
+PyTorch is a Python package that provides two high-level features:
+- Tensor computation (like NumPy) with strong GPU acceleration
+- Deep neural networks built on a tape-based autograd system
+You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend PyTorch when needed.
+
+%package help
+Summary: Development documents and examples for torch
+Provides: python3-pytorch-doc
+%description help
+PyTorch is a Python package that provides two high-level features:
+- Tensor computation (like NumPy) with strong GPU acceleration
+- Deep neural networks built on a tape-based autograd system
+You can reuse your favorite Python packages such as NumPy, SciPy and Cython to extend PyTorch when needed.
+
+%prep
+%autosetup -p1 -n %{name}-%{version}
+tar -xzf %{_sourcedir}/pocketfft.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/pocketfft ./third_party/
+tar -xzf %{_sourcedir}/pthreadpool.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/pthreadpool ./third_party/
+tar -xzf %{_sourcedir}/cpuinfo.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/cpuinfo ./third_party/
+tar -xzf %{_sourcedir}/QNNPACK.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/QNNPACK ./third_party/
+tar -xzf %{_sourcedir}/FXdiv.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/FXdiv ./third_party/
+tar -xzf %{_sourcedir}/tensorpipe.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/tensorpipe ./third_party/
+tar -xzf %{_sourcedir}/FP16.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/FP16 ./third_party/
+tar -xzf %{_sourcedir}/psimd.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/psimd ./third_party/
+tar -xzf %{_sourcedir}/onnx.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/onnx ./third_party/
+tar -xzf %{_sourcedir}/foxi.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/foxi ./third_party/
+tar -xzf %{_sourcedir}/gloo.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/gloo ./third_party/
+tar -xzf %{_sourcedir}/fbgemm.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/fbgemm ./third_party/
+tar -xzf %{_sourcedir}/googletest.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/googletest ./third_party/
+tar -xzf %{_sourcedir}/benchmark.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/benchmark ./third_party/
+tar -xzf %{_sourcedir}/NNPACK.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/NNPACK ./third_party/
+tar -xzf %{_sourcedir}/XNNPACK.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/XNNPACK ./third_party/
+tar -xzf %{_sourcedir}/sleef.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/sleef ./third_party/
+tar -xzf %{_sourcedir}/fmt.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/fmt ./third_party/
+tar -xzf %{_sourcedir}/kineto.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/kineto ./third_party/
+tar -xzf %{_sourcedir}/pybind11.tar.gz -C %{_sourcedir} && mv %{_sourcedir}/pybind11 ./third_party/
+
+%build
+export USE_CUDA=OFF
+export USE_KINETO=OFF
+export USE_QNNPACK=OFF
+export USE_NNPACK=OFF
+export USE_TENSORPIPE=OFF
+export BUILD_CUSTOM_PROTOBUF=OFF
+export USE_SYSTEM_SLEEF=ON
+export USE_XNNPACK=OFF
+#export USE_SYSTEM_CPUINFO=1
+export CFLAGS+=" -Wno-error=maybe-uninitialized -Wno-error=uninitialized -Wno-error=restrict -fPIC"
+export CXXFLAGS+=" -Wno-error=maybe-uninitialized -Wno-error=uninitialized -Wno-error=restrict -fPIC"
+%pyproject_build
+
+%install
+%pyproject_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-pytorch
+%doc *.md
+%license LICENSE
+%{_bindir}/convert-caffe2-to-onnx
+%{_bindir}/convert-onnx-to-caffe2
+%{_bindir}/torchrun
+%{python3_sitearch}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Thu Jan 11 2024 menma <1316818279@qq.com> - 2.2.2-1
+- init package
diff --git a/sources b/sources
index 22653d5..806fc35 100644
--- a/sources
+++ b/sources
@@ -1 +1,20 @@
-5c75b2e1e8978d5591e601b90b8ac2ba python-pytorch-2.1.2.tar.gz
+fee4e8487d62f8e6fd6a01f9bced04e2 FP16.tar.gz
+dde6dd6c3c3d6f3dfc58034096b3283d FXdiv.tar.gz
+02c005cf40f8bdb2a7f22405d2d605ad NNPACK.tar.gz
+2d0ab7bdf8a78f28cd7dc2187665bf0c QNNPACK.tar.gz
+f77a15a429fe2906207742a44e6262e1 XNNPACK.tar.gz
+eee53a4f3c7a90322b614b191508d55a benchmark.tar.gz
+d9df78efb2531e67b2b31a9617433d2f cpuinfo.tar.gz
+da403b0c9d5c011f94073730a46c38d3 fbgemm.tar.gz
+52fc8aef0057b2ff7a6469409c2f83e1 fmt.tar.gz
+17acc541a17d9e8ef0870f0cb6375c22 foxi.tar.gz
+e916d60b7ce4d29530bf16909d8febe0 gloo.tar.gz
+0ea481afd3d5f2172b1984a4c7a8fe43 googletest.tar.gz
+aebabf013aab98f4ad418e1f3e975632 onnx.tar.gz
+af4a42f848fb1bee8e8d942b455ff746 pocketfft.tar.gz
+e9edcef9d6ac01bda3eb42a27962ac4e psimd.tar.gz
+7c762260b8296b7f935c6864d0ac07ec pthreadpool.tar.gz
+c10f22d633afb77b5196ef537e09a5b2 pybind11.tar.gz
+f975a4009521a4c1cb28f4219b6a934c pytorch-v2.2.2.tar.gz
+0dd478ef07e37ada559ef7ddd4d13873 sleef.tar.gz
+bc9361e9cb8d0ae07acd735ceeea5b5f tensorpipe.tar.gz