summaryrefslogtreecommitdiff
path: root/pytorch.spec
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 /pytorch.spec
parent9f6a79286d35c8bc58bd4f843f6f5bf84cadf899 (diff)
automatic import of python-pytorchopeneuler23.09
Diffstat (limited to 'pytorch.spec')
-rw-r--r--pytorch.spec142
1 files changed, 142 insertions, 0 deletions
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