View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014145CMake(No Category)public2013-05-15 21:502016-06-10 14:31
ReporterHo Cheung 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformVS2012OSWindowsOS VersionWindows 7
Product VersionCMake 2.8.10.2 
Target VersionFixed in Version 
Summary0014145: CMake generated solutions don't build projects in parallel with VS "Batch Build"
DescriptionThe project-level parallelism available via the Tools -> Options -> Projects and Solutions -> Build And Run appears to be non-functional. The output window will show the solution being build sequentially one project at a time despite no dependencies between many projects. Task manager shows many MSBuild.exe processes but only 1 cl.exe going.

This is especially annoying when building projects with hundreds of target like ITK with tests on. It will literally take 3 hours on a very fast 12-thread machine whereas the same compile under gcc will be done in under 15 minutes.
Steps To ReproduceRun CMake on ITK source with default settings.

Click on Build -> Batch Build -> Select ALL_BUILD for any configuration you want (or all of them, it makes no difference) -> Build.

Observe that only 1 project is being build at a time.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0033062)
Brad King (manager)
2013-05-16 12:00

Add the /MP option to your CMAKE_C_FLAGS and CMAKE_CXX_FLAGS:

 http://msdn.microsoft.com/en-us/library/vstudio/bb385193.aspx [^]
(0033063)
Ho Cheung (reporter)
2013-05-16 12:03
edited on: 2013-05-16 12:05

That only enables object-level parallelism. (ie. Multiple cxx files in each project can be compiled in parallel). The targets themselves still will not build in parallel.

http://www.kitware.com/blog/home/post/434 [^]
http://msdn.microsoft.com/en-us/library/vstudio/bb651793.aspx [^]

Edit: The ITK project itself has hundreds of these single-file targets (most of them being tests), thus the /MP option only minimally improves the situation.

(0033064)
Ho Cheung (reporter)
2013-05-16 12:19

Here is an example of the expected output (note the first 2 lines, and how the subsequent lines have interleaving IDs).

http://msdn.microsoft.com/en-us/library/9h3z1a69(v=vs.90).aspx [^]

Last time I checked, this worked correctly in VS9 with CMake, but has since stopped working in VS11.
(0033066)
Brad King (manager)
2013-05-16 12:52

I regularly build CMake-generated projects in VS 10 and 11 and it always builds several targets in parallel.
(0033067)
Brad King (manager)
2013-05-16 12:53

Are you using the professional or express edition of VS? What is the value of CMAKE_MAKE_PROGRAM in CMakeCache.txt?
(0033069)
Ho Cheung (reporter)
2013-05-16 13:01

From Help->About

Microsoft Visual Studio Ultimate 2012
Version 11.0.51106.01 Update 1

Behavior is the same both on my laptop and desktop, as well as several clean virtual machines I run.

CMAKE_MAKE_PROGRAM is C:/PROGRA~2/MICROS~3.0/Common7/IDE/devenv.com

If you look at your output window, do you see the interleaved build output?
(0033072)
Brad King (manager)
2013-05-16 13:53

Using version:

 Microsoft Visual Studio Professional 2012
 Version 11.0.60315.01 Update 2

I just configured ITK with the "Visual Studio 11 Win64" generator, loaded it in the IDE, right-clicked on "ALL_BUILD", and chose "Build". The output window has:

2>------ Build started: Project: itkvcl, Configuration: Debug x64 ------
3>------ Build started: Project: itkv3p_netlib, Configuration: Debug x64 ------
4>------ Build started: Project: itkv3p_lsqr, Configuration: Debug x64 ------
5>------ Build started: Project: itkdouble-conversion, Configuration: Debug x64 ------
6>------ Build started: Project: itksys, Configuration: Debug x64 ------
2>Build started 5/16/2013 1:50:09 PM.
7>------ Build started: Project: gdcmCommon, Configuration: Debug x64 ------
8>------ Build started: Project: itkzlib, Configuration: Debug x64 ------
9>------ Build started: Project: ITKEXPAT, Configuration: Debug x64 ------
3>Build started 5/16/2013 1:50:09 PM.
4>Build started 5/16/2013 1:50:09 PM.
6>Build started 5/16/2013 1:50:09 PM.
9>Build started 5/16/2013 1:50:09 PM.

and lots of interleaved compilation output.
(0033073)
Brad King (manager)
2013-05-16 13:55

Re 0014145:0033072: I used CMake 2.8.11, not 2.8.10.2, but nothing has changed AFAIK.

Also, the IDE configuration

 Tools -> Options -> Projects and Solutions -> Build And Run

is set to "8".
(0033075)
Ho Cheung (reporter)
2013-05-16 14:07

It appears that it is because I'm using the Batch Build feature.

I like to use it to so I can build Debug and Release and then go get a coffee. When you do that, the individual targets do not build in parallel even within the same configuration.
(0033076)
Brad King (manager)
2013-05-16 14:27

Please propose a specific change to the content of the .sln or .vcxproj files that allows what you want to work. With that we can teach the generator to produce such content.
(0033079)
Ho Cheung (reporter)
2013-05-16 15:07

I'm afraid I'm not sure how the .sln/.vcxproj files work to propose a solution. I was merely reporting what I observed as a unexpected behavior.

It might be that this is actually a bug in Visual Studio's Batch Build feature actually, because when I right-click on ALL_BUILD and select Build, it works as expected.
(0042280)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2013-05-15 21:50 Ho Cheung New Issue
2013-05-16 12:00 Brad King Note Added: 0033062
2013-05-16 12:03 Ho Cheung Note Added: 0033063
2013-05-16 12:04 Ho Cheung Note Edited: 0033063
2013-05-16 12:05 Ho Cheung Note Edited: 0033063
2013-05-16 12:19 Ho Cheung Note Added: 0033064
2013-05-16 12:52 Brad King Note Added: 0033066
2013-05-16 12:53 Brad King Note Added: 0033067
2013-05-16 13:01 Ho Cheung Note Added: 0033069
2013-05-16 13:53 Brad King Note Added: 0033072
2013-05-16 13:55 Brad King Note Added: 0033073
2013-05-16 14:07 Ho Cheung Note Added: 0033075
2013-05-16 14:27 Brad King Note Added: 0033076
2013-05-16 14:27 Brad King Status new => backlog
2013-05-16 14:27 Brad King Summary CMake generated solutions don't build projects in parallel. => CMake generated solutions don't build projects in parallel with VS "Batch Build"
2013-05-16 15:07 Ho Cheung Note Added: 0033079
2016-06-10 14:28 Kitware Robot Note Added: 0042280
2016-06-10 14:28 Kitware Robot Status backlog => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team