使用thrust,在运行时总是出错

ctech 2014-02-06 05:08:17
编译正常,运行时总是出现这个错误:Unhandled exception at 0x7735c41f in ThrustAPI.exe: Microsoft C++ exception: thrust::system::system_error at memory location 0x002af4d8.. ,怎么解决呢?谢谢!


#include <iostream>
using namespace std;

#include <thrust\reduce.h>
#include <thrust\sequence.h>
#include <thrust\host_vector.h>
#include <thrust\device_vector.h>

int main()
{
const int N = 5;

thrust::device_vector<int> a(N);

thrust::sequence(a.begin(), a.end(), 0);

int sumA = thrust::reduce(a.begin(), a.end(), 0);

int sumCheck = 0;
for(int i = 0; i < N; i++) sumCheck += i;

if(sumA == sumCheck)
{
cout << "Test Succeeded!" << endl;
}
else
{
cerr << "Test FAILED!" << endl;
return 1;
}

return 0;
}
...全文
1482 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_16705337 2014-06-20
  • 打赏
  • 举报
回复
求解决顶贴在线等
逍遥小孩 2014-06-20
  • 打赏
  • 举报
回复
cuda环境没有没有配置
彩阳 2014-04-22
  • 打赏
  • 举报
回复
我也一般都使用release模式。
ypzhang_csdn 2014-04-22
  • 打赏
  • 举报
回复
原因可能是debug下编译器带了-G开关(加了以后可以支持device函数的断点)。可惜Thrust不能带这个开关。这在他们的google code的网站上提了一下。
scdengyong 2014-04-21
  • 打赏
  • 举报
回复
我知道一个可以运行的方案,就是把Visual Studio里的Debug改为Release,这样就可以运行了,但是不知道为什么Debug下就不能运行
scdengyong 2014-04-21
  • 打赏
  • 举报
回复
帮忙顶一下,我运行的时候也出现了这个问题,求解决方案
Double_Lan_2975 2014-04-12
  • 打赏
  • 举报
回复
你windows下的cuda环境没有配置好

589

社区成员

发帖
与我相关
我的任务
社区描述
CUDA™是一种由NVIDIA推出的通用并行计算架构,该架构使GPU能够解决复杂的计算问题。 它包含了CUDA指令集架构(ISA)以及GPU内部的并行计算引擎。
社区管理员
  • CUDA编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧