我正在使用CUDA 4.1和GCC 4.5 ...(最终!CUDA支持GCC 4.5,但仍在等待GCC 4.6).无论如何,是否可以将C++ 11与CUDA 4.1一起使用?
我试过传递:
--compiler-options "-std=c++0x"
Run Code Online (Sandbox Code Playgroud)
到nvcc,它给我带来了一堆错误:
/usr/include/c++/4.5/exception_ptr.h(100): error: copy constructor for class "std::__exception_ptr::exception_ptr" may not have a parameter of type "std::__exception_ptr::exception_ptr"
/usr/include/c++/4.5/exception_ptr.h(100): error: expected a ")"
/usr/include/c++/4.5/exception_ptr.h(110): error: expected a ")"
/usr/include/c++/4.5/exception_ptr.h(132): error: identifier "type_info" is undefined
/usr/include/c++/4.5/exception_ptr.h(101): error: identifier "__o" is undefined
/usr/include/c++/4.5/exception_ptr.h(112): error: expected a ">"
/usr/include/c++/4.5/exception_ptr.h(112): error: identifier "__o" is undefined
/usr/include/c++/4.5/nested_exception.h(62): error: expected a ";"
/usr/include/c++/4.5/nested_exception.h(64): error: expected a ";"
/usr/include/c++/4.5/nested_exception.h(77): error: member function "std::nested_exception::~nested_exception" may not be redeclared outside …
Run Code Online (Sandbox Code Playgroud) 我想要一个.cuh
文件,我可以在其中声明内核函数和宿主函数.这些函数的实现将在.cu
文件中进行.实施将包括使用Thrust
库.
在main.cpp
文件中,我想使用文件中的实现.cu
.所以我们说我们有这样的事情:
myFunctions.cuh
#include <thrust/sort.h>
#include <thrust/device_vector.h>
#include <thrust/remove.h>
#include <thrust/host_vector.h>
#include <iostream>
__host__ void show();
Run Code Online (Sandbox Code Playgroud)
myFunctions.cu
#include "myFunctions.cuh"
__host__ void show(){
std::cout<<"test"<<std::endl;
}
Run Code Online (Sandbox Code Playgroud)
main.cpp
#include "myFunctions.cuh"
int main(void){
show();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如果我通过这样做编译:
nvcc myFunctions.cu main.cpp -O3
Run Code Online (Sandbox Code Playgroud)
然后键入以运行可执行文件 ./a.out
该test
文本将被打印出来.
但是,如果我决定-std=c++0x
使用以下命令包含:
nvcc myFunctions.cu main.cpp -O3 --compiler-options "-std=c++0x"
Run Code Online (Sandbox Code Playgroud)
我收到很多错误,其中一些错误如下:
/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 …
Run Code Online (Sandbox Code Playgroud)