How to do parallel assembly in Visual Studio 2010?

How can I get VS 2010 to run more than one compilation process in C ++ at a time? I mean modules of building objects in parallel; I am not interested in creating several projects at a time (I know about tools> Options> Build and Run <Maximum number of parallel projects, but this does not do what I want).

Basically, I'm looking for the equivalent of Visual Studio "make -jN".

+51
visual-c ++ visual-studio visual-studio-2010 parallel-builds
May 30 '11 at 4:11
source share
6 answers
  • Tools → Options
  • Projects and solutions \ VC ++ project settings
  • Maximum C ++ Parallel Compilations

In addition, as Ross Smith said in the comments, you also need to enable the "Multiprocessor Compilation" option in the project:

  • Project properties
  • Configuration Properties> C / C ++> General
  • Multiprocessing compilation
  • Profit!
+30
May 30 '11 at 4:13 a.m.
source share

Necrolis comment seems like the right solution.

/ MP (multi-process build)

The / MP switch causes the compiler to create one or more copies on its own, each in a separate process. These copies compile the source files at the same time. Consequently, the total time to create the source files can be significantly reduced.

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

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

+14
Apr 6 '12 at 7:22
source share

There are two switches that must be set to create a VS assembly using multithreading (both are for a specific project):

  • project properties → C / C ++ → General → Multiprocessor compilation installed in: Yes (/ MP)
  • project properties-> C / C ++ → Code Generation → Enable Minimum Rebuild Set to: None (/ Gm -)

Also check your tools-> Options-> Projects and Solutions-> VC ++ Project Settings → Maximum Parallel C ++ Compilation Settings . The default value is 0, which allows VS to use as many concurret compilations as possible.

+14
Dec 08
source share

jom is the tool you are looking for.

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

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

While most of the documentation is aimed at Qt developers who are trying to speed up the creation of the Qt library on windows, jom should work fine in projects without Qt if you have a nmake compatible makefile.

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

+3
Apr 6 2018-12-12T00:
source share

Here is what i did

1) Go to Tools-> Options, than in the "Project and Solutions" → "Build and Run" section for me was the number of cores. Although at first I thought that was all I needed, but it wasn’t

2) Right-click on your project and select properties. In the section "Configuration Properties" → "C / C ++" → "Command Prompt", enter /MP4 , where 4 is the number of kernels that you have. You will receive a warning that the flags are not compatible, so we have one more step

3) Go to "Configuration Properties" → "C / C ++" → "Code Generation" is "Enable Minimal Restructuring". Change it to.

Restore, and you should see several CL processes in your task manager.

+3
Apr 11 '12 at 7:40
source share

I see! Your requirement is to create a single project in parallel threads.

I find the Shark compiler plugin very useful

0
Mar 21 '14 at 18:29
source share



All Articles