Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

【编译错误】ubuntu16.04 编译 paddle/fluid/platform/CMakeFiles/device_tracer.dir/device_tracer.cc.o 出错

Open 1224wxwx opened this issue 6 years ago • 5 comments

  • 版本、环境信息:    1)PaddlePaddle版本:1.6.2    2)CPU:    3)GPU:Tesla K80, CUDA 10.0, CUDNN 7.6.0    4)系统环境:ubuntu 16.04、conda虚拟环境python3.7、gcc5.4、Cmake 3.5.1、TensorRT 7

  • 安装方式信息: 本地编译:

      sudo cmake ../ -DFLUID_INFERENCE_INSTALL_DIR=/usr/local/fluid_inference_install_dir/ -DPY_VERSION=3.7 -DCMAKE_BUILD_TYPE=Release -DWITH_PYTHON=OF F -DWITH_MKL=OFF -DWITH_GPU=ON -DON_INFER=ON -DCUDA_ARCH_NAME=All
    
      sudo make -j$(nproc)
    
  • 复现信息:如为报错,请给出复现环境、复现步骤 使用上述命令编译

  • 问题描述:请详细描述您的问题,同步贴出报错信息、日志/代码关键片段

    报错信息如下:

两个出错的位置我标了黑体,觉得报错看起来说的是语法错误,是用的C++标准不对吗?

[ 12%] Building CXX object paddle/fluid/memory/allocation/CMakeFiles/auto_growth_best_fit_allocator.dir/auto_growth_best_fit_allocator.cc.o /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc: In function ‘void paddle::platform::{anonymous}::bufferCompleted(CUcontext, uint32_t, uint8_t*, size_t, size_t)’ : /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:190:40: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive] reinterpret_cast<const CUpti_ActivityKernel4 *>(record); ^ /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:190:40: error: expected ‘>’ before ‘CUpti_ActivityKernel4’ /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:190:40: error: expected ‘(’ before ‘CUpti_ActivityKernel4’ /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:190:40: error: ‘CUpti_ActivityKernel4’ was not declared in this scope /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:190:63: error: expected primary-expression before ‘>’ token reinterpret_cast<const CUpti_ActivityKernel4 *>(record); ^ /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:190:72: error: expected ‘)’ before ‘;’ token reinterpret_cast<const CUpti_ActivityKernel4 *>(record); ^ /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc: In member function ‘virtual void paddle::platform::DeviceTracerImpl::Enable()’: /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:413:11: error: ‘CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernel_v9000’ was not declared in this scope CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernel_v9000, ^ /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:414:11: error: ‘CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernelMultiDevice_v9000’ was not declared in this s cope CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernelMultiDevice_v9000 ^ /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:416:5: error: no matching function for call to ‘std::vector::vector()’ }; ^ In file included from /usr/include/c++/5/vector:64:0, from /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:27: /usr/include/c++/5/bits/stl_vector.h:401:9: note: candidate: template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const al locator_type&) vector(_InputIterator __first, _InputIterator __last, ^ /usr/include/c++/5/bits/stl_vector.h:401:9: note: template argument deduction/substitution failed: /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:416:5: note: cannot convert ‘CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyAsync_v3020’ (type ‘CUpti_runtime_api_trace_cbi d_enum’) to type ‘const allocator_type& {aka const std::allocator&}’ }; ^ In file included from /usr/include/c++/5/vector:64:0, from /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:27: /usr/include/c++/5/bits/stl_vector.h:373:7: note: candidate: std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = s td::allocator; std::vector<_Tp, _Alloc>::allocator_type = std::allocator] vector(initializer_list<value_type> __l, ^ /usr/include/c++/5/bits/stl_vector.h:373:7: note: candidate expects 2 arguments, 9 provided /usr/include/c++/5/bits/stl_vector.h:348:7: note: candidate: std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = int; _Alloc = s td::allocator; std::vector<_Tp, _Alloc>::allocator_type = std::allocator] vector(vector&& __rv, const allocator_type& __m) ^ [29/1920] /usr/include/c++/5/bits/stl_vector.h:348:7: note: candidate expects 2 arguments, 9 provided /usr/include/c++/5/bits/stl_vector.h:339:7: note: candidate: std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&) [with _Tp = int; _Allo c = std::allocator; std::vector<_Tp, _Alloc>::allocator_type = std::allocator] vector(const vector& __x, const allocator_type& __a) ^ /usr/include/c++/5/bits/stl_vector.h:339:7: note: candidate expects 2 arguments, 9 provided /usr/include/c++/5/bits/stl_vector.h:335:7: note: candidate: std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator] vector(vector&& __x) noexcept ^ /usr/include/c++/5/bits/stl_vector.h:335:7: note: candidate expects 1 argument, 9 provided /usr/include/c++/5/bits/stl_vector.h:318:7: note: candidate: std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator ] vector(const vector& __x) ^ /usr/include/c++/5/bits/stl_vector.h:318:7: note: candidate expects 1 argument, 9 provided /usr/include/c++/5/bits/stl_vector.h:289:7: note: candidate: std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator] vector(size_type __n, const value_type& __value, ^ /usr/include/c++/5/bits/stl_vector.h:289:7: note: candidate expects 3 arguments, 9 provided /usr/include/c++/5/bits/stl_vector.h:277:7: note: candidate: std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = int; _ Alloc = std::allocator; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator] vector(size_type __n, const allocator_type& __a = allocator_type()) ^ /usr/include/c++/5/bits/stl_vector.h:277:7: note: candidate expects 2 arguments, 9 provided /usr/include/c++/5/bits/stl_vector.h:264:7: note: candidate: std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = int; _Alloc = std::allocator; std::vec tor<_Tp, _Alloc>::allocator_type = std::allocator] vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT ^ /usr/include/c++/5/bits/stl_vector.h:264:7: note: candidate expects 1 argument, 9 provided /usr/include/c++/5/bits/stl_vector.h:253:7: note: candidate: std::vector<_Tp, _Alloc>::vector() [with Tp = int; Alloc = std::allocator] vector() ^ /usr/include/c++/5/bits/stl_vector.h:253:7: note: candidate expects 0 arguments, 9 provided /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc: In function ‘void paddle::platform::{anonymous}::initCuptiCbidStr()’: /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:672:20: error: ‘CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernel_v9000’ was not declared in this scope runtime_cbid_str[CUPTI_RUNTIME_TRACE_CBID##cbid] = #cbid ^ /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:718:3: note: in expansion of macro ‘REGISTER_RUNTIME_CBID_STR’ REGISTER_RUNTIME_CBID_STR(cudaLaunchCooperativeKernel_v9000); ^ /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:672:20: error: ‘CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernelMultiDevice_v9000’ was not declared in this s cope runtime_cbid_str[CUPTI_RUNTIME_TRACE_CBID##cbid] = #cbid ^ /home/ubuntu/Paddle/paddle/fluid/platform/device_tracer.cc:719:3: note: in expansion of macro ‘REGISTER_RUNTIME_CBID_STR’ REGISTER_RUNTIME_CBID_STR(cudaLaunchCooperativeKernelMultiDevice_v9000); ^ paddle/fluid/platform/CMakeFiles/device_tracer.dir/build.make:62: recipe for target 'paddle/fluid/platform/CMakeFiles/device_tracer.dir/device_tracer.cc.o' failed make[2]: *** [paddle/fluid/platform/CMakeFiles/device_tracer.dir/device_tracer.cc.o] Error 1 CMakeFiles/Makefile2:2393: recipe for target 'paddle/fluid/platform/CMakeFiles/device_tracer.dir/all' failed make[1]: *** [paddle/fluid/platform/CMakeFiles/device_tracer.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 12%] Linking CXX static library libop_call_stack.a [ 12%] Built target op_call_stack [ 12%] Linking CXX static library libauto_growth_best_fit_allocator.a [ 12%] Built target auto_growth_best_fit_allocator [ 12%] Linking CXX static library libcuda_allocator.a [ 12%] Built target cuda_allocator Makefile:127: recipe for target 'all' failed make: *** [all] Error 2

1224wxwx avatar Feb 19 '20 08:02 1224wxwx

@1224wxwx 这个应该是CUpti未安装好,你可以使用命令 nvcc -V查看一下CUDA版本是否正确,CUpti安装是否正确。

gfwm2013 avatar Feb 19 '20 09:02 gfwm2013

CUpti

@gfwm2013 您好,感谢回复;想请问下您说的是nvcc -V这个命令吗?我用命令得到的结果如下,麻烦帮看看有没有问题?

nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2018 NVIDIA Corporation Built on Sat_Aug_25_21:08:01_CDT_2018 Cuda compilation tools, release 10.0, V10.0.130

1224wxwx avatar Feb 19 '20 10:02 1224wxwx

建议更换cuda10.1 cudnn7.5试一下。 cuda10.0官方说明好像有些bug

jiweibo avatar Feb 20 '20 06:02 jiweibo

换用cuda9.0版本以后没有问题

1224wxwx avatar Feb 21 '20 06:02 1224wxwx

使用cuda10.1也是这个错误 nvcc -V Cuda compilation tools, release 10.1, V10.1.168

kasyoukin avatar Sep 25 '20 02:09 kasyoukin