diff --git a/.ipynb_checkpoints/0001-patch-checkpoint.patch b/.ipynb_checkpoints/0001-patch-checkpoint.patch new file mode 100644 index 0000000000000000000000000000000000000000..9a573759f804067b5dbfd4027ee87e8418d29849 --- /dev/null +++ b/.ipynb_checkpoints/0001-patch-checkpoint.patch @@ -0,0 +1,29 @@ +From 2a7950d0bf39c89f7b1581dd7e42a5352039c3aa Mon Sep 17 00:00:00 2001 +From: Your Name +Date: Wed, 1 Nov 2023 15:36:52 +0800 +Subject: [PATCH] Remove buggy cuda version conflict detection + +--- + cmake/public/cuda.cmake | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake +index 32f3ba3..f5eebad 100644 +--- a/cmake/public/cuda.cmake ++++ b/cmake/public/cuda.cmake +@@ -60,12 +60,6 @@ find_package(CUDAToolkit REQUIRED) + + cmake_policy(POP) + +-if(NOT CMAKE_CUDA_COMPILER_VERSION STREQUAL CUDAToolkit_VERSION OR +- NOT CUDA_INCLUDE_DIRS STREQUAL CUDAToolkit_INCLUDE_DIR) +- message(FATAL_ERROR "Found two conflicting CUDA installs:\n" +- "V${CMAKE_CUDA_COMPILER_VERSION} in '${CUDA_INCLUDE_DIRS}' and\n" +- "V${CUDAToolkit_VERSION} in '${CUDAToolkit_INCLUDE_DIR}'") +-endif() + + if(NOT TARGET CUDA::nvToolsExt) + message(FATAL_ERROR "Failed to find nvToolsExt") +-- +2.40.1 + diff --git a/.ipynb_checkpoints/pytorch-checkpoint.spec b/.ipynb_checkpoints/pytorch-checkpoint.spec new file mode 100644 index 0000000000000000000000000000000000000000..f67a2c256edec5ffb9d6cc1afa1168589d2043d5 --- /dev/null +++ b/.ipynb_checkpoints/pytorch-checkpoint.spec @@ -0,0 +1,148 @@ +%define anolis_release 1 + +%global vcu_maj 12 +%global vcu_min 1 +%global _lto_cflags %{nil} +%global __cmake_in_source_build 1 +%undefine _hardened_build +%undefine _annotated_build +%undefine _find_debuginfo_dwz_opts +%undefine _missing_build_ids_terminate_build + +Name: pytorch +Version: 2.1.0 +Release: %{anolis_release}%{dist} +Summary: PyTorch Neural Network Package +License: BSD + +URL: https://pytorch.org +Source0: https://github.com/pytorch/pytorch/releases/download/v%{version}/pytorch-v%{version}.tar.gz +Patch0: 0001-patch.patch + +BuildRequires: python3-devel cmake gcc-c++ +BuildRequires: python3-typing-extensions python3-pyyaml python3-setuptools +BuildRequires: python3-six python3-numpy + +BuildRequires: cuda-nvcc-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-nvtx-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-cupti-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-cudart-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-nvml-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-nvrtc-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-driver-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: cuda-profiler-api-%{vcu_maj}-%{vcu_min} +BuildRequires: libcublas-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libcufft-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libcurand-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libcusparse-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libcusolver-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libnvjitlink-devel-%{vcu_maj}-%{vcu_min} +BuildRequires: libnccl-devel +BuildRequires: libcudnn-devel +BuildRequires: magma-devel numactl-devel +BuildRequires: chrpath + +Requires: cuda-cudart-%{vcu_maj}-%{vcu_min} +Requires: cuda-nvrtc-%{vcu_maj}-%{vcu_min} +Requires: cuda-nvtx-%{vcu_maj}-%{vcu_min} +Requires: libcublas-%{vcu_maj}-%{vcu_min} +Requires: libcufft-%{vcu_maj}-%{vcu_min} +Requires: libcurand-%{vcu_maj}-%{vcu_min} +Requires: libcusparse-%{vcu_maj}-%{vcu_min} +Requires: libcusolver-%{vcu_maj}-%{vcu_min} +Requires: libnvjitlink-%{vcu_maj}-%{vcu_min} + +Provides: pytorch-python3 = %{version}-%{release} +Obsoletes: pytorch-python3 < %{version}-%{release} + +%description +PyTorch is a python package that provides two high-level +features for Torch. + +%package devel +Summary: Development files for pytorch +Requires: %{name} = %{version}-%{release} + +%description devel +This package contains development files for pythorch. + +%prep +%setup -q -n %{name}-v%{version} +%patch0 -p1 + +%build +export BUILD_TEST=False +export PYTORCH_BUILD_VERSION=%{version} +export PYTORCH_BUILD_NUMBER=1 +export CUDAARCHS="all" +export CMAKE_CUDA_COMPILER=/usr/local/cuda-%{vcu_maj}.%{vcu_min}/bin/nvcc +export TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6" +export CFLAGS="${CFLAGS} -Wno-maybe-uninitialized -Wno-uninitialized -Wno-free-nonheap-object -Wno-restrict" +export CXXFLAGS=$CFLAGS + +python3 setup.py build + +%install +export BUILD_TEST=False +export PYTORCH_BUILD_VERSION=%{version} +export PYTORCH_BUILD_NUMBER=1 +export CUDAARCHS="all" +export CMAKE_CUDA_COMPILER=/usr/local/cuda-%{vcu_maj}.%{vcu_min}/bin/nvcc +export TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6" +export CFLAGS="${CFLAGS} -Wno-maybe-uninitialized -Wno-uninitialized -Wno-free-nonheap-object -Wno-restrict" +export CXXFLAGS=$CFLAGS + +mkdir %{buildroot}/usr +python3 setup.py install --prefix %{buildroot}/usr + +chrpath -d %{buildroot}/%{python3_sitearch}/torch/lib/* +chrpath -d %{buildroot}/%{python3_sitearch}/torch/bin/* +chrpath -d %{buildroot}/%{python3_sitearch}/nvfuser/*.so +chrpath -d %{buildroot}/%{python3_sitearch}/functorch/*.so + +mkdir -p %{buildroot}/etc/ld.so.conf.d +echo "%{python3_sitearch}/torch/lib" > %{buildroot}/etc/ld.so.conf.d/torch.conf + +%ldconfig_scriptlets + +%pretrans -p +path = "/usr/lib64/python3.10/site-packages/torch/lib" +st = posix.stat(path) +if st and st.type == "link" then + os.remove(path) +end + +%pretrans devel -p +path = "/usr/lib64/python3.10/site-packages/torch/include" +st = posix.stat(path) +if st and st.type == "link" then + os.remove(path) +end + +%files +%doc README.md +%doc CONTRIBUTING.md +%license LICENSE +%{_bindir}/* +%{python3_sitearch}/* +%exclude %{python3_sitearch}/torch/include +%exclude %{python3_sitearch}/torch/share +/etc/ld.so.conf.d/torch.conf + +%files devel +%license LICENSE +%{python3_sitearch}/torch/include +%{python3_sitearch}/torch/share + +%changelog +* Tue Aug 29 2023 Chunmei Xu - 2.1.0-1 +- upgrade to v2.1.0 to solve issue with CUDA12 + +* Tue Aug 29 2023 Chunmei Xu - 2.0.1-3 +- reflator spec file + +* Tue Jul 18 2023 Chunmei Xu - 2.0.1-2 +- build with cuda support + +* Fri Jun 16 2023 forrest_ly - 2.0.1-1 +- init for anolis 23 diff --git a/0001-patch.patch b/0001-patch.patch new file mode 100644 index 0000000000000000000000000000000000000000..9a573759f804067b5dbfd4027ee87e8418d29849 --- /dev/null +++ b/0001-patch.patch @@ -0,0 +1,29 @@ +From 2a7950d0bf39c89f7b1581dd7e42a5352039c3aa Mon Sep 17 00:00:00 2001 +From: Your Name +Date: Wed, 1 Nov 2023 15:36:52 +0800 +Subject: [PATCH] Remove buggy cuda version conflict detection + +--- + cmake/public/cuda.cmake | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake +index 32f3ba3..f5eebad 100644 +--- a/cmake/public/cuda.cmake ++++ b/cmake/public/cuda.cmake +@@ -60,12 +60,6 @@ find_package(CUDAToolkit REQUIRED) + + cmake_policy(POP) + +-if(NOT CMAKE_CUDA_COMPILER_VERSION STREQUAL CUDAToolkit_VERSION OR +- NOT CUDA_INCLUDE_DIRS STREQUAL CUDAToolkit_INCLUDE_DIR) +- message(FATAL_ERROR "Found two conflicting CUDA installs:\n" +- "V${CMAKE_CUDA_COMPILER_VERSION} in '${CUDA_INCLUDE_DIRS}' and\n" +- "V${CUDAToolkit_VERSION} in '${CUDAToolkit_INCLUDE_DIR}'") +-endif() + + if(NOT TARGET CUDA::nvToolsExt) + message(FATAL_ERROR "Failed to find nvToolsExt") +-- +2.40.1 + diff --git a/pytorch-v2.1.0.tar.gz b/pytorch-v2.1.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..60fac5dabf7274461d6fdf8ada1bf8efae703df0 Binary files /dev/null and b/pytorch-v2.1.0.tar.gz differ diff --git a/pytorch.spec b/pytorch.spec index 3104847d3ba08ff6ef47c484a4f4ae2f1d7dbe39..f67a2c256edec5ffb9d6cc1afa1168589d2043d5 100644 --- a/pytorch.spec +++ b/pytorch.spec @@ -1,4 +1,4 @@ -%define anolis_release 3 +%define anolis_release 1 %global vcu_maj 12 %global vcu_min 1 @@ -10,13 +10,14 @@ %undefine _missing_build_ids_terminate_build Name: pytorch -Version: 2.0.1 +Version: 2.1.0 Release: %{anolis_release}%{dist} Summary: PyTorch Neural Network Package License: BSD URL: https://pytorch.org Source0: https://github.com/pytorch/pytorch/releases/download/v%{version}/pytorch-v%{version}.tar.gz +Patch0: 0001-patch.patch BuildRequires: python3-devel cmake gcc-c++ BuildRequires: python3-typing-extensions python3-pyyaml python3-setuptools @@ -67,7 +68,7 @@ This package contains development files for pythorch. %prep %setup -q -n %{name}-v%{version} - +%patch0 -p1 %build export BUILD_TEST=False @@ -134,6 +135,9 @@ end %{python3_sitearch}/torch/share %changelog +* Tue Aug 29 2023 Chunmei Xu - 2.1.0-1 +- upgrade to v2.1.0 to solve issue with CUDA12 + * Tue Aug 29 2023 Chunmei Xu - 2.0.1-3 - reflator spec file