Repository: pytorch
Issue: Redefinition of `cub` namespace misses Debug
Labels: module: build,module: cuda,triaged

### 🐛 Describe the bug

While compiling PyTorch 1.10.1 from source with CUDA 11.5 and GCC 11.2.0, I get these errors

```
[5454/6571] Building NVCC (Device) object caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/ATen/native/cuda/torch_cuda_generated_SegmentReduce.cu.o
FAILED: caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/ATen/native/cuda/torch_cuda_generated_SegmentReduce.cu.o /dev/shm/strube1/juwelsbooster/PyTorch/1.10.1/gcccoremkl-11.2.0-2021.4.0-CUDA-11.5/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/ATen/native/cuda/torch_cuda_generated_SegmentReduce.cu.o 
cd /dev/shm/strube1/juwelsbooster/PyTorch/1.10.1/gcccoremkl-11.2.0-2021.4.0-CUDA-11.5/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/ATen/native/cuda && /p/software/juwelsbooster/stages/2022/software/CMake/3.21.1-GCCcore-11.2.0/bin/cmake -E make_directory /dev/shm/strube1/juwelsbooster/PyTorch/1.10.1/gcccoremkl-11.2.0-2021.4.0-CUDA-11.5/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/ATen/native/cuda/. && /p/software/juwelsbooster/stages/2022/software/CMake/3.21.1-GCCcore-11.2.0/bin/cmake -D verbose:BOOL=OFF -D build_configuration:STRING=Release -D generated_file:STRING=/dev/shm/strube1/juwelsbooster/PyTorch/1.10.1/gcccoremkl-11.2.0-2021.4.0-CUDA-11.5/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/ATen/native/cuda/./torch_cuda_generated_SegmentReduce.cu.o -D generated_cubin_file:STRING=/dev/shm/strube1/juwelsbooster/PyTorch/1.10.1/gcccoremkl-11.2.0-2021.4.0-CUDA-11.5/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/ATen/native/cuda/./torch_cuda_generated_SegmentReduce.cu.o.cubin.txt -P /dev/shm/strube1/juwelsbooster/PyTorch/1.10.1/gcccoremkl-11.2.0-2021.4.0-CUDA-11.5/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/ATen/native/cuda/torch_cuda_generated_SegmentReduce.cu.o.Release.cmake
/p/software/juwelsbooster/stages/2022/software/CUDA/11.5/include/cub/block/../iterator/../util_device.cuh(150): error: namespace "cub" has no member "Debug"

/p/software/juwelsbooster/stages/2022/software/CUDA/11.5/include/cub/block/../iterator/../util_device.cuh(156): error: namespace "cub" has no member "Debug"

/p/software/juwelsbooster/stages/2022/software/CUDA/11.5/include/cub/block/../iterator/../util_device.cuh(435): error: namespace "cub" has no member "Debug"

/p/software/juwelsbooster/stages/2022/software/CUDA/11.5/include/cub/block/../iterator/../util_device.cuh(512): error: namespace "cub" has no member "Debug"

/p/software/juwelsbooster/stages/2022/software/CUDA/11.5/include/cub/block/../iterator/../util_device.cuh(573): error: namespace "cub" has no member "Debug"

/p/software/juwelsbooster/stages/2022/software/CUDA/11.5/include/cub/util_allocator.cuh(364): error: namespace "cub" has no member "Debug"

/p/software/juwelsbooster/stages/2022/software/CUDA/11.5/include/cub/util_allocator.cuh(413): error: namespace "cub" has no member "Debug"
```



### Versions

We build all software for the JUWELS BOOSTER supercomputer (#8 in the world) from source once a year. For this year's stage, we settled with GCC 11.2.0 and CUDA 11.5 - the current version of PyTorch as of Jan 2021 is 1.10.1, so this is the one I'm attemping. The versions of the software being called for this build are:

```python
    ('GCC', '11.2.0),
    ('CUDA', '11.5', '', True),
    ('Ninja', '1.10.2'),  # Required for JIT compilation of C++ extensions
    ('Python', '3.9.6'),
    ('protobuf', '3.17.3'),
    ('protobuf-python', '3.17.3'),
    ('pybind11', '2.7.1'),
    ('SciPy-bundle', '2021.10'),
    ('typing-extensions', '3.10.0.0'),
    ('PyYAML', '5.4.1'),
    ('MPFR', '4.1.0'),
    ('GMP', '6.2.1'),
    ('numactl', '2.0.14', '', SYSTEM),
    ('FFmpeg', '4.4.1'),
    ('Pillow-SIMD', '8.3.1'),
    ('cuDNN', '8.3.1.22', '-CUDA-%(cudaver)s', True),
    ('magma', '2.6.1', '-CUDA-%(cudaver)s'),
    ('NCCL', '2.11.4', '-CUDA-%(cudaver)s'),
    ('expecttest', '0.1.3'),
```

cc @malfet @seemethere @ngimel