Repository: pytorch
Issue: internal compiler error compiling PyTorch master on Fedora 33
Labels: module: build,triaged,shadow review

## 🐛 Bug

I'm trying to build pytorch on Fedora 33 with cuda-toolkit-11-2 and receiving an "internal compiler error". I can file this elsewhere if you feel that would be more appropriate but thought it may be of interest even if the bug is elsewhere since the failure is during a pytorch compile.

## To Reproduce

Create the following Dockerfile:
```
FROM fedora:33

RUN dnf install -y \
    dnf-plugins-core \
    git \
    g++ \
    cmake3 \
    python3-wheel \
    python3-pyyaml \
    python3-devel \
    python3-typing-extensions \
    wget

RUN dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/fedora33/x86_64/cuda-fedora33.repo

RUN dnf install -y cuda-toolkit-11-2
```

Then reproduce the error with:
```
docker build -t fedora33pt .
docker run -it fedora33pt /bin/bash
cd /tmp
git clone https://github.com/pytorch/pytorch.git
cd pytorch
git submodule update --init --recursive
python3 setup.py bdist_wheel
```

The error message is:
>#8 327.9 [ 60%] Built target nccl_slim_external                                                                                                                                       
#8 340.4 /usr/include/c++/10/chrono: In substitution of ‘template<class _Rep, class _Period> template<class _Period2> using __is_harmonic = std::__bool_constant<(std::ratio<((_Period
2::num / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::num, _Period::num)) * (_Period::den / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::den, _Period::den))), ((_
Period2::den / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::den, _Period::den)) * (_Period::num / std::chrono::duration<_Rep, _Period>::_S_gcd(_Period2::num, _Period::num))
)>::den == 1)> [with _Period2 = _Period2; _Rep = _Rep; _Period = _Period]’:                                                                                                           
#8 340.4 /usr/include/c++/10/chrono:473:154:   required from here                                                                                                                     
#8 340.4 /usr/include/c++/10/chrono:428:27: internal compiler error: Segmentation fault                                                                                               
#8 340.4   428 |  _S_gcd(intmax_t __m, intmax_t __n) noexcept                                                                                                                         
#8 340.4       |                           ^~~~~~                                                                                                                                     
#8 340.4 Please submit a full bug report,                                                                                                                                             
#8 340.4 with preprocessed source if appropriate.                                                                                                                                     
#8 340.4 See <http://bugzilla.redhat.com/bugzilla> for instructions.     

## Expected behavior

No compiler error...

## Environment

```
# git rev-parse HEAD
82d245faef88c7aa5d5c47771801789c85a2165b
```

Output from collect_env.py:

> #8 2.016 Collecting environment information...
> #8 2.016 PyTorch version: N/A
> #8 2.016 Is debug build: N/A
> #8 2.016 CUDA used to build PyTorch: N/A
> #8 2.016 ROCM used to build PyTorch: N/A
> #8 2.016 
> #8 2.016 OS: Fedora 33 (Container Image) (x86_64)
> #8 2.016 GCC version: (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1)
> #8 2.016 Clang version: Could not collect
> #8 2.016 CMake version: version 3.19.7
> #8 2.016 
> #8 2.016 Python version: 3.9 (64-bit runtime)
> #8 2.016 Is CUDA available: N/A
> #8 2.016 CUDA runtime version: 11.2.152
> #8 2.016 GPU models and configuration: Could not collect
> #8 2.016 Nvidia driver version: Could not collect
> #8 2.016 cuDNN version: Could not collect
> #8 2.016 HIP runtime version: N/A
> #8 2.016 MIOpen runtime version: N/A
> #8 2.016 
> #8 2.016 Versions of relevant libraries:
> #8 2.016 [pip] Could not collect
> #8 2.016 [conda] Could not collect



cc @malfet @seemethere @walterddr @ezyang