我目前使用的数据自动化系统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来组织代码,有什么特别之处吗?
发布于 2015-12-02 02:52:51
问题似乎在于OP正在构建一个32位的项目。这个问题在切换到64位项目时得到了解决。
我对CUDA 7.5及以后的建议是只使用64位项目.如果您查看视窗和linux上32位支持的当前状态,您会发现它是相当有限的。
纯属猜测,这个问题可能与推力问题#715有关。
https://stackoverflow.com/questions/34000054
复制相似问题