Click to Rate and Give Feedback
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual C++ Concepts: Building a C/C++ Program
Multiprocessor Builds

Multiprocessor builds enable you to build multiple projects concurrently on computers that have more than one CPU. For example, if your computer has two CPUs, then this feature allows you to build up to two projects at the same time.

To optimize the build process, Visual Studio automatically sets the maximum number of concurrent builds equal to the number of CPUs on your computer. You can modify this setting by changing the value of the Maximum number of parallel project builds property in the Build and Run property page of the Options dialog box. For more information, see How to: Set the Number of Concurrent Builds for Multiprocessor Builds.

You can run multiprocessor builds from the IDE or command line. To build from the command line, use either VCBUILD or DEVENV. For tasks that demonstrate these concepts, see:

When you run multiprocessor builds, the project system assigns a number to each project configuration included in the build, which is followed by a right angle-bracket. This prompt precedes each status message for every build step.

The following example build output is the result of a multiprocessor build:

1>------ Build started: Project: ConsoleApp2, Configuration: Debug Win32 ------
2>------ Build started: Project: ConsoleApp1, Configuration: Debug Win32 ------
1>Compiling...
2>Compiling...
1>stdafx.cpp
2>stdafx.cpp
2>Compiling...
1>Compiling...
2>AssemblyInfo.cpp
1>AssemblyInfo.cpp
1>ConsoleApp2.cpp
2>ConsoleApp1.cpp
2>Generating Code...
1>Generating Code...
1>Compiling resources...
2>Compiling resources...
2>Linking...
1>Linking...
2>Build log was saved at "file://d:\Documents and Settings\username\My Documents\Visual Studio\Projects\Demo\ConsoleApp1\Debug\BuildLog.htm"
2>ConsoleApp1 - 0 error(s), 0 warning(s)
2>
1>Build log was saved at "file://d:\Documents and Settings\username\My Documents\Visual Studio\Projects\Demo\ConsoleApp2\Debug\BuildLog.htm"
1>ConsoleApp2 - 0 error(s), 0 warning(s)
1>
---------------------- Done ----------------------

    Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped

The multiprocessor build output illustrates that build steps for multiple projects can spawn concurrently. This behavior is in contrast to non-multiprocessor builds, which do not start build processes for other projects until the build process for the current project has been completed.

The following example build output is the result of a non-multiprocessor build:

------ Build started: Project: ConsoleApp1, Configuration: Debug Win32 ------
Compiling...
stdafx.cpp
Compiling...
AssemblyInfo.cpp
ConsoleApp1.cpp
Generating Code...
Compiling resources...
Linking...
Build log was saved at "file://d:\Documents and Settings\username\My Documents\Visual Studio\Projects\Demo\ConsoleApp1\Debug\BuildLog.htm"
ConsoleApp1 - 0 error(s), 0 warning(s)

------ Build started: Project: ConsoleApp2, Configuration: Debug Win32 ------
Compiling...
stdafx.cpp
Compiling...
AssemblyInfo.cpp
ConsoleApp2.cpp
Generating Code...
Compiling resources...
Linking...
Build log was saved at "file://d:\Documents and Settings\username\My Documents\Visual Studio\Projects\Demo\ConsoleApp2\Debug\BuildLog.htm"
ConsoleApp2 - 0 error(s), 0 warning(s)

---------------------- Done ----------------------

    Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content      
An alternative to the "Multiprocessor Build" feature's obvious shortcoming      Fish Fish ... Thomas Lee   |   Edit   |  

The "Maximum number of parallel project builds" property only allows you to build non-dependent projects in parallel, but it unfortunately does not allow you to "Batch Build" the various different multiple build configurations for each project in parallel. This very shortcoming is illustrated beautifully in the above example:


   1>------ Build started: Project: ConsoleApp2, Configuration: Debug Win32 ------
2>------ Build started: Project: ConsoleApp1, Configuration: Debug Win32 ------


Notice that the two builds that are running in parallel are for different projects.

If you want to be able to build all of the different build configurations for a given project in parallel however (e.g. ConsoleApp1: "Debug|Win32", "Release|Win32", "Debug|x64", "Release|x64", etc), then you need to use a batch file that uses RunJobs:


Run All Jobs at Once utility - a command-line tool to run multiple programs in parallel (i.e. concurrently) as a group
(http://www.codeproject.com/KB/MFC/runjobs.aspx)


"Fish" (David B. Trout) - fish(at)infidels.org
PGP key fingerprints:
RSA: 6B37 7110 7201 9917 9B0D 99E3 55DB 5D58 FADE 4A52
DH/DSS: 9F9B BAB0 BA7F C458 1A89 FE26 48F5 D7F4 C4EE 3E2A

Tags What's this?: mfc (x) vs2005 (x) vs2008 (x) Add a tag
Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker