Repository: pytorch
Issue: Build from source failed with error of different gpu architecture (compiler shows sm_30-related error but I use sm_86 GPU)
Labels: module: build,module: cuda,triaged

### 🐛 Describe the bug

## Purpose
I'd like to use pytorch with cuda 11.7.

## Summary
The compiler shows that "Value 'sm_30' is not defined for option 'gpu-name'" but I am using 2x RTX 3090 which is sm_86 architecture.

## Detail
I tried to build by refering [here](https://github.com/pytorch/pytorch#from-source). I'm sure to install `magma-cuda117` .

The output is below.
Whole logs are at [CMakeOutput.log](https://gist.github.com/somisawa/cf7456db96efed3331cbd7911d75a85e) and [CMakeError.log](https://gist.github.com/somisawa/b7cd34287edab5fc049e5973cf667f65)

```bash
Building wheel torch-1.13.0a0+git71dddec
-- Building version 1.13.0a0+git71dddec
cmake -GNinja -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/sota_misawa/workspace/torch-diffusion/pytorch/torch -DCMAKE_PREFIX_PATH=/home/sota_misawa/.pyenv/versions/3.9.7/lib/python3.9/site-packages;/home/sota_misawa/anaconda3/envs/torch-diffusion -DNUMPY_INCLUDE_DIR=/home/sota_misawa/.pyenv/versions/3.9.7/lib/python3.9/site-packages/numpy/core/include -DPYTHON_EXECUTABLE=/home/sota_misawa/.pyenv/versions/3.9.7/bin/python -DPYTHON_INCLUDE_DIR=/home/sota_misawa/.pyenv/versions/3.9.7/include/python3.9 -DPYTHON_LIBRARY=/home/sota_misawa/.pyenv/versions/3.9.7/lib/libpython3.9.a -DTORCH_BUILD_VERSION=1.13.0a0+git71dddec -DUSE_NUMPY=True /home/sota_misawa/workspace/torch-diffusion/pytorch
-- Could not find ccache. Consider installing ccache to speed up compilation.
-- std::exception_ptr is supported.
-- Current compiler supports avx2 extension. Will build perfkernels.
-- Current compiler supports avx512f extension. Will build fbgemm.
-- The CUDA compiler identification is unknown
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - failed
-- Check for working CUDA compiler: /usr/bin/nvcc
-- Check for working CUDA compiler: /usr/bin/nvcc - broken
CMake Error at /home/sota_misawa/.pyenv/versions/3.9.7/lib/python3.9/site-packages/cmake/data/share/cmake-3.21/Modules/CMakeTestCUDACompiler.cmake:56 (message):
  The CUDA compiler

    "/usr/bin/nvcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/sota_misawa/workspace/torch-diffusion/pytorch/build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/home/sota_misawa/anaconda3/envs/torch-diffusion/bin/ninja cmTC_5ec83 && [1/2] Building CUDA object CMakeFiles/cmTC_5ec83.dir/main.cu.o
    FAILED: CMakeFiles/cmTC_5ec83.dir/main.cu.o 
    /usr/bin/nvcc    -Xfatbin -compress-all  -c /home/sota_misawa/workspace/torch-diffusion/pytorch/build/CMakeFiles/CMakeTmp/main.cu -o CMakeFiles/cmTC_5ec83.dir/main.cu.o
    ptxas fatal   : Value 'sm_30' is not defined for option 'gpu-name'
    ninja: build stopped: subcommand failed.
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  cmake/public/cuda.cmake:47 (enable_language)
  cmake/Dependencies.cmake:43 (include)
  CMakeLists.txt:725 (include)


-- Configuring incomplete, errors occurred!
See also "/home/sota_misawa/workspace/torch-diffusion/pytorch/build/CMakeFiles/CMakeOutput.log".
See also "/home/sota_misawa/workspace/torch-diffusion/pytorch/build/CMakeFiles/CMakeError.log".
```



### Versions

Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.4 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: Could not collect
CMake version: version 3.21.4
Libc version: glibc-2.31

Python version: 3.9.7 (default, Oct 30 2021, 00:56:25)  [GCC 9.3.0] (64-bit runtime)
Python platform: Linux-5.15.0-46-generic-x86_64-with-glibc2.31
Is CUDA available: N/A
CUDA runtime version: 11.7.64
GPU models and configuration: 
GPU 0: NVIDIA GeForce RTX 3090
GPU 1: NVIDIA GeForce RTX 3090

Nvidia driver version: 515.65.01
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

Versions of relevant libraries:
[pip3] denoising-diffusion-pytorch==0.27.11
[pip3] ema-pytorch==0.0.10
[pip3] mypy==0.910
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.23.3
[pip3] torch==1.12.1
[pip3] torchvision==0.13.1
[conda] blas                      1.0                         mkl  
[conda] magma-cuda117             2.6.1                         1    pytorch
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-include               2022.1.0           h06a4308_224  
[conda] mkl-service               2.4.0            py39h7f8727e_0  
[conda] mkl_fft                   1.3.1            py39hd3c417c_0  
[conda] mkl_random                1.2.2            py39h51133e4_0  
[conda] numpy                     1.23.1           py39h6c91a56_0  
[conda] numpy-base                1.23.1           py39ha15fc14_0 

cc @malfet @seemethere @ngimel