【发布时间】:2012-10-17 03:46:48
【问题描述】:
我找不到 CUDA 5.0 支持哪个版本/哪个 c++ 概念。 我在 CUDA 5.0 RC 随附的编程指南或参考指南中找不到任何信息。特别是我想知道 CUDA 5.0 是否支持 C++11。有人能指点我一个地方来查找这些信息吗?
【问题讨论】:
-
您是在询问 C++ 设备代码支持还是主机代码?
我找不到 CUDA 5.0 支持哪个版本/哪个 c++ 概念。 我在 CUDA 5.0 RC 随附的编程指南或参考指南中找不到任何信息。特别是我想知道 CUDA 5.0 是否支持 C++11。有人能指点我一个地方来查找这些信息吗?
【问题讨论】:
显然 5.0 RC 中没有可用的 C++11 功能。 nvcc 仍然不理解 gcc 4.6 标准包含中使用的 C++11 语法 (见Error while using CUDA and C++11):
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2012 NVIDIA Corporation
Built on Tue_Jul_31_17:46:14_PDT_2012
Cuda compilation tools, release 5.0, V0.2.1221
$ cat test.cu
int main()
{
}
$ nvcc -Xcompiler "-std=c++0x" test.cu
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++config.h(159): error: identifier "nullptr" is undefined
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/c++config.h(159): error: expected a ";"
/usr/include/c++/4.6/bits/exception_ptr.h(93): error: incomplete type is not allowed
...
【讨论】:
发行说明包含一个支持平台列表,包括支持哪些版本的 GCC,5.0 Release Candidate release notes 表明,对于某些发行版,最新支持的 GCC 是 4.6(对于其他发行版来说更旧)。
一旦您知道支持哪个 GCC 版本,请与 GCC C++0x/C++11 feature list 进行比较。
【讨论】:
它不支持 gcc 4.7 所以some of the c++11 features 不可用:
- Non-static data member initializers
- Template aliases :(
- Delegating constructors
- User-defined literals
- Extended friend declarations
- Explicit virtual overrides
【讨论】:
现在,如果您询问 Cuda/C++ 或 THRUST 库。推力库在容器、迭代器和算法方面与 stl c++ 非常相似,但它不是 c++ 11。
nvcc 编译 gpu 代码。 nvcc 支持(Cuda C 和 Cuda C++ /thrust) gcc 编译 cpu 代码。 gcc(支持 C 和 C++)。
【讨论】: