【问题标题】:Using CUDA 7.0 with gcc 5.2.0 and c++11将 CUDA 7.0 与 gcc 5.2.0 和 c++11 一起使用
【发布时间】:2015-11-28 22:38:36
【问题描述】:

我正在尝试使用 nvcc 编译 C++ 文件。该命令如下所示:

nvcc -std=c++11 file.cu -o file

编译器版本如下:

$ nvcc --version
Cuda compilation tools, release 7.0, V7.0.27
$ gcc --version
gcc (GCC) 5.2.0

错误看起来像 nvcc 与最新的 gcc 版本不兼容。

/usr/include/c++/5.2.0/bits/stl_iterator_base_types.h(154): error: class "std::vector<Pixel, std::allocator<Pixel>>" has no member "iterator_category"
      detected during:
        instantiation of class "std::__iterator_traits<_Iterator, void> [with _Iterator=std::vector<Pixel, std::allocator<Pixel>>]"
/usr/include/c++/5.2.0/type_traits(1492): error: class "std::__is_convertible_helper<<error-type>, std::input_iterator_tag, false>" has no member class "type"
      detected during instantiation of class "std::is_convertible<_From, _To> [with _From=<error-type>, _To=std::input_iterator_tag]"
/usr/include/c++/5.2.0/type_traits(1492): error: not a class or struct name
      detected during instantiation of class "std::is_convertible<_From, _To> [with _From=<error-type>, _To=std::input_iterator_tag]" 
[...]

有没有人遇到过类似的问题?谷歌搜索在那里没有帮助我。也许我在这里遗漏了一些东西 cuda 对我来说仍然是新的。

提前致谢!

【问题讨论】:

  • CUDA 附带的“入门”文档详细说明了特定 CUDA 版本支持哪些主机编译器版本。您可能需要查阅该文档的 Linux 版本。

标签: c++11 gcc cuda nvcc


【解决方案1】:

因为 CUDA 工具链允许在同一个源文件中混合设备和主机代码,它需要与主机工具链相当紧密的集成。因此,CUDA 工具链通常不适用于比 NVIDIA 测试和支持的版本更新的主机工具链。

每个 CUDA 版本都附带一个“入门”文档,说明支持哪些版本的主机工具链。本文档共有三个特定于操作系统的版本;您问题中的信息表明您使用的是 Linux 平台,因此您需要查阅 Linux 版本的“入门”。

由于CUDA 7.0是目前最新发布的CUDA版本,Linux版的“入门”文档也可以在网上找到here。它显示支持各种版本的 gcc 4.8 和 gcc 4.9,具体取决于您使用的特定 Linux 版本。

【讨论】:

  • 非常感谢。应该看看文档:/顺便说一句,我在 Arch linux 上。
猜你喜欢
  • 2012-11-15
  • 2017-08-11
  • 2013-12-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-29
相关资源
最近更新 更多