Ask Your Question

cv::gpu::norm speed up

asked 2012-11-05 15:19:52 -0500

andreas_ gravatar image

Hi all,

I use the function cv::gpu::norm in a program. This function gets called a lot. With CPU i get about 5 Hz, with GPU it's not usable (a couple of seconds). I suppose the problem is, that the matrices are very small (4x4 - 16x16), so that I can't really make use of the GPU's performance.

Just some background information: I use the norm function to calculate the radial basis function:

double calculateRBFresponse(boost::shared_ptr<cv::gpu::GpuMat> input, boost::shared_ptr<cv::gpu::GpuMat> neuron, double beta){

      double response = cv::gpu::norm(*input, *neuron, cv::NORM_L2);
      return cv::exp( -beta * cv::pow ( response, 2.0 ));

Is there any way to speed this up? Or is it - as i suppose - the wrong task for a GPU? Or is there maybe a way to parallelize the task, so that multiple norm calls are run in parallel?

Cheers, Andreas

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-11-06 00:48:44 -0500

Michael Burdinov gravatar image

updated 2012-11-06 01:35:41 -0500

This is very wrong task for GPU. Great speed of GPU is not a result of fast cores, but number of cores + ability for running huge amount processes in parallel. It need dozens of thousands of parallel processes just to supply enough work for its cores (maybe even hundreds of thousands in new GPUs). Anything less than that mean that GPU is not fully used. And to reach its full performance you will need images of few mega pixels.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2012-11-05 15:19:52 -0500

Seen: 418 times

Last updated: Nov 06 '12