4

I have a large c++ project that I am compiling with MS VS 2012 from within the IDE.

I have enabled Multi-processor compilation (/MP) and the build begins in parallel (I know this because 8 cl.exe instances are visible in Task Manager). However, after a dozen or so files are completed the build seems to be serial again, with only one instance of cl.exe remaining.

I have checked for incompatible options (as indicated here) and everything seems correct. I have also built using jom from command line and the build is much faster and uses all cores have a much greater portion of the build time.

Questions:
Is there a limitation when building in parallel within VS?
Or is there some new setting I may be missing?

Any suggestions are welcomed.

EDIT:

Here are some screenshots showing what's going on. When a build first starts, I get lots of compiling happening (see the many instances of c1.exe in Task Man), but after just a minute or so I am down to one or two instances. This doesn't seem to be a compiler limitation or project issue, because building with jom is about 4-5 times faster (using the VS compiler still) than building from within the VS IDE.

VS 2012 Immediately after starting a build
VS 2012 Immediately after starting a build VS 2012 One minute after build started
VS 2012 One minute after build started

Community
  • 1
  • 1
Kevin E.
  • 41
  • 4
  • Have you tried disabling link-time code generation and whole program optimization? I've found that those are the biggest inhibitors of parallel builds. – Mysticial Oct 21 '15 at 17:23
  • I took a look and whole program optimization is already off. I am having trouble locating anything for "link-time code generation". Is this a project property or a global VS setting (a menu path might be helpful if you know it). Thanks. – Kevin E. Oct 21 '15 at 18:59
  • I don't have VS in front of me to get the exact option. But the idea is that the linker isn't well parallelized (if at all). So you need to move as much of the work as possible out of the linker and into the compilation phase. That means disabling most of the link-time optimizations. Of course this may affect the performance of the binary, but usually acceptable for dev purposes. – Mysticial Oct 21 '15 at 19:03
  • Well in any case linking doesn't appear to be the bottleneck (less than one is spent linking). – Kevin E. Oct 23 '15 at 13:42
  • Sounds like you might have 2 modules that are very big? – Mysticial Oct 23 '15 at 14:04
  • There are lots of large modules, but these are not the last two. It appears that only about 10-20 files out of about 150 total files have been compiled by the time it drops back down to using only one thread. – Kevin E. Oct 23 '15 at 18:56

0 Answers0