Skip to content

Commit

Permalink
Explicitly set TORCH_CUDA_ARCH_LIST in packages depending on pytorch
Browse files Browse the repository at this point in the history
  • Loading branch information
iarspider committed Jul 11, 2024
1 parent 69254bb commit e5fb08f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
19 changes: 16 additions & 3 deletions pytorch-cluster.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
### RPM external pytorch-cluster 1.6.3
## INCLUDE compilation_flags
## INCLUDE cpp-standard
## INCLUDE cuda-flags

%define tag f2d99195a0003ca2d2ba9ed50d0117e2f23360e0
%define branch master
%define github_user rusty1s
Expand All @@ -9,19 +11,26 @@ Source: git+https://github.com/%{github_user}/pytorch_cluster.git?obj=%{branch}/

BuildRequires: cmake
Requires: pytorch
%define build_flags -Wall -Wextra -pedantic %{?arch_build_flags}
%define build_flags -Wall -Wextra -pedantic %{?arch_build_flags}
%define cuda_arch_float $(echo %{cuda_arch} | tr ' ' '\\n' | sed -E 's|([0-9])$|.\\1|' | tr '\\n' ' ')

%prep
%setup -n %{n}-%{realversion}
# Make sure the default c++sdt stand is c++14
grep -q 'CMAKE_CXX_STANDARD *14' CMakeLists.txt
sed -i -e 's|CMAKE_CXX_STANDARD *14|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' CMakeLists.txt

USE_CUDA=OFF
%if "%{cmsos}" != "slc7_aarch64"
if [ "%{cuda_gcc_support}" = "true" ] ; then
USE_CUDA=%{!?without_cuda:ON}
fi
%endif

%build

rm -rf ../build && mkdir ../build && cd ../build


cmake ../%{n}-%{realversion} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=%{i} \
Expand All @@ -33,7 +42,11 @@ cmake ../%{n}-%{realversion} \
-DWITH_PYTHON=OFF \
-DWITH_CUDA=OFF \
-DBUILD_TEST=OFF \
-DBUILD_SHARED_LIBS=ON
%if 0%{!?without_cuda:1}
-DUSE_CUDA=${USE_CUDA} \
-DTORCH_CUDA_ARCH_LIST="%{cuda_arch_float}" \
%endif
-DBUILD_SHARED_LIBS=ON


make %{makeprocesses} VERBOSE=1
Expand Down
17 changes: 15 additions & 2 deletions pytorch-scatter.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### RPM external pytorch-scatter 2.1.2
## INCLUDE compilation_flags
## INCLUDE cpp-standard
## INCLUDE cuda-flags
%define tag c095c62e4334fcd05e4ac3c4bb09d285960d6be6
%define branch master
%define github_user rusty1s
Expand All @@ -9,14 +10,22 @@ Source: git+https://github.com/%{github_user}/pytorch_scatter.git?obj=%{branch}/

BuildRequires: cmake
Requires: pytorch
%define build_flags -Wall -Wextra -pedantic %{?arch_build_flags}
%define build_flags -Wall -Wextra -pedantic %{?arch_build_flags}
%define cuda_arch_float $(echo %{cuda_arch} | tr ' ' '\\n' | sed -E 's|([0-9])$|.\\1|' | tr '\\n' ' ')

%prep
%setup -n %{n}-%{realversion}
# Make sure the default c++sdt stand is c++14
grep -q 'CMAKE_CXX_STANDARD *14' CMakeLists.txt
sed -i -e 's|CMAKE_CXX_STANDARD *14|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' CMakeLists.txt

USE_CUDA=OFF
%if "%{cmsos}" != "slc7_aarch64"
if [ "%{cuda_gcc_support}" = "true" ] ; then
USE_CUDA=%{!?without_cuda:ON}
fi
%endif

%build

rm -rf ../build && mkdir ../build && cd ../build
Expand All @@ -33,7 +42,11 @@ cmake ../%{n}-%{realversion} \
-DWITH_PYTHON=OFF \
-DWITH_CUDA=OFF \
-DBUILD_TEST=OFF \
-DBUILD_SHARED_LIBS=ON
%if 0%{!?without_cuda:1}
-DUSE_CUDA=${USE_CUDA} \
-DTORCH_CUDA_ARCH_LIST="%{cuda_arch_float}" \
%endif
-DBUILD_SHARED_LIBS=ON


make %{makeprocesses} VERBOSE=1
Expand Down
18 changes: 16 additions & 2 deletions pytorch-sparse.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
### RPM external pytorch-sparse 0.6.18
## INCLUDE compilation_flags
## INCLUDE cpp-standard
## INCLUDE cuda-flags

%define tag 2d559810c6af7f8b2cf88553dd5a5824a667a07d
%define branch master
%define github_user rusty1s
Expand All @@ -9,14 +11,22 @@ Source: git+https://github.com/%{github_user}/pytorch_sparse.git?obj=%{branch}/%

BuildRequires: cmake
Requires: pytorch
%define build_flags -Wall -Wextra -pedantic %{?arch_build_flags}
%define build_flags -Wall -Wextra -pedantic %{?arch_build_flags}
%define cuda_arch_float $(echo %{cuda_arch} | tr ' ' '\\n' | sed -E 's|([0-9])$|.\\1|' | tr '\\n' ' ')

%prep
%setup -n %{n}-%{realversion}
# Make sure the default c++sdt stand is c++14
grep -q 'CMAKE_CXX_STANDARD *14' CMakeLists.txt
sed -i -e 's|CMAKE_CXX_STANDARD *14|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' CMakeLists.txt

USE_CUDA=OFF
%if "%{cmsos}" != "slc7_aarch64"
if [ "%{cuda_gcc_support}" = "true" ] ; then
USE_CUDA=%{!?without_cuda:ON}
fi
%endif

%build

rm -rf ../build && mkdir ../build && cd ../build
Expand All @@ -33,7 +43,11 @@ cmake ../%{n}-%{realversion} \
-DWITH_PYTHON=OFF \
-DWITH_CUDA=OFF \
-DBUILD_TEST=OFF \
-DBUILD_SHARED_LIBS=ON
%if 0%{!?without_cuda:1}
-DUSE_CUDA=${USE_CUDA} \
-DTORCH_CUDA_ARCH_LIST="%{cuda_arch_float}" \
%endif
-DBUILD_SHARED_LIBS=ON


make %{makeprocesses} VERBOSE=1
Expand Down

0 comments on commit e5fb08f

Please sign in to comment.