Build on EPEL

Signed-off-by: Tom Rix <Tom.Rix@amd.com>
This commit is contained in:
Tom Rix 2025-08-14 09:10:18 -07:00
commit 1b986b4993
3 changed files with 44 additions and 15 deletions

1
.gitignore vendored
View file

@ -25,3 +25,4 @@
/v24.12.23.tar.gz
/kineto-5e75018.tar.gz
/pytorch-v2.8.0.tar.gz
/v1.18.0.tar.gz

View file

@ -48,6 +48,12 @@
%bcond_with httplib
%bcond_with kineto
%if 0%{?fedora}
%bcond_without onnx
%else
%bcond_with onnx
%endif
Name: python-%{pypi_name}
%if %{with gitcommit}
Version: %{pypi_version}^git%{date0}.%{shortcommit0}
@ -97,6 +103,11 @@ Source70: https://github.com/yhirose/cpp-httplib/archive/%{hl_commit}/cpp-
Source80: https://github.com/pytorch/kineto/archive/%{ki_commit}/kineto-%{ki_scommit}.tar.gz
%endif
%if %{without onnx}
%global ox_ver 1.18.0
Source90: https://github.com/onnx/onnx/archive/refs/tags/v%{ox_ver}.tar.gz
%endif
# https://github.com/pytorch/pytorch/issues/150187
Patch11: 0001-Add-cmake-variable-USE_ROCM_CK.patch
# https://github.com/pytorch/pytorch/issues/156595
@ -123,7 +134,9 @@ BuildRequires: json-devel
BuildRequires: libomp-devel
BuildRequires: numactl-devel
BuildRequires: ninja-build
%if %{with onnx}
BuildRequires: onnx-devel
%endif
%if %{with mpi}
BuildRequires: openmpi-devel
%endif
@ -304,6 +317,12 @@ rm -rf third_party/kineto/*
cp -r kineto-*/* third_party/kineto/
%endif
%if %{without onnx}
tar xf %{SOURCE90}
rm -rf third_party/onnx/*
cp -r onnx-*/* third_party/onnx/
%endif
# Adjust for the hipblaslt's we build
sed -i -e 's@"gfx90a", "gfx940", "gfx941", "gfx942"@"gfx90a", "gfx1103", "gfx1150", "gfx1151", "gfx1100", "gfx1101", "gfx1200", "gfx1201"@' aten/src/ATen/native/cuda/Blas.cpp
@ -393,6 +412,10 @@ mv third_party/cpp-httplib .
mv third_party/kineto .
%endif
%if %{without onnx}
mv third_party/onnx .
%endif
%if %{with test}
mv third_party/googletest .
%endif
@ -421,6 +444,10 @@ mv cpp-httplib third_party
mv kineto third_party
%endif
%if %{without onnx}
mv onnx third_party
%endif
%if %{with test}
mv googletest third_party
%endif
@ -448,7 +475,6 @@ sed -i -e 's@cmake_minimum_required(VERSION 3.4)@cmake_minimum_required(VERSION
sed -i -e 's@cmake_minimum_required(VERSION 3.1)@cmake_minimum_required(VERSION 3.5)@' third_party/opentelemetry-cpp/CMakeLists.txt
%endif
%if %{with rocm}
# hipify
./tools/amd_build/build_amd.py
@ -534,7 +560,9 @@ export USE_PYTORCH_QNNPACK=OFF
export USE_ROCM=OFF
export USE_SYSTEM_SLEEF=ON
export USE_SYSTEM_EIGEN_INSTALL=ON
%if %{with onnx}
export USE_SYSTEM_ONNX=ON
%endif
export USE_SYSTEM_PYBIND11=OFF
export USE_SYSTEM_LIBS=OFF
export USE_SYSTEM_NCCL=OFF
@ -575,7 +603,6 @@ export BUILD_TEST=ON
#
# See BZ 2244862
%if %{with rocm}
export USE_ROCM=ON
@ -590,14 +617,15 @@ export DEVICE_LIB_PATH=${RESOURCE_DIR}/amdgcn/bitcode
export HIP_CLANG_PATH=%{rocmllvm_bindir}
export PYTORCH_ROCM_ARCH=%{rocm_gpu_list_default}
%pyproject_wheel
%else
%pyproject_wheel
%endif
%if 0%{?fedora}
%pyproject_wheel
%else
%py3_build
%endif
%install
%if %{with rocm}
@ -611,16 +639,15 @@ export DEVICE_LIB_PATH=${RESOURCE_DIR}/amdgcn/bitcode
# pytorch uses clang, not hipcc
export HIP_CLANG_PATH=%{rocmllvm_bindir}
export PYTORCH_ROCM_ARCH=%{rocm_gpu_list_default}
%pyproject_install
%pyproject_save_files '*torch*'
%else
%pyproject_install
%pyproject_save_files '*torch*'
%endif
%if 0%{?fedora}
%pyproject_install
%pyproject_save_files '*torch*'
%else
%py3_install
%endif
%check

View file

@ -11,3 +11,4 @@ SHA512 (pytorch-a1cb3cc.tar.gz) = 92bf8b2c2ef0b459406b60169ecebdc50652c75943e3d6
SHA512 (v24.12.23.tar.gz) = f97762ba41b9cfef648e93932fd789324c6bb6ebc5b7aeca8185c9ef602294b67d73aea7ae371035579a1419cbfbeba7c3e88b31b5a5848db98f5e8a03b982b1
SHA512 (kineto-5e75018.tar.gz) = 921b96a56e01d69895b79e67582d8977ed6f873573ab41557c5d026ada5d1f6365e4ed0a0c6804057c52e92510749fc58619f554a164c1ba9d8cd13e789bebd0
SHA512 (pytorch-v2.8.0.tar.gz) = 791e658eab87fb957f025558cb9f925078d2426ab7b6f60771d9841dfb691f67d905ba1330a800008efe7c938b6c69bdc52232bccfe8d4860e795a532cd69d28
SHA512 (v1.18.0.tar.gz) = 2f38664947c8d1efc40620a7c1b1953d2aa4b0a37b67c4886b86e77c1d697363c26413413ddda8eabc545892fb1bcb43afc7e93e62f0901527524a2727e1ea8d