Ask Your Question

How long does it take to build opencv with CUDA ?

asked 2015-10-14 12:20:46 -0600

LBerger gravatar image

How long does it take to build opencv 3.0 with CUDA 7.5 using VS 2013 on windows 10 (i7-5820K 16Go) with no example no test and no perf_test but with contrib.

Now I can say after one hour it's not finished. Is it a good answer?

PS Opencv with contrib and no cuda take less than 10 minutes on my computer

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2015-10-14 13:50:10 -0600

Brandon212 gravatar image

I built it today with CUDA and TBB and it took around 2 hours each for release and debug modes.

edit flag offensive delete link more


you are lucky after 2 hours you've got something. I have got one problem with cudev :

opencv\modules\core\include\opencv2/core/cvdef.h(59): fatal error C1083: cannot open include : 'opencv2/hal/defs.h' : No such file or directory

One path was missing in this project I have added opencv\modules\hal\include to module cudev and I have got opencv with cuda

LBerger gravatar imageLBerger ( 2015-10-14 14:53:51 -0600 )edit

From my experience, there are two main factors that impact the time for building OpenCV with CUDA:

  1. The number of CPU cores, because most compilers now exploit parallel building mechanism so the more cores your machine have, the shorter time you have to wait.

  2. The number of CUDA versions your build will support. By default, OpenCV will be built with many CUDA version (1.0, 1.1, 2.0, 3.0). So if your decision to use it with one version (my choice is 2.0), you will save your time waiting it to finish.

tuannhtn gravatar imagetuannhtn ( 2015-10-15 05:12:45 -0600 )edit

@tuannhtn thanks for your comment. I understand 2 (The number of CUDA versions...)

I don't understand 1 (number of CPU cores) for building process. For example cudararithm it takes 17 minutes and 50 seconds to build 283Ko (with comments). My configuration is not the best one and but it's not at all the worst. I think good reason is your comment 2.

Now I think before building opencv cuda I should read this and this

LBerger gravatar imageLBerger ( 2015-10-15 06:35:23 -0600 )edit

About comment 2 I have try to change parameter CUDA_ARCH_BIN in cmake instead of 2.0 2.1(2.0) 3.0 3.5 I have used 3.0 only and now it takes 7minutes and 20 seconds. That's much better (~X2.5). Is it what you mean in your comment 2 "CUDA versions"?

LBerger gravatar imageLBerger ( 2015-10-15 07:43:52 -0600 )edit

Yes @LBerger, because for each CUDA (architecture) version, compiler has to compile binary (bin) code for its own. For the first comment, you may use VS 2012 or higher, so default setting is parallel build. But if you use VS 2010, you have to set it explicitly. And the result is: with n cores (or more exactly, n core threads), the compiler can compile n source code files at a time and make the process faster.

tuannhtn gravatar imagetuannhtn ( 2015-10-15 08:27:17 -0600 )edit

I have got VS2013 by default there is 12 projects can be build simultaneously. 10 minutes to build opencv with contrib and 1 hour to build opencv with contrib with CUDA (May be less now with only one architecture)

LBerger gravatar imageLBerger ( 2015-10-15 09:00:13 -0600 )edit

Question Tools

1 follower


Asked: 2015-10-14 12:20:46 -0600

Seen: 8,903 times

Last updated: Oct 14 '15