【发布时间】:2019-11-09 15:55:35
【问题描述】:
我有两个用无符号整数填充的 ShaderStorageBufferObjects。 我正在尝试使用推力按键对它们进行排序(这两个缓冲区配对在一起) 这就是我正在做的事情
struct cudaGraphicsResource *cuda_keys, *cuda_values;
thrust::device_ptr<uint> keys_device_ptr, values_device_ptr;
//CellIndexList and ParticleIndexList are my buffers and ID being their uint handle
cudaGraphicsGLRegisterBuffer(&cuda_keys, CellIndexList->GetID(), cudaGraphicsMapFlagsNone);
cudaGraphicsGLRegisterBuffer(&cuda_values, ParticleIndexList->GetID(), cudaGraphicsMapFlagsNone);
uint* keys_ptr, *values_ptr;
size_t keys_size, values_size;
{
//this code is being executed in a loop
cudaGraphicsMapResources(1, &cuda_keys, 0);
cudaGraphicsResourceGetMappedPointer((void **)&keys_ptr, &keys_size, cuda_keys);
cudaGraphicsMapResources(1, &cuda_values,0);
cudaGraphicsResourceGetMappedPointer((void**)&values_ptr, &values_size, cuda_values);
keys_device_ptr = thrust::device_pointer_cast(keys_ptr);
values_device_ptr = thrust::device_pointer_cast(values_ptr);
thrust::sort_by_key(keys_device_ptr, keys_device_ptr + nParticles, values_device_ptr, thrust::less<uint>());
cudaGraphicsUnmapResources(1, &cuda_keys, 0);
cudaGraphicsUnmapResources(1, &cuda_values, 0);
}
我在编译器输出中得到了这个“thrust::detail::STATIC_ASSERTION_FAILURE”。
【问题讨论】:
-
This 可能感兴趣。请注意,该问题还链接到该问题的先前 linux 版本。