question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

Failing to compile torchvision C++ API from source (>C++14 compiler required, which is installed)

See original GitHub issue

šŸ› Bug

I have installed PyTorch version 1.8.0 from source and am now attempting to install the C++ API to torchvision 0.9.0 from source.

When making torchvisionā€™s C++ API I am getting an error that I need to use a C++14 or later compatible compiler (I am using gcc 9.3.0 which supports C++14):

root@pc:/resources/vision/build# make VERBOSE=1 -j4
...
...
...
[ 71%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/roi_pool_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/roi_pool_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/cpu/roi_pool_kernel.cpp
[ 73%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu.o
/usr/local/cuda/bin/nvcc  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem=/usr/local/lib/python3.8/dist-packages/torch/include -isystem=/usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem=/usr/include/python3.8  --expt-relaxed-constexpr -Xcompiler=-fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11 -x cu -c /resources/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu.o
In file included from /resources/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu:69:
/usr/local/lib/python3.8/dist-packages/torch/include/ATen/ATen.h:4:2: error: #error C++14 or later compatible compiler is required to use ATen.
    4 | #error C++14 or later compatible compiler is required to use ATen.
      |  ^~~~~
In file included from /usr/local/lib/python3.8/dist-packages/torch/include/c10/util/ArrayRef.h:19,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/c10/core/DispatchKey.h:7,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/c10/core/Backend.h:4,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/c10/core/Layout.h:3,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/core/TensorBody.h:4,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/Tensor.h:3,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/Context.h:4,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/ATen.h:9,
                 from /resources/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu:69:
/usr/local/lib/python3.8/dist-packages/torch/include/c10/util/C++17.h:24:2: error: #error You need C++14 to compile PyTorch
   24 | #error You need C++14 to compile PyTorch
      |  ^~~~~
[ 75%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cuda/nms_kernel.cu.o
/usr/local/cuda/bin/nvcc  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem=/usr/local/lib/python3.8/dist-packages/torch/include -isystem=/usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem=/usr/include/python3.8  --expt-relaxed-constexpr -Xcompiler=-fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11 -x cu -c /resources/vision/torchvision/csrc/ops/cuda/nms_kernel.cu -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/cuda/nms_kernel.cu.o
In file included from /resources/vision/torchvision/csrc/ops/cuda/nms_kernel.cu:1:
/usr/local/lib/python3.8/dist-packages/torch/include/ATen/ATen.h:4:2: error: #error C++14 or later compatible compiler is required to use ATen.
    4 | #error C++14 or later compatible compiler is required to use ATen.
      |  ^~~~~

I think the places of interest are the following:

  • [ 71%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/roi_pool_kernel.cpp.o
    • Uses the flag -std=gnu++14
  • [ 75%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cuda/nms_kernel.cu.o
    • Uses the flag -std=c++11

It seems like all of the CPU builds use the C++14 flag and the CUDA builds (incorrectly) use the C++11 flag. Can I point this to CMAKE_CUDA_FLAGS being set in vision/CMakeLists.txt? It looks like CUDA_FLAGS contains the flag -std=c++11 as shown in vision/build/CMakeFiles/torchvision.dir/flags.make:

# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16

# compile CUDA with /usr/local/cuda/bin/nvcc
# compile CXX with /usr/bin/c++
CUDA_FLAGS =  --expt-relaxed-constexpr -Xcompiler=-fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11

Any idea where this is coming from? How itā€™s getting set? And how to change it so that it is set to -std=gnu++14 or similar? Is it coming from my PyTorch install?

To Reproduce

Steps to reproduce the behavior:

git clone https://github.com/pytorch/vision.git cd vision git checkout v0.9.0 mkdir build && cd build

cmake -DTorch_DIR=/usr/local/lib/python3.8/dist-packages/torch/share/cmake/Torch/ -DWITH_CUDA=on ..

root@pc:/resources/vision/build# cmake -DTorch_DIR=/usr/local/lib/python3.8/dist-packages/torch/share/cmake/Torch/ -DWITH_CUDA=on ..
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The CUDA compiler identification is NVIDIA 11.2.67
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Found Python3: /usr/lib/x86_64-linux-gnu/libpython3.8.so (found version "3.8") found components: Development 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2: Protobuf version 3.6.1
-- Found CUDA: /usr/local/cuda (found version "11.2") 
-- Caffe2: CUDA detected: 11.2
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda
-- Caffe2: Header version is: 11.2
-- Found CUDNN: /usr/lib/x86_64-linux-gnu/libcudnn.so  
-- Found cuDNN: v8.1.0  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
CMake Warning at /usr/local/lib/python3.8/dist-packages/torch/share/cmake/Caffe2/public/cuda.cmake:198 (message):
  Failed to compute shorthash for libnvrtc.so
Call Stack (most recent call first):
  /usr/local/lib/python3.8/dist-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
  /usr/local/lib/python3.8/dist-packages/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:17 (find_package)


-- Autodetected CUDA architecture(s):  6.1 6.1 6.1
-- Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61
-- Found Torch: /usr/local/lib/python3.8/dist-packages/torch/lib/libtorch.so  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.37") 
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80") 
-- Configuring done
-- Generating done
-- Build files have been written to: /resources/vision/build

make -j4

root@pc:/resources/vision/build# make VERBOSE=1 -j4 
/usr/bin/cmake -S/resources/vision -B/resources/vision/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /resources/vision/build/CMakeFiles /resources/vision/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/resources/vision/build'
make -f CMakeFiles/torchvision.dir/build.make CMakeFiles/torchvision.dir/depend
make[2]: Entering directory '/resources/vision/build'
cd /resources/vision/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /resources/vision /resources/vision /resources/vision/build /resources/vision/build /resources/vision/build/CMakeFiles/torchvision.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/resources/vision/build'
make -f CMakeFiles/torchvision.dir/build.make CMakeFiles/torchvision.dir/build
make[2]: Entering directory '/resources/vision/build'
[  2%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/common_jpeg.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/common_jpeg.cpp.o -c /resources/vision/torchvision/csrc/io/image/cpu/common_jpeg.cpp
[  6%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/decode_png.cpp.o
[  6%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/decode_image.cpp.o
[  8%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/decode_jpeg.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/decode_png.cpp.o -c /resources/vision/torchvision/csrc/io/image/cpu/decode_png.cpp
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/decode_image.cpp.o -c /resources/vision/torchvision/csrc/io/image/cpu/decode_image.cpp
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/decode_jpeg.cpp.o -c /resources/vision/torchvision/csrc/io/image/cpu/decode_jpeg.cpp
[ 10%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/encode_jpeg.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/encode_jpeg.cpp.o -c /resources/vision/torchvision/csrc/io/image/cpu/encode_jpeg.cpp
[ 12%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/encode_png.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/encode_png.cpp.o -c /resources/vision/torchvision/csrc/io/image/cpu/encode_png.cpp
[ 14%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/read_write_file.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/read_write_file.cpp.o -c /resources/vision/torchvision/csrc/io/image/cpu/read_write_file.cpp
[ 16%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/io/image/image.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/io/image/image.cpp.o -c /resources/vision/torchvision/csrc/io/image/image.cpp
[ 18%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/alexnet.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/models/alexnet.cpp.o -c /resources/vision/torchvision/csrc/models/alexnet.cpp
[ 20%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/densenet.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/models/densenet.cpp.o -c /resources/vision/torchvision/csrc/models/densenet.cpp
[ 22%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/googlenet.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/models/googlenet.cpp.o -c /resources/vision/torchvision/csrc/models/googlenet.cpp
[ 24%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/inception.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/models/inception.cpp.o -c /resources/vision/torchvision/csrc/models/inception.cpp
[ 26%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/mnasnet.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/models/mnasnet.cpp.o -c /resources/vision/torchvision/csrc/models/mnasnet.cpp
[ 28%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/mobilenet.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/models/mobilenet.cpp.o -c /resources/vision/torchvision/csrc/models/mobilenet.cpp
[ 30%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/resnet.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/models/resnet.cpp.o -c /resources/vision/torchvision/csrc/models/resnet.cpp
[ 32%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/shufflenetv2.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/models/shufflenetv2.cpp.o -c /resources/vision/torchvision/csrc/models/shufflenetv2.cpp
[ 34%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/squeezenet.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/models/squeezenet.cpp.o -c /resources/vision/torchvision/csrc/models/squeezenet.cpp
[ 36%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/vgg.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/models/vgg.cpp.o -c /resources/vision/torchvision/csrc/models/vgg.cpp
[ 38%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/deform_conv2d_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/deform_conv2d_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/autocast/deform_conv2d_kernel.cpp
[ 40%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/nms_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/nms_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/autocast/nms_kernel.cpp
[ 42%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/ps_roi_align_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/ps_roi_align_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/autocast/ps_roi_align_kernel.cpp
[ 44%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/ps_roi_pool_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/ps_roi_pool_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/autocast/ps_roi_pool_kernel.cpp
[ 46%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/roi_align_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/roi_align_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/autocast/roi_align_kernel.cpp
[ 48%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/roi_pool_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/autocast/roi_pool_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/autocast/roi_pool_kernel.cpp
[ 51%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/autograd/deform_conv2d_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/autograd/deform_conv2d_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/autograd/deform_conv2d_kernel.cpp
[ 53%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/autograd/ps_roi_align_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/autograd/ps_roi_align_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/autograd/ps_roi_align_kernel.cpp
[ 55%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/autograd/ps_roi_pool_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/autograd/ps_roi_pool_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/autograd/ps_roi_pool_kernel.cpp
[ 57%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/autograd/roi_align_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/autograd/roi_align_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/autograd/roi_align_kernel.cpp
[ 59%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/autograd/roi_pool_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/autograd/roi_pool_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/autograd/roi_pool_kernel.cpp
[ 61%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/deform_conv2d_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/deform_conv2d_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/cpu/deform_conv2d_kernel.cpp
[ 63%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/nms_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/nms_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/cpu/nms_kernel.cpp
[ 65%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/ps_roi_align_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/ps_roi_align_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/cpu/ps_roi_align_kernel.cpp
[ 67%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/ps_roi_pool_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/ps_roi_pool_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/cpu/ps_roi_pool_kernel.cpp
[ 69%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/roi_align_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/roi_align_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/cpu/roi_align_kernel.cpp
[ 71%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/roi_pool_kernel.cpp.o
/usr/bin/c++  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem /usr/local/lib/python3.8/dist-packages/torch/include -isystem /usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -isystem /usr/include/python3.8  -fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++14 -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/cpu/roi_pool_kernel.cpp.o -c /resources/vision/torchvision/csrc/ops/cpu/roi_pool_kernel.cpp
[ 73%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu.o
/usr/local/cuda/bin/nvcc  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem=/usr/local/lib/python3.8/dist-packages/torch/include -isystem=/usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem=/usr/include/python3.8  --expt-relaxed-constexpr -Xcompiler=-fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11 -x cu -c /resources/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu.o
In file included from /resources/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu:69:
/usr/local/lib/python3.8/dist-packages/torch/include/ATen/ATen.h:4:2: error: #error C++14 or later compatible compiler is required to use ATen.
    4 | #error C++14 or later compatible compiler is required to use ATen.
      |  ^~~~~
In file included from /usr/local/lib/python3.8/dist-packages/torch/include/c10/util/ArrayRef.h:19,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/c10/core/DispatchKey.h:7,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/c10/core/Backend.h:4,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/c10/core/Layout.h:3,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/core/TensorBody.h:4,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/Tensor.h:3,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/Context.h:4,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/ATen.h:9,
                 from /resources/vision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu:69:
/usr/local/lib/python3.8/dist-packages/torch/include/c10/util/C++17.h:24:2: error: #error You need C++14 to compile PyTorch
   24 | #error You need C++14 to compile PyTorch
      |  ^~~~~
[ 75%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/ops/cuda/nms_kernel.cu.o
/usr/local/cuda/bin/nvcc  -DWITH_CUDA -D__CUDA_NO_HALF_OPERATORS__ -Dtorchvision_EXPORTS -I/resources/vision/torchvision/csrc -isystem=/usr/local/lib/python3.8/dist-packages/torch/include -isystem=/usr/local/lib/python3.8/dist-packages/torch/include/torch/csrc/api/include -isystem=/usr/include/python3.8  --expt-relaxed-constexpr -Xcompiler=-fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11 -x cu -c /resources/vision/torchvision/csrc/ops/cuda/nms_kernel.cu -o CMakeFiles/torchvision.dir/torchvision/csrc/ops/cuda/nms_kernel.cu.o
In file included from /resources/vision/torchvision/csrc/ops/cuda/nms_kernel.cu:1:
/usr/local/lib/python3.8/dist-packages/torch/include/ATen/ATen.h:4:2: error: #error C++14 or later compatible compiler is required to use ATen.
    4 | #error C++14 or later compatible compiler is required to use ATen.
      |  ^~~~~
make[2]: *** [CMakeFiles/torchvision.dir/build.make:518: CMakeFiles/torchvision.dir/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /usr/local/lib/python3.8/dist-packages/torch/include/c10/util/ArrayRef.h:19,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/c10/core/DispatchKey.h:7,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/c10/core/Backend.h:4,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/c10/core/Layout.h:3,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/core/TensorBody.h:4,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/Tensor.h:3,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/Context.h:4,
                 from /usr/local/lib/python3.8/dist-packages/torch/include/ATen/ATen.h:9,
                 from /resources/vision/torchvision/csrc/ops/cuda/nms_kernel.cu:1:
/usr/local/lib/python3.8/dist-packages/torch/include/c10/util/C++17.h:24:2: error: #error You need C++14 to compile PyTorch
   24 | #error You need C++14 to compile PyTorch
      |  ^~~~~
make[2]: *** [CMakeFiles/torchvision.dir/build.make:531: CMakeFiles/torchvision.dir/torchvision/csrc/ops/cuda/nms_kernel.cu.o] Error 1
make[2]: Leaving directory '/resources/vision/build'
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/torchvision.dir/all] Error 2
make[1]: Leaving directory '/resources/vision/build'
make: *** [Makefile:130: all] Error 2

Expected behavior

The make (build) completes without error.

Environment

Click to display environment

root@pc:~# python3 -m torch.utils.collect_env
Collecting environment information...
PyTorch version: 1.8.0a0+56b43f4
Is debug build: False
CUDA used to build PyTorch: 11.2
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.1 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: Could not collect
CMake version: version 3.16.3

Python version: 3.8 (64-bit runtime)
Is CUDA available: True
CUDA runtime version: Could not collect
GPU models and configuration: 
GPU 0: GeForce GTX 1080
GPU 1: GeForce GTX 1080
GPU 2: GeForce GTX 1080

Nvidia driver version: 460.84
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.1.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.1.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.1.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.1.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.1.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.1.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.1.0
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.21.0
[pip3] pytorch-lightning==1.3.8
[pip3] torch==1.8.0a0+56b43f4
[pip3] torchmetrics==0.4.1
[pip3] torchvision==0.9.0a0+01dfa8e
[conda] Could not collect

  • PyTorch / torchvision Version (e.g., 1.0 / 0.4.0): 1.8.0 / 0.9.0
  • OS (e.g., Linux): Ubuntu 20.04
  • How you installed PyTorch / torchvision (conda, pip, source): source / source
  • Build command you used (if compiling from source): Listed above
  • Python version: 3.8
  • CUDA/cuDNN version: 11.2
  • GPU models and configuration: 3x GeForce GTX 1080

Additional context

The commands I used to build PyTorch: git clone https://github.com/pytorch/pytorch.git cd pytorch git checkout v1.8.0 git submodule sync git submodule update --init --recursive python3 setup.py build -j4 --cmake-only cd build cmake -DBUILD_CUSTOM_PROTOBUF=0 .. cmake --build . -j4 --target install cd .. python3 setup.py install

Additionally, python maps to Python 2.7.18 python3 maps to Python 3.8.10

Lastly, I do have a Dockerfile that I am usingā€¦ but it builds cuDNN, PyTorch, openCV, and torchvision from sourceā€¦ itā€™s about 20GB and takes a few hours to build.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mattpopovichcommented, Jul 14, 2021

Update: I was able to successfully compile by manually changing the CUDA_FLAGS variable (removing the -std=c++11) in vision/build/CMakeFiles/torchvision.dir/flags.make:

flags.make before:

# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16

# compile CUDA with /usr/local/cuda/bin/nvcc
# compile CXX with /usr/bin/c++
CUDA_FLAGS =  --expt-relaxed-constexpr -Xcompiler=-fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11
...

flags.make after:

# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16

# compile CUDA with /usr/local/cuda/bin/nvcc
# compile CXX with /usr/bin/c++
CUDA_FLAGS =  --expt-relaxed-constexpr -Xcompiler=-fPIC   -D_GLIBCXX_USE_CXX11_ABI=1 
...

Now to figure out how to fix that in CMake!

0reactions
benizcommented, Aug 17, 2021

Thanks for the report and fix @mattpopovich I had the exact same issue on my side, and this did help fixing it, simply add -DCMAKE_CUDA_STANDARD=14 to the pytorch vision build call. Somehow nvcc defaults to C++11 on my system (Ubuntu 20.04).

I tried adding set(CMAKE_CUDA_STANDARD 14) to CMakeLists.txt next to set(CMAKE_CXX_STANDARD 14), but this did not fix the issue, and this I canā€™t explain though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

You need C++14 to compile PyTorch
You need C++14 to compile PyTorchā€‹ā€‹ I followed the instruction of pytorch/extension-script to register custom c++ operator. How can I fix thisĀ ...
Read more >
torchvision c++ api build from source, Build error about C++14 ...
torchvision c++ api build from source, in master branch, Build error about C++14 and C++11 Environment PyTorch Version: 1.5.1 build fromĀ ...
Read more >
homebrew-core - Homebrew Formulae
a2ps 4.14 Anyā€‘toā€‘PostScript filter aacgain 1.8 AACā€‘supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
Read more >
Install PyTorch on Raspberry Pi 4 - Q-engineering
A thorough guide on how to install PyTorch on the Raspberry Pi 4. ... A 64-bit C ++ compiler is needed as we...
Read more >
building wheel for pycocotools (pyproject.toml) ... error error
ERROR: Failed building wheel for pycocotools ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects UsingĀ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found