How do I turn on multi-CPU/Core C++ compiles in the Visual Studio IDE (2008)?

26,449

Solution 1

To enable /MP option you could add it to Project Settings->C/C++->Command Line|Additional options. This is the only way to switch it on in vcproj.

Solution 2

Tools > Options > Projects and Solutions > Build and Run > maximum number of parallel project builds

Share:
26,449
dwj
Author by

dwj

Updated on July 09, 2022

Comments

  • dwj
    dwj almost 2 years

    I have a Visual Studio 2008 C++ project that has support for using multiple CPUs/cores when compiling. In the VCPROJ file I see this:

    <Tool
        Name="VCCLCompilerTool"
        AdditionalOptions="/MP"
        ...
    

    I can't find where that was turned added via the IDE and I want to set up another project that uses all of my cores during compilation.

    I found tons of references to the MSDN /MP page but that is for using the command line; I have yet to find any references to setting that with the IDE. How do I do that?

    EDIT: To clarify, the two projects are completely separate and are not in the same VCPROJ file. I wanted to turn on support for multiple cores during the C++ compilation phase.

  • dwj
    dwj over 14 years
    Both my projects have "maximum number of parallel project builds" set to 2 (which is correct) but the original project shows the /MP switch and my new project doesn't. When I compile both projects, the original is definitely using multiple cores while the new one is not.
  • Kirill V. Lyadvinsky
    Kirill V. Lyadvinsky over 14 years
    You will not switch on /MP build via that settings. This option will enable parallel builds of several projects in one solution, not several files in one project. This option suitable only for big solutions.
  • dwj
    dwj over 14 years
    This worked. As a test I jammed it into the VCPROJ directly. After seeing your post, I added it to the section you show above -- it's exactly the same thing.
  • Armentage
    Armentage almost 12 years
    The difference between this and the Build-And-Run option is that /MP allows MULTIPLE FILES from ONE project to compile in parallel, while the build-and-run option allows MULTIPLE PROJECTS to build at the same time. The two options are orthogonal.
  • metal
    metal over 11 years
    You may also need to disable the /Gm option, which enables minimal rebuild, under Code Generation.
  • Camille Goudeseune
    Camille Goudeseune about 10 years
    To get all the CPU meters in Task Manager dancing at once, you might need to hardcode the number. For example, on a 6-core i5, /MP12 instead of just /MP. This depends on hyperthreading settings, etc.
  • James Bedford
    James Bedford over 9 years
    @metal, so I have to trade off multi-core compilation of the entire project with single-core compilation of the minimum rebuild..? I'm either wasting cores or I'm doing an incredibly inefficient build.. :/