Why Opencv GPU code is slower than CPU?

后端 未结 5 1017
死守一世寂寞
死守一世寂寞 2020-12-13 16:02

I\'m using opencv242 + VS2010 by a notebook.
I tried to do some simple test of the GPU block in OpenCV, but it showed the GPU is 100 times slower than CPU codes. In this

5条回答
  •  抹茶落季
    2020-12-13 16:39

    try to run more than once....

    -----------excerpt from http://opencv.willowgarage.com/wiki/OpenCV%20GPU%20FAQ Perfomance

    Why first function call is slow?

    That is because of initialization overheads. On first GPU function call Cuda Runtime API is initialized implicitly. Also some GPU code is compiled (Just In Time compilation) for your video card on the first usage. So for performance measure, it is necessary to do dummy function call and only then perform time tests.

    If it is critical for an application to run GPU code only once, it is possible to use a compilation cache which is persistent over multiple runs. Please read nvcc documentation for details (CUDA_DEVCODE_CACHE environment variable).

提交回复
热议问题