Skip to content

Commit d88413e

Browse files
committed
specify arches for CUDA 13; add fatbin compression
1 parent fe864d4 commit d88413e

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

recipe/bld.bat

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,19 @@ if not "%cuda_compiler_version%" == "None" (
9393
set USE_NCCL=0
9494
set USE_STATIC_NCCL=0
9595

96-
@REM set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%desired_cuda%
97-
@REM set CUDA_BIN_PATH=%CUDA_PATH%\bin
98-
99-
set "TORCH_CUDA_ARCH_LIST=5.0;6.0;7.0;7.5;8.0;8.6;9.0;10.0;12.0+PTX"
10096
set "TORCH_NVCC_FLAGS=-Xfatbin -compress-all"
10197

98+
if "%cuda_compiler_version:~0,2%"=="12" (
99+
set "TORCH_CUDA_ARCH_LIST=5.0;6.0;7.0;7.5;8.0;8.6;9.0;10.0;12.0+PTX"
100+
) else if "%cuda_compiler_version%" == "13.0" (
101+
set "TORCH_CUDA_ARCH_LIST=7.5;8.0;8.6;9.0;10.0;11.0;12.0+PTX"
102+
REM c.f. https://github.com/pytorch/pytorch/pull/161316
103+
set "TORCH_NVCC_FLAGS=!TORCH_NVCC_FLAGS! -compress-mode=size"
104+
) else (
105+
echo "unsupported cuda version. edit build_pytorch.bat"
106+
exit /b 1
107+
)
108+
102109
set MAGMA_HOME=%LIBRARY_PREFIX%
103110
set "PATH=%CUDA_BIN_PATH%;%PATH%"
104111
set CUDNN_INCLUDE_DIR=%LIBRARY_PREFIX%\include

recipe/build.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ elif [[ ${cuda_compiler_version} != "None" ]]; then
212212
export CUDAToolkit_TARGET_DIR=${PREFIX}/targets/${CUDA_TARGET}
213213
sed -i -e "s,@CUDA_TARGET@,${CUDA_TARGET}," torch/_inductor/cpp_builder.py
214214

215+
export TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
216+
215217
# Compatibility matrix for update: https://en.wikipedia.org/wiki/CUDA#GPUs_supported
216218
# Warning from pytorch v1.12.1: In the future we will require one to
217219
# explicitly pass TORCH_CUDA_ARCH_LIST to cmake instead of implicitly
@@ -227,11 +229,16 @@ elif [[ ${cuda_compiler_version} != "None" ]]; then
227229
12.[89])
228230
export TORCH_CUDA_ARCH_LIST="5.0;6.0;7.0;7.5;8.0;8.6;9.0;10.0;12.0+PTX"
229231
;;
232+
13.0)
233+
export TORCH_CUDA_ARCH_LIST="7.5;8.0;8.6;9.0;10.0;11.0;12.0+PTX"
234+
# c.f. https://github.com/pytorch/pytorch/pull/161316
235+
export TORCH_NVCC_FLAGS="$TORCH_NVCC_FLAGS -compress-mode=size"
236+
;;
230237
*)
231238
echo "No CUDA architecture list exists for CUDA v${cuda_compiler_version}. See build.sh for information on adding one."
232239
exit 1
233240
esac
234-
export TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
241+
235242
export NCCL_ROOT_DIR=$PREFIX
236243
export NCCL_INCLUDE_DIR=$PREFIX/include
237244
export USE_SYSTEM_NCCL=1

0 commit comments

Comments
 (0)