在Visual Studio解决方案构建期间,如何限制并行cl.exe进程的数量? [英] How to limit the number of parallel cl.exe processes during the Visual Studio solution build?
问题描述
我最近注意到,一旦我开始构建要使用的Visual Studio解决方案(〜200个C ++项目),就会得到大量的cl.exe进程.
I've recently noticed that once I start building the Visual Studio solution I'm working with (~200 C++ projects), I get a very large number of cl.exe processes.
我对几个cl.exe并行运行的事实并不感到惊讶,因为我的项目是使用/MP
选项设置的.
I'm not surprised by the fact of several cl.exe running in parallel, because my projects are set up with /MP
option.
但是我希望它们的数量会受到Visual Studio选项"中以下设置的限制.
But I would expect that their number would be limited by the following setting in the Visual Studio "Options".
我认为在4核PC上并行运行数十个进程并不是构建解决方案的最有效方法.
I presume that running tens of processes in parallel on the 4-core PC is not the most efficient way to build the solution.
所以,基本上我有两个问题:
So, basically I've got two questions:
- 为什么我会观察到这种行为?
- 是否可以限制
cl.exe
个实例的数量?
- Why do I observe such behavior?
- Is it possible to limit the number of
cl.exe
instances?
PS .我通常使用Visual Studio 2013 Update 4编译我的解决方案,但是在Visual Studio 2017中可以观察到相同的行为.
P.S. I normally compile my solution with Visual Studio 2013 Update 4, but the same behavior can be observed with Visual Studio 2017.
推荐答案
I think you need to read this where the conclusion is that you need to set up your compilation to fit VS idea of the world.
还将并行项目的数量限制为2-3,具体取决于您在其上运行的实际PC.如果您的PC是拥有16个以上内核的怪物,那么您也许可以提高1-2.
Also limit the number of parallel projects to 2-3 depending on the actual PC you run it on. If your PC is a monster with 16+ cores you might be able to go 1-2 up.
理想情况下,VS应该提供使用X线程的选项,但是a.
Ideally VS should have offered an option of using X threads but alas.
这篇关于在Visual Studio解决方案构建期间,如何限制并行cl.exe进程的数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!