cuda的参数传递问题!
cudaMalloc((void**) &device_result, sizeof(double) * NumBlock * NumGrid);
cudaMemset((void**) &device_result, 0,sizeof(double) * width*height);
然后把device_result作为参数传递到
conv <<< dimGrid, dimBlock>>>(device_result, device_I1, size);
在conv中
__global__ void SNN(double* t_result, double* t_I1, int t_size)
{
// determine where in the thread grid we are
int idx = threadIdx.x+blockIdx.x * blockDim.x;
t_result[idx] = 0;
...
}
请问t_result[idx] = 0;要加上吗???我试了,如果不加结果不对,可是我已经cudaMemset((void**) &device_result, 0,sizeof(double) * width*height);了呀。