Cuda 由推力迭代器指向的打印值
请参阅以下代码:Cuda 由推力迭代器指向的打印值,cuda,gpu,thrust,Cuda,Gpu,Thrust,请参阅以下代码: thrust::device_vector<int>::iterator whereToBegin = copyListOfNgramCounteachdoc.begin(); end = thrust::unique_by_key(end.first, end.first + numUniqueNgrams,end.second); thrust::device_vector<int>::iterator end1 = end.first; thrus
thrust::device_vector<int>::iterator whereToBegin = copyListOfNgramCounteachdoc.begin();
end = thrust::unique_by_key(end.first, end.first + numUniqueNgrams,end.second);
thrust::device_vector<int>::iterator end1 = end.first;
thrust::device_vector<int>::iterator iter;
for(iter = whereToBegin; iter!=end1; iter++){
//PRINT VALUE POINTED AT BY ITERATOR
}
推力::设备\向量::迭代器whereToBegin=copylistOfGramCounteAchDoc.begin();
end=推力::通过_键唯一_(end.first,end.first+numuniquegrams,end.second);
推力::设备\向量::迭代器end1=end.first;
推力::设备向量::迭代器iter;
用于(iter=whereToBegin;iter!=end1;iter++){
//迭代器指向的打印值
}
问题很简单。如何在主机代码中打印iter所指向的值:
std::cout << *iter << std::endl;
主机代码中的std::cout:
std::cout << *iter << std::endl;
std::谢谢。如果您也能看看我的问题推力::unique_by_key吃掉最后一个元素,并告诉我您是否看到任何有趣的东西,我将不胜感激。谢谢。如果你们也能看一下我的问题,我将不胜感激:独特的,按键的,吃掉最后一个元素,如果你们看到任何有趣的东西,请告诉我