Repository: pytorch
Issue: Unable to compile from code v1.6.0
Labels: module: build,triaged

## 🐛 Bug

FAILED: caffe2/CMakeFiles/op_registration_test.dir/__/aten/src/ATen/core/op_registration/op_registration_test.cpp.o 

## To Reproduce

Steps to reproduce the behavior:

Run the snippet below:
export \
  CFLAGS="${CFLAGS/-fno-plt/}" \
  CXXFLAGS="${CXXFLAGS/-fno-plt/}" \
  USE_CUDA=1 \
  USE_CUDNN=1 \
  CUDNN_LIB_DIR=$CUDA_HOME/lib64 \
  CUDNN_INCLUDE_DIR=$CUDA_HOME/include \
  MAGMA_HOME=/opt/magma \
  TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__" 

echo "-----------------------------------------------------"
echo " compiling PyTorch $TORCH                            "
echo "-----------------------------------------------------"
git submodule sync && git submodule update --init --recursive
git clone --recursive https://github.com/pytorch/pytorch
git submodule sync && git submodule update --init --recursive
cd pytorch
git checkout v1.6.0 
git submodule sync 
git submodule update --init --recursive
python setup.py install | tee /workspace/logs/PYTORCH--BUILD--$(date +"%T")--.log
echo "DONE-------------------------------------------------"


## Expected behavior

op_registration_test.cpp.o fails (see below):
[4680/4927] Building CXX object caffe2/CMakeFiles/op_registration_test.dir/__/aten/src/ATen/core/op_registration/op_registration_test.cpp.o
FAILED: caffe2/CMakeFiles/op_registration_test.dir/__/aten/src/ATen/core/op_registration/op_registration_test.cpp.o 
/usr/bin/c++ -DHAVE_MALLOC_USABLE_SIZE=1 -DHAVE_MMAP=1 -DHAVE_SHM_OPEN=1 -DHAVE_SHM_UNLINK=1 -DIDEEP_USE_MKL -DMAGMA_V2 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DTH_BLAS_MKL -DUSE_EXTERNAL_MZCRC -D_FILE_OFFSET_BITS=64 -Iaten/src -I../aten/src -I. -I../ -I../cmake/../third_party/benchmark/include -Icaffe2/contrib/aten -I../third_party/onnx -Ithird_party/onnx -I../third_party/foxi -Ithird_party/foxi -Iinclude -Icaffe2/aten/src/TH -I../aten/src/TH -Icaffe2/aten/src -I../aten/../third_party/catch/single_include -I../aten/src/ATen/.. -Icaffe2/aten/src/ATen -I../third_party/miniz-2.0.8 -I../caffe2/core/nomnigraph/include -I../caffe2/../torch/csrc/api -I../caffe2/../torch/csrc/api/include -I../c10/.. -Ithird_party/ideep/mkl-dnn/include -I../third_party/ideep/mkl-dnn/src/../include -I../c10/cuda/../.. -isystem third_party/gloo -isystem ../cmake/../third_party/gloo -isystem ../cmake/../third_party/googletest/googlemock/include -isystem ../cmake/../third_party/googletest/googletest/include -isystem ../third_party/protobuf/src -isystem ../third_party/gemmlowp -isystem ../third_party/neon2sse -isystem ../third_party/XNNPACK/include -isystem ../third_party -isystem ../cmake/../third_party/eigen -isystem /usr/include/python3.7m -isystem /usr/local/lib/python3.7/dist-packages/numpy/core/include -isystem ../cmake/../third_party/pybind11/include -isystem ../cmake/../third_party/cub -isystem /opt/magma/include -isystem ../third_party/ideep/mkl-dnn/include -isystem ../third_party/ideep/include -isystem /usr/local/cuda/include -isystem ../third_party/googletest/googletest/include -isystem ../third_party/googletest/googletest -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow -DHAVE_AVX_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION -O3 -DNDEBUG -DNDEBUG -fPIE -DCAFFE2_USE_GLOO -DCUDA_HAS_FP16=1 -DHAVE_GCC_GET_CPUID -DUSE_AVX -DUSE_AVX2 -DTH_HAVE_THREAD -std=c++14 -pthread -std=gnu++14 -MD -MT caffe2/CMakeFiles/op_registration_test.dir/__/aten/src/ATen/core/op_registration/op_registration_test.cpp.o -MF caffe2/CMakeFiles/op_registration_test.dir/__/aten/src/ATen/core/op_registration/op_registration_test.cpp.o.d -o caffe2/CMakeFiles/op_registration_test.dir/__/aten/src/ATen/core/op_registration/op_registration_test.cpp.o -c ../aten/src/ATen/core/op_registration/op_registration_test.cpp
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.

## Environment

nvidia/cuda:10.1-cudnn7-devel docker container with Miniconda installed and Python 3.7.9/3.8.x (though using Python 3.7.9 as primary Python environment not conda).

You can get the script and run it with:

see above

# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py

root@C.663561:/workspace/git/fb/pytorch$ python ./torch/utils/collect_env.py
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A

OS: Ubuntu 18.04.5 LTS
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
CMake version: version 3.18.2

Python version: 3.7
Is CUDA available: N/A
CUDA runtime version: 10.1.243
GPU models and configuration: GPU 0: GeForce GTX 1070
Nvidia driver version: 430.50
cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.5

Versions of relevant libraries:
[pip3] numpy==1.19.2
[conda] Could not collect

## Additional context

<!-- Add any other context about the problem here. -->


cc @malfet @seemethere @walterddr