CUDA中的广义Hough变换 - 如何加快binning过程? [英] Generalized Hough Transform in CUDA - How can I speed up the binning process?

查看:250
本文介绍了CUDA中的广义Hough变换 - 如何加快binning过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所说,我正在研究一些平行计算机视觉技术的个人研究。使用CUDA,我试图实现一个GPGPU版本的霍夫变换。我遇到的唯一问题是在投票过程中。我调用atomicAdd()以防止多个同时写入操作,我似乎没有获得太多的性能效率。我在网上搜索,但没有发现任何方式显着提高表决过程的性能。



非常感谢您提供有关投票程序的任何帮助。

解决方案

我不熟悉霍夫变换,所以发布一些伪码可以帮助这里。但是如果你对投票感兴趣,你可以考虑使用CUDA的投票内在指令来加速这一点。



请注意,这需要2.0或更高的计算能力(费米或更高版本)。



中的特定条件为真的线程数,您只需使用 __ syncthreads_count()

  bool condition = ...; //计算条件
int blockCount = __syncthreads_count(condition); //必须是非发散代码

如果你想计算线程数



<$ p $ <$ em>
p> bool condition = ...; //计算条件
int blockCount = __syncthreads_count(condition); //必须是非发散代码
atomicAdd(totalCount,blockCount);

如果需要计算小于块的线程数, true,可以使用 __ ballot() __ popc()(人口计数)。

  //获取条件为真的每个warp内的线程数
bool condition = ...; //计算每个线程中的条件
int warpCount = __popc(__ ballot()); //查看CUDA编程指南的详细信息

希望这有助于。


Like the title says, I'm working on a little personal research into parallel computer vision techniques. Using CUDA, I am trying to implement a GPGPU version of the Hough transform. The only problem that I've encountered is during the voting process. I'm calling atomicAdd() to prevent multiple, simultaneously write operations and I don't seem to be gaining too much performance efficiency. I've searched the web, but haven't found any way to noticeably enhance the performance of the voting process.

Any help you could provide regarding the voting process would be greatly appreciated.

解决方案

I'm not familiar with the Hough transform, so posting some pseudocode could help here. But if you are interested in voting, you might consider using the CUDA vote intrinsic instructions to accelerate this.

Note this requires 2.0 or later compute capability (Fermi or later).

If you are looking to count the number of threads in a block for which a specific condition is true, you can just use __syncthreads_count().

bool condition = ...; // compute the condition
int blockCount = __syncthreads_count(condition); // must be in non-divergent code

If you are looking to count the number of threads in a grid for which the condition is true, you can then do the atomicAdd

bool condition = ...; // compute the condition
int blockCount = __syncthreads_count(condition); // must be in non-divergent code
atomicAdd(totalCount, blockCount);

If you need to count the number of threads in a group smaller than a block for which the condition is true, you can use __ballot() and __popc() (population count).

// get the count of threads within each warp for which the condition is true
bool condition = ...; // compute the condition in each thread
int warpCount = __popc(__ballot()); // see the CUDA programming guide for details

Hope this helps.

这篇关于CUDA中的广义Hough变换 - 如何加快binning过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆