相关疑难解决方法(0)

使用CUDA和C++ 11时出错

我正在使用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)

c++ gcc cuda c++11

24
推荐指数
2
解决办法
1万
查看次数

CUDA和Thrust库:使用.cuh .cu和.cpp文件以及-std = c ++ 0x时出现问题

我想要一个.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)

parallel-processing cuda gpu-programming thrust c++11

2
推荐指数
1
解决办法
2788
查看次数

标签 统计

c++11 ×2

cuda ×2

c++ ×1

gcc ×1

gpu-programming ×1

parallel-processing ×1

thrust ×1