Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm also noticing this (e.g. several hours to build with CUDA)

I understand that it's building many versions of each kernel for different template types and different compute targets.

However what is confusing is that this part of the build is not multi-threaded (unlike the rest of the build which is multi-threaded). I presume either this is intentional because NVCC doesn't like being run in parallel (it seems to actually do something with the GPU device whilst building), or because the CMake system doesn't generate the correct project settings to perform the NVCC instructions in parallel (e.g. this is built using some sort of long batch script which just executes instructions one after another).

Testing here with VS2019, cmake, OpenCV 4.4.0

I'm also noticing this (e.g. several hours to build with CUDA)

I understand that it's building many versions of each kernel for different template types and different compute targets.

However what is confusing is that this part of the build is not multi-threaded (unlike the rest of the build which is multi-threaded). I presume either this is intentional because NVCC doesn't like being run in parallel (it seems to actually do something with the GPU device whilst building), or because the CMake system doesn't generate the correct project settings to perform the NVCC instructions in parallel (e.g. this is built using some sort of long batch script which just executes instructions one after another).

Testing here with VS2019, cmake, OpenCV 4.4.0

Edit: And it seems I was somewhat correct. The cuda files are all built using <CustomBuild> tags in the opencv world project, which Visual Studio does not perform in parallel (since often this feature is used for actions that need to be run in the correct sequence). If you're not building as opencv world, then you might be able to perform some parallel compilation here and same some time (since projects can be compiled in parallel to one another and I presume the build events don't lock out build events from other projects being compiled).