Ask Your Question
0

Mat vs GpuMat (other than being on the gpu)

asked 2014-07-08 15:09:39 -0600

abelis gravatar image

Quick (and dumb) question is there a difference between a Mat and GpuMat? If I were to create a Mat on the CPU, copy it to the GPU using the Cuda copy calls then perform actions on that Mat in a Cuda kernel, vs creating a GPUMat, passing that pointer to my Cuda kernel and performing actions on that, is there anything different between the two?

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-07-08 15:20:31 -0600

unxnut gravatar image

Before you do this you may want to check if the host memory can be mapped into GPU memory by using the function gpu::CudaMem::canMapHostMemory. If the mapping is supported, you should be good to go.

edit flag offensive delete link more

Comments

Does it matter that I am trying to do a "cuMemcpyHtoD" instead of trying to map and use the host memory? I am using the pre-built version of openCV (with no GPU support) and instead of recompiling to get the GPU support from OpenCV, I was just going to do a "quick and dirty" attempt at using the source code to one of the Optical Flow Algorithm in the .cu file and changing some variable types etc. but I did not know if the GPUMat was extremely different from the cvMat or basically interchangeable. Its a long story of why I am doing this but it boiled down to performance of opencv and UDP streams (h.264).

abelis gravatar imageabelis ( 2014-07-08 16:09:16 -0600 )edit

I'll suggest not mixing OpenCV GPU and CUDA calls. The results may be unpredictable.

unxnut gravatar imageunxnut ( 2014-07-08 17:58:02 -0600 )edit

Question Tools

Stats

Asked: 2014-07-08 15:09:39 -0600

Seen: 1,645 times

Last updated: Jul 08 '14