首页 > 其他 > 详细

thrust::device_vector无法赋值?

时间:2014-12-06 15:13:35      阅读:779      评论:0      收藏:0      [点我收藏+]

在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

thrust::device_vector无法赋值?

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!