Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I do a parallel build in Visual Studio 2010?

People also ask

Can Visual Studio use multiple cores?

Specifies the maximum number of Visual C++ projects that can build at the same time. To optimize the build process, the maximum number of parallel project builds is automatically set to the number of CPUs of your computer. The maximum is 32.

What is parallel build?

By using more concurrent processes, parallel builds can reduce the overall build time significantly. Instead of one process running one build script at a time, you can have multiple processors working in parallel. For large software systems, this performance improvement can make a critical difference.


  1. Tools -> Options
  2. Projects and Solutions\VC++ Project Settings
  3. Maximum concurrent C++ compilations

Also, as Ross Smith said in the comments, you also need to turn on the "Multiprocessor compilation" option on the project:

  1. Project properties
  2. Configuration Properties > C/C++ > General
  3. Multi-Processor Compilation
  4. Profit!

There are two switches that must be set in order to make VS build using multithreading (both are project-specific):

  • project properties->C/C++->General->Multi-processor Compilation set to: Yes (/MP)
  • project properties->C/C++->Code Generation->Enable Minimal Rebuild set to: No (/Gm-)

Check also Your Tools->Options->Projects and Solutions->VC++ Project Settings->Maximum concurrent C++ compilations setting. Default value is 0 which enables VS to use as many concurret compilations as possible.


Necrolis' comment seems the correct solution.

/MP (Build with Multiple Processes)

The /MP option causes the compiler to create one or more copies of itself, each in a separate process. These copies simultaneously compile the source files. Consequently, the total time to build the source files can be significantly reduced.

Note that you can set it at project level (and thus it will apply to all files in it) as well as to the individual files, useful for instance if you need to use #import.

In particular, /MP is usually not compatible with precompiled headers, or sources using #import; in this case, you can still set /MP flag on the project, and then clear it on the single files (usually, stdafx.cpp, and any file using #import).


jom is the tool you are looking for.

From the wiki at: http://qt-project.org/wiki/jom

jom is a clone of nmake to support the execution of multiple independent commands in parallel. It basically adds the -j command line switch similar to GNU make.

While most of the documentation is aimed at Qt developers trying to speed up Qt library builds on windows, jom should work perfectly well in non Qt projects too, as long as you have an nmake compatible makefile.

The wiki page has binaries you can download, and you call jom as you would nmake.