thrust::device_vector无法赋值?

时间:2014-12-06 15:13:35   收藏:0   阅读:779

在C++的GPU库thrust中,有两种vector

thrust::device_vector<int> D; //GPU使用的内存中的向量
thrust::host_vector<int> H;  //CPU使用的内存中的向量

其中host_vector是可以用构造函数初始化的,比如:

thrust::host_vector<int> H(10,1); //长度为10,每个元素都是1

但是device_vector这么做编译都不能通过……不能理解……

官网上给出的例子是可以的啊:

https://code.google.com/p/thrust/wiki/QuickStartGuide

目前采用的方案是:

构造host_vector,然后拷贝给device_vector

原文:http://www.cnblogs.com/plwang1990/p/4148207.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!