Are there any disadvantages to "multi-processor compilation" in Visual Studio?

14,956

Solution 1

The documentation for /MP says:

Incompatible Options and Language Features
The /MP option is incompatible with some compiler options and language features. If you use an incompatible compiler option with the /MP option, the compiler issues warning D9030 and ignores the /MP option. If you use an incompatible language feature, the compiler issues error C2813then ends or continues depending on the current compiler warning level option.
Note:
Most options are incompatible because if they were permitted, the concurrently executing compilers would write their output at the same time to the console or to a particular file. As a result, the output would intermix and be garbled. In some cases, the combination of options would make the performance worse.

And it gives a table that lists compiler options and language features that are incompatible with /MP:

  • #import preprocessor directive (Converts the types in a type library into C++ classes, and then writes those classes to a header file)
  • /E, /EP (Copies preprocessor output to the standard output (stdout))
  • /Gm (Enables an incremental rebuild)
  • /showIncludes (Writes a list of include files to the standard error (stderr))
  • /Yc (Writes a precompiled header file)

Instead of disabling those other options by default (and enabling /MP by default), Visual Studio makes you manually disable/prevent these features and enable /MP.

Solution 2

From our experience the main issues found were:

  1. browse information failing to build due to multiple projects calling bscmake at the same time (useless information nowadays so should be removed as a project setting)
  2. linker failures due to dependency issues and build order issues, something you would not normally see when building normally
  3. Batch builds do not take advantage of multi-processor compilation, at least this was certainly true for 2005-2008 VS editions
  4. warnings generated about pre-compiled headers being incompatible, this occurs when you build stdafx and can be ignored but when doing a rebuild it generates this message

However, the above are configuration issues which you can resolve, otherwise it should be enabled as it will speed up builds.

Solution 3

Because multi-processor compilation isn't compatible with many other compilation options and also has higher usage of system resources. It should be up to the developer to decide whether or not it's worth for him. You can find the full documentation here: http://msdn.microsoft.com/en-us/library/bb385193.aspx

Share:
14,956
JBentley
Author by

JBentley

Updated on June 15, 2022

Comments

  • JBentley
    JBentley almost 2 years

    Are there any disadvantages, side effects, or other issues I should be aware of when using the "Multi-processor Compilation" option in Visual Studio for C++ projects? Or, to phrase the question another way, why is this option off by default in Visual Studio?