thrust::stable_sort_by_key报错

shizao 2019-08-23 02:44:19
float *d_scores = 0;
cudaMalloc((void **) &d_scores, batchSize * scoresLength * sizeof(float));

... d_scores 存放值

int *d_scoresIndex = 0;
cudaMalloc((void **) &d_scoresIndex, batchSize * scoresLength * sizeof(int));

... d_scoresIndex 存放值

thrust::device_ptr<float> thrust_d_scores(d_scores);
thrust::device_ptr<int> thrust_d_scoresIndex(d_scoresIndex);

for (int i = 0; i < batchSize; ++i)
{
std::cout << "for trust i:" << i << std::endl;

thrust::stable_sort_by_key(thrust_d_scores + i * scoresLength,
thrust_d_scores + i * scoresLength + scoresLength,
thrust_d_scoresIndex + i * scoresLength,
thrust::greater<float>());
}



运行报错:

terminate called after throwing an instance of 'thrust::system::system_error'
what(): radix_sort: failed to get memory buffer: invalid configuration argument
Aborted (core dumped)


请问代码有什么问题呢?
...全文
487 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
x1033628785 2020-06-01
  • 打赏
  • 举报
回复
我也碰上了这种问题,请问你解决了吗。怎么解决的

589

社区成员

发帖
与我相关
我的任务
社区描述
CUDA™是一种由NVIDIA推出的通用并行计算架构,该架构使GPU能够解决复杂的计算问题。 它包含了CUDA指令集架构(ISA)以及GPU内部的并行计算引擎。
社区管理员
  • CUDA编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧