CUDA调试 数组传进kernel

之前采用的是:

在Doc.cpp里,定义,并调用函数得到Gauskernel数组

float Gauskernel[(2*f+1)*(2*f+1)]={0.0};
make_Gauskernel(f,Gauskernel,2*f+1,2*f+1);

然后

NlmDenoise(pGpuData,pResult,PicWidth,PicHeight,Gauskernel);//此函数在host.cu里定义

然后

host.cu里调用kernel.cu。

调试了超过2天,各种怀疑,最后终于认定是这个错误。不能这么传值。

cudaMalloc((void **)&kernel, sizeof(float)*(2*f+1)*(2*f+1)); 然后拷贝到显存里的kernel

cudaMemcpy(kernel,Gauskernel,sizeof(float)*(2*f+1)*(2*f+1),cudaMemcpyHostToDevice);

以后的函数就调用kernel

NlmDenoise(pGpuData,pResult,PicWidth,PicHeight,kernel);//此函数在host.cu里定义

posted on 2011-08-11 19:35  kyleada  阅读(1261)  评论(0编辑  收藏  举报

导航