Ask Your Question

change GpuMat by CUDA

asked 2018-08-04 10:58:28 -0500

abdorreza gravatar image

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)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-08-08 02:27:30 -0500

Rado gravatar image

Do the following from the documentation answer your question?

  • no functions that return references to their data (because references on GPU are not valid for CPU)


In contrast with Mat, in most cases GpuMat::isContinuous() == false

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-08-04 10:58:28 -0500

Seen: 316 times

Last updated: Aug 08 '18