GaussianBlur in windows10 vs2017 and ubuntu g++ has different speed?

asked 2019-04-25 20:01:02 -0600

zack gravatar image

I use this code in windows and ubuntu

double start = cv::getTickCount();
cv::GaussianBlur(img_cont, edge_gau, Size(3, 3), 0.8);
cv::GaussianBlur(img_back, img_gau, Size(3, 3), 0.8);
double end = cv::getTickCount();
double time = (end - start) / cv::getTickFrequency();

in vs2017 Release and debug mode I open /openmp /fp:fast /sdl- /permissive- /Gy /Oi /arch:AVX2 /O2 /Ot /MD.

debug cost time: 0.02s

release cost time:0.005s

And opencv3.4.0 build in ubuntu 16.04:
cmake -D WITH_TBB=ON -D WITH_OPENMP=ON -D WITH_IPP=ON -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_EXAMPLES=OFF -D WITH_NVCUVID=ON -D WITH_CUDA=ON -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D WITH_CSTRIPES=ON -D WITH_OPENCL=ON CMAKE_INSTALL_PREFIX=/usr/local/ ..

makefile: CXXFLAGS := -Wall -std=c++11 -O2 -fPIC

release cost time: 0.02s

so the time of release mode in ubuntu is almost equal to deubg mode in windows?

edit retag flag offensive close merge delete

Comments

  • don't measure debug mode
  • don''t measure a single function call. (make a loop and average over 1000)
  • if there's any chance it's using opencl, use a "warm cache" (don't measure the 1st call)
berak gravatar imageberak ( 2019-04-26 01:24:22 -0600 )edit