关于thrust::device_vector的问题

//seqCuda.cu
#include
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=50000;

// task 1: create the array
thrust::device_vector a(N);

// task 2: fill the array
thrust::sequence(a.begin(), a.end(), 0);

// task 3: calculate the sum of the array
int sumA= thrust::reduce(a.begin(),a.end(), 0);

// task 4: calculate the sum of 0 … N-1
int sumCheck=0;
for(int i=0; i < N; i++) sumCheck += i;

// task 5: check the results agree
if(sumA == sumCheck) cout << “Test Succeeded!” << endl;
else { cerr << “Test FAILED!” << endl; return(1);}

return(0);
}
程序就是上面这段,书上面的。我是VS2010+cuda5.5,在debug模式下运行到 thrust::device_vector a(N);,总是出错
[attach]3394[/attach]
我试过把 thrust::device_vector a(N),改成C++的语言,没问题,求解!谢谢了!难道是 thrust::device_vector 这句使用有什么限制?还是我环境配置有问题,大神求解!

看起來沒什麼問題!

我運行了一次結果是Test Succeeded!

我发现了我的电脑,能编译thrust::sequence 和thrust::reduce,但运行就出错,这是什么原因?

弱弱的问下,您有N卡吗?
或者因为optimus技术导致无法找到显卡?

请您参阅一下以前的讨论帖:

[u]http://cudazone.nvidia.cn/forum/forum.php?mod=viewthread&tid=6892[/u]

[u]http://cudazone.nvidia.cn/forum/forum.php?mod=viewthread&tid=6343&extra=page%3D1&page=1[/u]

并加以尝试。

额。。。。必须是N卡,GF GTX 550 Ti。CUDA的那几个测试程序我都能跑,没问题。

安装下最新的驱动程序试试

驱动也是最新的