Cuda parallel code generation in Visual Studio
Asked Answered
A

2

13

I have a couple of C++ projects in a Visual Studio 2012 solution. Those projects contains a large amount of files and I use /MP to speed up the code generation.

I was wondering if there's a way to speed up also NVCC in a similar way. Using /MP in the project containing the CUDA kernels gives no benefits in compilation time and I can see only one core at work.

So the question is: how can I use my multicore PC for speeding up CUDA compilation?

Anole answered 15/7, 2013 at 15:6 Comment(1)
Not only CUDA source files are compiled within one project sequentially, even worse that CUDA compilation in one project halts parallel building of other projects (even projects without CUDA files) in MSVC solution. Can at least parallel building of independent projects within one solution be solved?Band
S
4

As of CUDA 5.5, nvcc does not have an equivalent of MSVC's /MP, so any build parallelism for .cu files will need to come from the build tool which invokes NVCC.

If you can build using GNU Make (e.g. Under Cygwin or on a Linux/Unix/OS X system), you could use its parallel building functionality, using the -j option, which causes it to process multiple recipes in parallel.

Here is a nice blog post which enumerates multiple parallel build options on Windows, some of which may work with NVCC.

For a true distributed/parallel build system supporting MSVC and NVCC, you could try Incredibuild.

Skeen answered 16/7, 2013 at 13:12 Comment(2)
I'm intrest in a solution for Visual Studio. The last link list two possibility: the already mentioned /MP and the even slower /maxcpucount[:n].Anole
I added a link to Incredibuild, which is possibly the only real solution for Visual Studio currently.Skeen
T
3

You can use IncrediBuild

But this error can occur:
fatal error C1041: cannot open program database '...'; if multiple CL.EXE write to the same .PDB file, please use /FS

To avoid it, please set Project -> Properties -> CUDA C/C++ -> Host -> Additional Compiler Options -> /FS.

For more read on this blog.

Thurlough answered 25/12, 2015 at 21:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.