使用CUDA和C ++运行现有项目

时间:2017-09-26 17:09:57

标签: c++ c++11 gcc cuda

我正在尝试在笔记本电脑中运行this项目。我安装了以下内容。

CUDA:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17

GCC

gcc (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

CMake的:

cmake version 3.5.1

make期间。该项目给出以下错误。

/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

如果我将set (CMAKE_CXX_STANDARD 11)添加到CMakesLists.txt以支持c ++标准11.我收到以下错误。

In file included from /usr/include/mrpt/base/include/mrpt/utils.h:25:0,
                 from /home/muazzam/mywork/python/thesis/PD-Flow/scene_flow_visualization.h:24,
                 from /home/muazzam/mywork/python/thesis/PD-Flow/main_scene_flow_visualization.cpp:24:
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:253:8: error: ‘std::enable_if_t’ has not been declared
   std::enable_if_t<is_shared_ptr<T>::value>* = nullptr)
        ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:253:19: error: expected ‘,’ or ‘...’ before ‘<’ token
   std::enable_if_t<is_shared_ptr<T>::value>* = nullptr)
                   ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:263:8: error: ‘std::enable_if_t’ has not been declared
   std::enable_if_t<!is_shared_ptr<T>::value>* = nullptr)
        ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:263:19: error: expected ‘,’ or ‘...’ before ‘<’ token
   std::enable_if_t<!is_shared_ptr<T>::value>* = nullptr)
                   ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:261:6: error: ‘template<class RET, class T, class ... R> RET mrpt::utils::CStream::ReadVariant_helper(mrpt::utils::CSerializable::Ptr&, int)’ cannot be overloaded
  RET ReadVariant_helper(
      ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:251:6: error: with ‘template<class RET, class T, class ... R> RET mrpt::utils::CStream::ReadVariant_helper(mrpt::utils::CSerializable::Ptr&, int)’
  RET ReadVariant_helper(
      ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h: In member function ‘void mrpt::utils::CStream::WriteVariant(T)’:
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:314:15: error: use of ‘auto’ in lambda parameter declaration only available with -std=c++14 or -std=gnu++14
   t.match([&](auto& o) { this->WriteObject(o); });
               ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h: In lambda function:
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:314:45: error: no matching function for call to ‘mrpt::utils::CStream::WriteObject(int&)’
   t.match([&](auto& o) { this->WriteObject(o); });
                                             ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:197:7: note: candidate: void mrpt::utils::CStream::WriteObject(const mrpt::utils::CSerializable*) <near match>
  void WriteObject(const CSerializable* o);
       ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:197:7: note:   conversion of argument 1 would be ill-formed:
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:198:7: note: candidate: void mrpt::utils::CStream::WriteObject(const mrpt::utils::CSerializable&)
  void WriteObject(const CSerializable& o) { WriteObject(&o); }
       ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:198:7: note:   no known conversion for argument 1 from ‘int’ to ‘const mrpt::utils::CSerializable&’
/usr/include/mrpt/base/include/mrpt/utils/CStream.h: At global scope:
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:524:28: error: ‘std::enable_if_t’ has not been declared
 template <typename T, std::enable_if_t<std::is_base_of<
                            ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:524:39: error: expected ‘>’ before ‘<’ token
 template <typename T, std::enable_if_t<std::is_base_of<
                                       ^
/usr/include/mrpt/base/include/mrpt/utils/CStream.h: In function ‘mrpt::utils::CStream& mrpt::utils::operator<<(mrpt::utils::CStream&, const mapbox::util::variant<Types ...>&)’:
/usr/include/mrpt/base/include/mrpt/utils/CStream.h:545:17: error: use of ‘auto’ in lambda parameter declaration only available with -std=c++14 or -std=gnu++14
  pObj.match([&](auto& t) { out << t; });
                 ^
In file included from /usr/include/mrpt/base/include/mrpt/utils/TCamera.h:15:0,
                 from /usr/include/mrpt/base/include/mrpt/utils/CImage.h:16,
                 from /usr/include/mrpt/base/include/mrpt/utils.h:38,
                 from /home/muazzam/mywork/python/thesis/PD-Flow/scene_flow_visualization.h:24,
                 from /home/muazzam/mywork/python/thesis/PD-Flow/main_scene_flow_visualization.cpp:24:
/usr/include/mrpt/base/include/mrpt/utils/CConfigFileBase.h: At global scope:
/usr/include/mrpt/base/include/mrpt/utils/CConfigFileBase.h:80:22: error: ‘enable_if_t’ in namespace ‘std’ does not name a template type
      typename = std::enable_if_t<std::is_enum<enum_t>::value>>
                      ^
/usr/include/mrpt/base/include/mrpt/utils/CConfigFileBase.h:80:33: error: expected ‘>’ before ‘<’ token
      typename = std::enable_if_t<std::is_enum<enum_t>::value>>
                                 ^
/usr/include/mrpt/base/include/mrpt/utils/CConfigFileBase.h:96:22: error: ‘enable_if_t’ in namespace ‘std’ does not name a template type
      typename = std::enable_if_t<!std::is_enum<data_t>::value>>
                      ^
/usr/include/mrpt/base/include/mrpt/utils/CConfigFileBase.h:96:33: error: expected ‘>’ before ‘<’ token
      typename = std::enable_if_t<!std::is_enum<data_t>::value>>
                                 ^
In file included from /home/muazzam/mywork/python/thesis/PD-Flow/main_scene_flow_visualization.cpp:24:0:
/home/muazzam/mywork/python/thesis/PD-Flow/scene_flow_visualization.h:93:13: error: ‘COpenGLScenePtr’ in namespace ‘mrpt::opengl’ does not name a type
     opengl::COpenGLScenePtr  scene;
             ^
CMakeFiles/Scene-Flow-Visualization.dir/build.make:62: recipe for target 'CMakeFiles/Scene-Flow-Visualization.dir/main_scene_flow_visualization.o' failed
make[2]: *** [CMakeFiles/Scene-Flow-Visualization.dir/main_scene_flow_visualization.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Scene-Flow-Visualization.dir/all' failed
make[1]: *** [CMakeFiles/Scene-Flow-Visualization.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

现在我不知道如何做这项工作。有一天我被困在这里。谁能帮助我建立这个项目?请。

1 个答案:

答案 0 :(得分:2)

In [448]: a Out[448]: array([ 9, 10, 11]) In [449]: b Out[449]: array([5, 6, 7]) In [450]: out Out[450]: array([[[ 9., 5., 45., 9., 5., 0., 0., 0., 0.], [ 9., 9., 25., 18., 9., 0., 0., 0., 0.]], [[ 10., 6., 60., 0., 0., 10., 6., 0., 0.], [ 10., 10., 36., 0., 0., 20., 10., 0., 0.]], [[ 11., 7., 77., 0., 0., 0., 0., 11., 7.], [ 11., 11., 49., 0., 0., 0., 0., 22., 11.]]]) 仅在C ++ 14中引入,因此您应该将所需的标准设置为C ++ 14:

std::enable_if_t