我目前使用的数据自动化系统7.5下VS 2013。今天,我需要从device_vector中删除一些元素,从而决定使用remove_if。但是,不管我如何修改代码,程序只是编译得很好,但在运行时抛出"thrust::system::system_error“。
首先,我尝试了自己的代码:
int main()
{
thrust::host_vector<int> AA(10, 1);
thrust::sequence(AA.begin(), AA.end());
thrust::host_vector<bool> SS(10,false);
thrust::fill(SS.begin(), SS.begin() + 5, true);
thrust::device_vector<int> devAA=AA;
thrust::device_vector<bool> devSS = SS;
thrust::device_vector<int>::iterator new_end = thrust::remove_if(thrust::device,
devAA.begin(), devAA.end(), devSS.begin(), thrust::identity<int>());
}但是它在运行时抛出了thrust::system::system_error。但是,如果我使用两个host_vector,即AA和SS来执行remove_if,那么一切都很好。
然后,我尝试了我在stackoverflow上找到的代码,Robert的答案中的代码看起来很好,但是在我的机器上,它仍然抛出thrust::system::system_error。
新版本的推力有什么改变吗?还是我该试试别的办法?我正在用cmake来组织代码,有什么特别之处吗?
https://stackoverflow.com/questions/34000054
复制相似问题