Fix torchaudio build when TORCH_CUDA_ARCH_LIST is not set (#161084)

Fixes https://github.com/pytorch/pytorch/issues/160988.  The root cause can be found in the same issue.  This fix ensures that when reuse old wheel is on and `torchaudio` wheel is not there, the inductor test job can still rebuild the wheel it needs
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161084
Approved by: https://github.com/malfet, https://github.com/zou3519
This commit is contained in:
Huy Do
2025-08-21 03:47:15 +00:00
committed by PyTorch MergeBot
parent 117f11adb4
commit cfdaaaaa26

View File

@ -152,6 +152,12 @@ function get_pinned_commit() {
function install_torchaudio() {
local commit
commit=$(get_pinned_commit audio)
# TODO (huydhn): PyTorch CI docker image set the default TORCH_CUDA_ARCH_LIST
# to Maxwell. This default doesn't make sense anymore and should be cleaned up
if [[ "${BUILD_ENVIRONMENT}" == *cuda* ]]; then
TORCH_CUDA_ARCH_LIST=$(nvidia-smi --query-gpu=compute_cap --format=csv | tail -n 1)
export TORCH_CUDA_ARCH_LIST
fi
pip_build_and_install "git+https://github.com/pytorch/audio.git@${commit}" dist/audio
}