-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
4 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ceef2d0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're using MSBuild or Ninja generators, they both default to using maximum parallelism (to a fault in the case of MSBuild, which will build as many
.vcxproj
es in parallel as you have cores, which will then each spawn as manycl.exe
processes as you have cores, so if you're building a project with lots of subprojects with lots of files on a machine with lots of cores, you can end up with a ludicrous number of parallel jobs and overwhelm your machine). Anyway, my point is that if you're using a sensible CMake generator, this change won't be beneficial anywhere, but will be harmful on machines with more or fewer than sixteen hardware threads.ceef2d0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure where your information comes from but unless I'm missing something, that's not true at all for VS generator:
--parallel
, CMake will build each project sequentially, with--parallel
, CMake will will build them in parallel. Typically in the case of Bethesda games where you have dependency like gamebryo > game or gamebryo > creation > game, games are built one after the other without--parallel
but in paralle with--parallel
./MP
is not enabled by default for CMake (not sure if that was assumed by your comment or not).On my machine, without
--parallel
or/MP
, it takes 3m30s to buildgame_bethesda
, adding--parallel 16
drops that to 52s and combining with/MP
this drops to 26s (/MP
without--parallel
is about equivalent to--parallel
without/MP
).If you want to reproduce (in case I'm missing) something:
dev/vcpkg
cmake --preset vs2022-windows-standalone
with Qt in your prefix path.cmake --build vsbuild --config RelWithDebInfo
with or without--parallel
. You cannot disable/MP
as easily because it's part of MO2 common CMake configuration.ceef2d0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought CMake Common set
/MP
for everything, so I was indeed taking it for granted that we'd have parallelism for multiple C++ files within the same project by default.If you ask MSBuild or Visual Studio to build a whole solution file or a specific project within a solution file, it does build any other projects doing so would require in parallel by default (unless obviously they depend on each other so one has to finish before the next can start). I was under the impression that,
cmake --build . --config RelWithDebInfo
behaved the same way, and I thought this was something I'd tested at some point. I could just have been wrong, but I guess it's also possible that either CMake or Microsoft changed the default behaviour due to the core-count-squared number ofcl.exe
processes issue I mentioned.Depending on project structure and machine specifics, it might be better to instead enable
UseMultiToolTask
andEnforceProcessCountAcrossBuilds
, which would make MSBuild behave more like Ninja, i.e. defaulting to building multiple projects in parallel if there weren't enough files to keep the CPU busy within one project, and avoiding creating more jobs than cores. In my experience, if you've got one project with lots of files, it's slower than/MP
on its own as there's a little more overhead, but if you've got multiple projects with lots of files, it's way faster than the combination of/MP
and letting MSBuild build multiple projects in parallel. However, any type of project structure is faster with Ninja.Anyhow, this has turned out more complicated than I'd expected. As it sounds like we're indeed using
/MP
, it's not the end of the world if the number of projects we're building in parallel is less than the number of cores, as those projects still have multiple files. It's just the thing where if we switch to Ninja later we'll want to get rid of this or make it pick the actual core count that's bugging me really.ceef2d0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's still the case.
I will check
UseMultiToolTask
andEnforceProcessCountAcrossBuilds
but I do not think the--parallel
flag will have such a negative impact. There are very few repositories with multiple projects, the two "biggest" ones would begame_bethesda
andplugin_python
. Maybe I could see about settingCMAKE_BUILD_PARALLEL_LEVEL
in these two projects instead of global--parallel
inmob
.