Skip to content

Commit 707ee32

Browse files
authored
Merge pull request #9860 from fwyzard/IB/CMSSW_15_1_X/master_fix_pytorch
PyTorch: fix configuration of CUDA and cuDNN
2 parents 8e19101 + 014c03d commit 707ee32

File tree

4 files changed

+28
-31
lines changed

4 files changed

+28
-31
lines changed

pytorch-cluster.spec

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Source: git+https://github.com/%{github_user}/pytorch_cluster.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz
1111

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

@@ -20,15 +20,15 @@ Requires: pytorch
2020
grep -q 'CMAKE_CXX_STANDARD *14' CMakeLists.txt
2121
sed -i -e 's|CMAKE_CXX_STANDARD *14|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' CMakeLists.txt
2222

23+
%build
24+
2325
USE_CUDA=OFF
2426
%if 0%{!?without_cuda:1}
2527
if [ "%{cuda_gcc_support}" = "true" ] ; then
2628
USE_CUDA=ON
2729
fi
2830
%endif
2931

30-
%build
31-
3232
rm -rf ../build && mkdir ../build && cd ../build
3333

3434
cmake ../%{n}-%{realversion} \
@@ -38,17 +38,13 @@ cmake ../%{n}-%{realversion} \
3838
-DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \
3939
-DCMAKE_CXX_STANDARD=%{cms_cxx_standard} \
4040
-DCMAKE_CXX_FLAGS="%{build_flags}" \
41-
-DBUILD_TEST=OFF \
4241
-DWITH_PYTHON=OFF \
43-
-DWITH_CUDA=OFF \
44-
-DBUILD_TEST=OFF \
4542
%if 0%{!?without_cuda:1}
46-
-DUSE_CUDA=${USE_CUDA} \
43+
-DWITH_CUDA=${USE_CUDA} \
4744
-DTORCH_CUDA_ARCH_LIST="%{cuda_arch_float}" \
4845
%endif
4946
-DBUILD_SHARED_LIBS=ON
5047

51-
5248
make %{makeprocesses} VERBOSE=1
5349

5450
%install

pytorch-scatter.spec

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
## INCLUDE compilation_flags
33
## INCLUDE cpp-standard
44
## INCLUDE cuda-flags
5+
56
%define tag c095c62e4334fcd05e4ac3c4bb09d285960d6be6
67
%define branch master
78
%define github_user rusty1s
89

910
Source: git+https://github.com/%{github_user}/pytorch_scatter.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz
1011

1112
BuildRequires: cmake
12-
Requires: pytorch
13+
Requires: pytorch %{!?without_cuda:cuda}
1314
%define build_flags -Wall -Wextra -pedantic %{?arch_build_flags}
1415
%define cuda_arch_float $(echo %{cuda_arch} | tr ' ' '\\n' | sed -E 's|([0-9])$|.\\1|' | tr '\\n' ' ')
1516

@@ -19,18 +20,17 @@ Requires: pytorch
1920
grep -q 'CMAKE_CXX_STANDARD *14' CMakeLists.txt
2021
sed -i -e 's|CMAKE_CXX_STANDARD *14|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' CMakeLists.txt
2122

23+
%build
24+
2225
USE_CUDA=OFF
23-
%if "%{cmsos}" != "slc7_aarch64"
26+
%if 0%{!?without_cuda:1}
2427
if [ "%{cuda_gcc_support}" = "true" ] ; then
25-
USE_CUDA=%{!?without_cuda:ON}
28+
USE_CUDA=ON
2629
fi
2730
%endif
2831

29-
%build
30-
3132
rm -rf ../build && mkdir ../build && cd ../build
3233

33-
3434
cmake ../%{n}-%{realversion} \
3535
-DCMAKE_BUILD_TYPE=Release \
3636
-DCMAKE_INSTALL_PREFIX=%{i} \
@@ -40,15 +40,12 @@ cmake ../%{n}-%{realversion} \
4040
-DCMAKE_CXX_FLAGS="%{build_flags}" \
4141
-DBUILD_TEST=OFF \
4242
-DWITH_PYTHON=OFF \
43-
-DWITH_CUDA=OFF \
44-
-DBUILD_TEST=OFF \
4543
%if 0%{!?without_cuda:1}
46-
-DUSE_CUDA=${USE_CUDA} \
44+
-DWITH_CUDA=${USE_CUDA} \
4745
-DTORCH_CUDA_ARCH_LIST="%{cuda_arch_float}" \
4846
%endif
4947
-DBUILD_SHARED_LIBS=ON
5048

51-
5249
make %{makeprocesses} VERBOSE=1
5350

5451
%install

pytorch-sparse.spec

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Source: git+https://github.com/%{github_user}/pytorch_sparse.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz
1111

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

@@ -20,18 +20,17 @@ Requires: pytorch
2020
grep -q 'CMAKE_CXX_STANDARD *14' CMakeLists.txt
2121
sed -i -e 's|CMAKE_CXX_STANDARD *14|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' CMakeLists.txt
2222

23+
%build
24+
2325
USE_CUDA=OFF
2426
%if 0%{!?without_cuda:1}
2527
if [ "%{cuda_gcc_support}" = "true" ] ; then
2628
USE_CUDA=ON
2729
fi
2830
%endif
2931

30-
%build
31-
3232
rm -rf ../build && mkdir ../build && cd ../build
3333

34-
3534
cmake ../%{n}-%{realversion} \
3635
-DCMAKE_BUILD_TYPE=Release \
3736
-DCMAKE_INSTALL_PREFIX=%{i} \
@@ -41,15 +40,12 @@ cmake ../%{n}-%{realversion} \
4140
-DCMAKE_CXX_FLAGS="%{build_flags}" \
4241
-DBUILD_TEST=OFF \
4342
-DWITH_PYTHON=OFF \
44-
-DWITH_CUDA=OFF \
45-
-DBUILD_TEST=OFF \
4643
%if 0%{!?without_cuda:1}
47-
-DUSE_CUDA=${USE_CUDA} \
44+
-DWITH_CUDA=${USE_CUDA} \
4845
-DTORCH_CUDA_ARCH_LIST="%{cuda_arch_float}" \
4946
%endif
5047
-DBUILD_SHARED_LIBS=ON
5148

52-
5349
make %{makeprocesses} VERBOSE=1
5450

5551
%install

pytorch.spec

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## INCLUDE cuda-flags
33
## INCLUDE microarch_flags
44

5-
%define cuda_arch_float $(echo %{cuda_arch} | tr ' ' '\\n' | sed -E 's|([0-9])$|.\\1|' | tr '\\n' ' ')
5+
%define cuda_arch_float $(echo %{cuda_arch} | tr ' ' '\\n' | sed -E 's|([0-9])$|.\\1|' | tr '\\n' ' ' | sed -e's/ *$/+PTX/')
66

77
Source: git+https://github.com/pytorch/pytorch.git?obj=main/v%{realversion}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz
88
Source1: FindEigen3.cmake
@@ -35,6 +35,8 @@ fi
3535

3636
cmake ../%{n}-%{realversion} \
3737
-G Ninja \
38+
-Wno-dev \
39+
-L \
3840
-DCMAKE_INSTALL_PREFIX=%{i} \
3941
-DCMAKE_INSTALL_LIBDIR=lib \
4042
-DBUILD_TEST=OFF \
@@ -43,14 +45,20 @@ cmake ../%{n}-%{realversion} \
4345
%if 0%{!?without_cuda:1}
4446
-DUSE_CUDA=${USE_CUDA} \
4547
-DTORCH_CUDA_ARCH_LIST="%{cuda_arch_float}" \
46-
-DCUDNN_INCLUDE_DIR=${CUDNN_ROOT}/include \
47-
-DCUDNN_LIBRARY=${CUDNN_ROOT}/lib64/libcudnn.so \
48+
-DUSE_CUDNN=${USE_CUDA} \
49+
-DCUDNN_ROOT=${CUDNN_ROOT} \
50+
%else
51+
-DUSE_CUDA=OFF \
52+
-DUSE_CUDNN=OFF \
4853
%endif
54+
-DUSE_CUSPARSELT=OFF \
55+
-DUSE_CUDSS=OFF \
4956
-DUSE_NCCL=OFF \
57+
-DUSE_ROCM=OFF \
58+
-DUSE_XPU=OFF \
5059
-DUSE_FBGEMM=OFF \
5160
-DUSE_KINETO=OFF \
5261
-DUSE_MAGMA=OFF \
53-
-DUSE_METAL=OFF \
5462
-DUSE_MPS=OFF \
5563
-DUSE_NNPACK=OFF \
5664
-DUSE_QNNPACK=OFF \
@@ -80,7 +88,7 @@ cmake ../%{n}-%{realversion} \
8088
-DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \
8189
-DPYTHON_EXECUTABLE=${PYTHON3_ROOT}/bin/python3
8290

83-
ninja -v %{makeprocesses}
91+
ninja -v %{makeprocesses}
8492

8593
%install
8694
cd ../build

0 commit comments

Comments
 (0)