Need help building Pytorch from source

nvcc fatal   : Unsupported gpu architecture 'compute_35'

Remove this deprecated architecture from your build and specify the needed ones via TORCH_CUDA_ARCH_LIST.

How to remove compute_35 from the build?

You can specify compute capability using:

TORCH_CUDA_ARCH_LIST="8.6" python setup.py install

Please change it to your desired version.

I tried with 8.6, 9.0, 12.2:

TORCH_CUDA_ARCH_LIST=“8.6” python setup.py install
TORCH_CUDA_ARCH_LIST=“9.0” python setup.py install
TORCH_CUDA_ARCH_LIST=“12.2” python setup.py install

All of them returned this error:

(base) notooth@localhost:pytorch$ TORCH_CUDA_ARCH_LIST="8.6" python setup.py install
Building wheel torch-2.1.0a0+gitfe1f26a
-- Building version 2.1.0a0+gitfe1f26a
cmake --build . --target install --config Release
[12/2618] Performing build step for 'nccl_external'
FAILED: nccl_external-prefix/src/nccl_external-stamp/nccl_external-build nccl/lib/libnccl_static.a /mnt/Archive/Downloads/1/pytorch/build/nccl_external-prefix/src/nccl_external-stamp/nccl_external-build /mnt/Archive/Downloads/1/pytorch/build/nccl/lib/libnccl_static.a 
cd /mnt/Archive/Downloads/1/pytorch/third_party/nccl/nccl && make -j12 -l12 CXX=/usr/bin/c++ CUDA_HOME=/usr/local/cuda-12.2 NVCC=/usr/local/cuda-12.2/bin/nvcc "NVCC_GENCODE=-gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_89,code=sm_89 -gencode=arch=compute_90,code=sm_90" BUILDDIR=/mnt/Archive/Downloads/1/pytorch/build/nccl VERBOSE=0 DEBUG=0 && /home/notooth/miniconda3/bin/cmake -E touch /mnt/Archive/Downloads/1/pytorch/build/nccl_external-prefix/src/nccl_external-stamp/nccl_external-build
make -C src build BUILDDIR=/mnt/Archive/Downloads/1/pytorch/build/nccl
make[1]: Entering directory '/mnt/Archive/Downloads/1/pytorch/third_party/nccl/nccl/src'
NVCC_GENCODE is -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_89,code=sm_89 -gencode=arch=compute_90,code=sm_90
Compiling  transport.cc                        > /mnt/Archive/Downloads/1/pytorch/build/nccl/obj/transport.o
make[2]: Entering directory '/mnt/Archive/Downloads/1/pytorch/third_party/nccl/nccl/src/collectives/device'
NVCC_GENCODE is -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_89,code=sm_89 -gencode=arch=compute_90,code=sm_90
nvcc fatal   : Unsupported gpu architecture 'compute_35'
make[2]: *** [Makefile:53: /mnt/Archive/Downloads/1/pytorch/build/nccl/obj/collectives/device/sendrecv.dep] Error 1
make[2]: Leaving directory '/mnt/Archive/Downloads/1/pytorch/third_party/nccl/nccl/src/collectives/device'
make[1]: *** [Makefile:58: /mnt/Archive/Downloads/1/pytorch/build/nccl/obj/collectives/device/colldevice.a] Error 2
make[1]: Leaving directory '/mnt/Archive/Downloads/1/pytorch/third_party/nccl/nccl/src'
make: *** [Makefile:25: src.build] Error 2
[37/2618] Building CXX object third_party/ideep/mkl-dnn/src/cpu/x64/CMakeFiles/dnnl_cpu_x64.dir/gemm/s8x8s32/jit_avx512_core_u8_copy_at_kern_autogen.cpp.o
ninja: build stopped: subcommand failed.

Have you tried cleaning the previous build and then rebuilding it? If not, please do that.

I successfully built Pytorch from source, but I got an error when running it:

RuntimeError: The NVIDIA driver on your system is too old (found version 11040). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver.

Looks like you need to update your CUDA driver. The link is provided in the error message.

I currently have NVIDIA driver 470.199.02 and CUDA toolkit 12.2 on my system. It is the latest driver for Quadro K600.