Detectron: Installation error: nvcc fatal : redefinition of argument 'std'

Created on 23 Feb 2018  路  5Comments  路  Source: facebookresearch/Detectron

Hi,
I m trying to compile the detectron with CUDA 8 and CUDNN 6.0.21 on UBUNTU (GTX 1080).
Although I can successfully compile caffe2, detectron ops are not compiled.

cmake conf. and the error:

-- Caffe2: Cannot find gflags automatically. Using legacy find.
-- Caffe2: Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
-- Caffe2: Cannot find glog automatically. Using legacy find.
-- Caffe2: Found glog (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2: Protobuf version 3.5.0
-- Caffe2: CUDA detected: 8.0
-- Found cuDNN: v6.0.21 (include: /usr/local/cuda-8.0/include, library: /usr/local/cuda-8.0/lib64/libcudnn.so)
-- Added CUDA NVCC flags for: sm_60 sm_61
-- CUDA detected: 8.0
-- Added CUDA NVCC flags for: sm_60 sm_61
-- Found libcuda: /usr/local/cuda-8.0/lib64/stubs/libcuda.so
-- Found libnvrtc: /usr/local/cuda-8.0/lib64/libnvrtc.so
-- Found cuDNN: v6.0.21 (include: /usr/local/cuda-8.0/include, library: /usr/local/cuda-8.0/lib64/libcudnn.so)
-- Summary:
-- CMake version : 3.5.1
-- CMake command : /usr/bin/cmake
-- System name : Linux
-- C++ compiler : /usr/bin/c++
-- C++ compiler version : 5.4.0
-- CXX flags : -std=c++11 -O2 -fPIC -Wno-narrowing
-- Caffe2 version : 0.8.1
-- Caffe2 include path : /work/libs/caffe2/install/include
-- Have CUDA : TRUE
-- CUDA version : 8.0
-- CuDNN version : 6.0.21
-- Configuring done
-- Generating done
-- Build files have been written to: /work/detectron/lib/build

[ 20%] Building NVCC (Device) object CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/ops/caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o
make[3]: Leaving directory '/work/detectron/lib/build'
[ 60%] Built target caffe2_detectron_custom_ops
nvcc fatal : redefinition of argument 'std'
CMake Error at caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o.cmake:203 (message):
Error generating

/work/detectron/lib/build/CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/ops/./caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o

Looking forward to your response!

Most helpful comment

@kampelmuehler I don't see how detectron doesn't build anything. In the Detectron/lib folder there is a CMakeLists.txt that is referenced by the Makefile also included. Without building the items in the lib folder there is no reference to the caffe2_detectron_custom_ops_gpu.so library.

However, I was able to work around this issue and get this library to build. I did this by commenting out line 208 in Detectron/lib/cmake/Cuda.cmake:

  #list(APPEND CUDA_NVCC_FLAGS "-std=c++11")

which seemed to cause the redefinition error. I'm not a C++ master by any means, so I don't know how fragile of a fix this is. I'm using gcc 5.4.0.

Also, even though I got past this build error, test_zero_even_op.py still had 3/12 tests fail with mismatch errors. That turned out to be my error, I had incorrectly set CUDA_ARCH_NAME to Maxwell instead of Pascal for my 1080 ti card. However, I still do see lots of warning messages: .I0304 20:40:10.763909 14388 operator.cc:173] Operator with engine CUDNN is not available for operator ZeroEven.

All 5 comments

I also have to add the arch_name flag for cmake;

cmake .. -DCMAKE_PREFIX_PATH=/work/libs/caffe2/install -DCUDA_ARCH_NAME=Pascal

Detectron ops are compiled with caffe2 (they are included in caffe2), there is nothing more to do after compiling caffe2. From what I see you are trying to somehow build detectron (judging by your location /work/detectron/lib/build). This is not necessary.

Yes, you are right. I wasn't on the right branch for the ops.
However, if one doesnt install caffe2 globally, he/she should copy /lib/lib* files into /lib/python2.7/site-packages/lib folder.

Thanks for the help.

@kampelmuehler I don't see how detectron doesn't build anything. In the Detectron/lib folder there is a CMakeLists.txt that is referenced by the Makefile also included. Without building the items in the lib folder there is no reference to the caffe2_detectron_custom_ops_gpu.so library.

However, I was able to work around this issue and get this library to build. I did this by commenting out line 208 in Detectron/lib/cmake/Cuda.cmake:

  #list(APPEND CUDA_NVCC_FLAGS "-std=c++11")

which seemed to cause the redefinition error. I'm not a C++ master by any means, so I don't know how fragile of a fix this is. I'm using gcc 5.4.0.

Also, even though I got past this build error, test_zero_even_op.py still had 3/12 tests fail with mismatch errors. That turned out to be my error, I had incorrectly set CUDA_ARCH_NAME to Maxwell instead of Pascal for my 1080 ti card. However, I still do see lots of warning messages: .I0304 20:40:10.763909 14388 operator.cc:173] Operator with engine CUDNN is not available for operator ZeroEven.

@Erotemic This works on my machine! Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

partnercloudsupport picture partnercloudsupport  路  3Comments

Hwang-dae-won picture Hwang-dae-won  路  3Comments

baristahell picture baristahell  路  3Comments

olgaliak picture olgaliak  路  4Comments

twmht picture twmht  路  3Comments