【发布时间】:2013-09-27 02:42:19
【问题描述】:
我正在使用 CUDA 做一些计算机视觉方面的工作。以下代码大约需要 20 秒才能完成。
__global__ void nlmcuda_kernel(float* fpOMul,/*other input args*/){
float fpODenoised[75];
/*Do awesome stuff to compute fpODenoised*/
//inside nested loops:(This is the statement that is the bottleneck in the code.)
fpOMul[ii * iwl * iwxh + iindex * iwxh + il] = fpODenoised[ii * iwl +iindex];
}
如果我将该语句替换为
fpOMul[ii * iwl * iwxh + iindex * iwxh + il] = 2.0f;
代码几乎不需要几秒钟即可完成。
为什么指定的语句很慢,我怎样才能让它运行得快?
【问题讨论】: