Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

change GpuMat by CUDA

Hi, I wrote a program for change GpuMat by CUDA in c++. But my CUDA code can not find GpuMat cells correctly and it works wrong. please say how I can access to cells address correctly ?

Main :

Read_Stats << <gridS, blockS >> > ((int*), MyMat_s.rows, MyMat_s.cols, GMat_s.step);;

Device (GPU)

__global__ void Read_Stats(int* mt, int h, int w, size_t step)

    int x = blockIdx.x * blockDim.x + threadIdx.x;
    int y = blockIdx.y * blockDim.y + threadIdx.y;
        int index = ((w*row) + col);
    mt[index] = 0;
    if (index >= h*w)