Ask Your Question
0

Opencv 3.0 + visual studio 2013 + CUDA + CMake

asked 2015-07-28 15:46:54 -0600

updated 2015-07-29 14:58:57 -0600

I've successfully compiled OpenCV 3.0 with CUDA 7 with Visual Studio 2013 makeing the solution with CMake for x64 architecture. I've notice that my *300.dll performances are slower than the already compiled *249.dll for x86 architecture (downloaded from opencv.org). For example the same sobel test program run with 2.4.9 at 30msec while run with 3.0 at 280msec O_O. How could it be possible? Have I missing some optimization or building options?

Thats my Flag for Release: //Flags used by the compiler during release builds. CMAKE_C_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /D NDEBUG

Here's my CMAKE Output

General configuration for OpenCV 3.0.0 =====================================
  Version control:               unknown

  Platform:
    Host:                        Windows 6.2 AMD64
    CMake:                       3.3.0-rc4
    CMake generator:             Visual Studio 12 2013 Win64
    CMake build tool:            C:/Program Files (x86)/MSBuild/12.0/bin/MSBuild.exe
    MSVC:                        1800

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe  (ver 18.0.31101.0)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /INCREMENTAL:NO  /debug
    Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
    Precompiled headers:         YES
    Extra dependencies:          comctl32 gdi32 ole32 setupapi ws2_32 vfw32 cudart nppc nppi npps cublas cufft
    3rdparty dependencies:       zlib libjpeg libwebp libpng libtiff libjasper IlmImf ippicv

  OpenCV modules:
    To be built:                 hal cudev core cudaarithm flann imgproc ml video cudabgsegm cudafilters cudaimgproc cudawarping imgcodecs photo shape videoio cudacodec highgui objdetect ts features2d calib3d cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo stitching superres videostab
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 java python2 python3 viz

  Windows RT support:            NO

  GUI: 
    QT:                          NO
    Win32 UI:                    YES
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.8)
    JPEG:                        build (ver 90)
    WEBP:                        build (ver 0.3.1)
    PNG:                         build (ver 1.5.12)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)
    GDAL:                        NO

  Video I/O:
    Video for Windows:           YES
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      YES (prebuilt binaries)
      codec:                     YES (ver 55.18.102)
      format:                    YES (ver 55.12.100)
      util:                      YES (ver 52.38.100)
      swscale:                   YES (ver 2.3.100)
      resample:                  NO
      gentoo-style:              YES
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    DirectShow:                  YES
    Media Foundation ...
(more)
edit retag flag offensive close merge delete

Comments

I suggest you provide your complete CMAKE output ... probably you forgot to enable a flag somewhere?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-29 03:02:05 -0600 )edit

I've posted my CMAKE output. Hope it helps us to find the reason...

shadowsheep gravatar imageshadowsheep ( 2015-07-29 14:57:03 -0600 )edit
2

So you compared the performance between the pre-built *249.dll with your own build of *300.dll.

What happen if you compare the performance with the pre-built OpenCV 3.0.0 ?

Eduardo gravatar imageEduardo ( 2015-07-29 15:19:48 -0600 )edit

Eduardo I've tried also with the precompiled *world300.dll and I've got the same lower performances than version 2.4.9. But now the question is... why with OpenCV 3.0.0 the sobel performance are so degraded than OpenCV 2.4.9?

shadowsheep gravatar imageshadowsheep ( 2015-07-30 05:18:11 -0600 )edit

Are you sure you used the same code, with the same Visual Studio configuration (release mode, compiler flags, etc.), running the executable in Visual Studio or outside ?

Eduardo gravatar imageEduardo ( 2015-07-30 05:27:23 -0600 )edit

Yes, the code below

int scale = 1;
int delta = 0;
int ddepth = CV_16S;

Mat grad;

int a, b;

cout << "\n STD SOBEL STARTED \n";
a = getTickCount();
Sobel(image, grad, ddepth, 1, 1, 5, scale, delta, BORDER_DEFAULT);
b = getTickCount();

printf("\n STD SOBEL FINISHED in %f, total = %f \n", 1000 * (((double)(b - a)) / getTickFrequency()), 1000 * (((double)(B - A)) / getTickFrequency()));

Run faster with OpenCV 2.4.9 than OpenCV 3.0

shadowsheep gravatar imageshadowsheep ( 2015-07-30 05:33:02 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-08-01 07:56:35 -0600

updated 2015-08-01 07:58:24 -0600

The question is answer by Eduardo when he asked me to try the prebuild binaries. Because the problem I'm experiencing there's also with the prebuild version I've open another question here: http://answers.opencv.org/question/67...

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-07-28 15:46:54 -0600

Seen: 2,966 times

Last updated: Jul 29 '15