C++ How to limit visual studios multi-processor compilation

Every time I compile using visual studio the rest of my computer crawls because visual studio is hogging all the processors. Is there a way to limit the number of processors that visual studio is using so I can still get some work done during the compilation time?

By the way, I am using visual studio 2013 and 2015 and programming in C++.

Thanks!


For Visual Studio 2015, change "Maximum number of parallel project builds" to desired number. (May be half number of processers in your m/c)

Menu> Tools > Options > Projects and solutions > Build and Run. Edit value.

Screenshot from VS2015

Further, maximum concurrent c++ compilation can be restricted in

Menu> Tools > Options > Projects and solutions > VC++ Project Settings > Maximum concurrent c++ compilation > Edit value.

Please note, if used 0 then all CPU will be used.

C Programming Tutorial for Beginners, Learn C the Hard Way: Practical Exercises on the Computational Subjects You Keep Avoiding (Like C) C is a successor of B language which was introduced around the early 1970s. The language was formalized in 1988 by the American National Standard Institute (ANSI). The UNIX OS was totally written in C. Today C is the most widely used and popular System Programming Language. Most of the state-of-the-art software have been implemented using C.


Setting the "Maximum number of parallel project builds" is not the answer if you have a single C++ project with lots of .cpp files and you don't want 8 building at once. To control that, go to Tools > Options > Projects and Solutions > VC++ Project Settings, and in the Build section, set Maximum Concurrent C++ Compilations to the max number of .cpp files you want to compile in parallel. The default setting appears to be 0, which apparently means there is no maximum. I have 4 cores/8 threads, and set this value to 4, and VS now only compiles 4 files at a time instead of 8.

These instructions are based on Visual Studio 2017, but I think it's been this way for a few releases.

"C" Programming Language: Brian Kernighan, This course will give you a full introduction into all of the core concepts in the C programming Duration: 3:46:13 Posted: Aug 15, 2018 C is a procedural programming language. It was initially developed by Dennis Ritchie as a system programming language to write operating system. The main features of C language include low-level access to memory, simple set of keywords, and clean style, these features make C language suitable for system programming like operating system or compiler development.


I found a workaround that actually works for me. Manually restrict affinity for VS process. Open Task Manager, go to Details tab, right click on devenv.exe, select "Set affinity". In the dialog untick several cores. That's it. All spawned cl.exe processes will inherit affinity, and thus won't run on unticked cores.

Also, go and cast your vote for a feature request for Visual Studio: https://developercommunity.visualstudio.com/content/idea/436208/limit-cpu-usage-of-visual-studio.html

Why C is so Influential - Computerphile, "C" is one of the most widely used programming languages of all time. Prof Brian Kernighan Duration: 8:26 Posted: Aug 18, 2015 C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP-11 computer in 1972. In 1978, Brian Kernighan and Dennis Ritchie produced the first publicly available


For C++ Use

*msbuild /p:CL_MPCount=X 

Where X is the number of compiler driver. I use this to limit the CPU utilization when compiling the Tensorflow source code.

Read this for more details: ms's blog on vs2010 c++ parallel building

How easy is it to learn C?, Why is C such an influential language? We asked ardent C fan Professor Brailsford. Brian Duration: 10:50 Posted: Aug 25, 2017 Discover historical prices for C stock on Yahoo Finance. View daily, weekly or monthly format back to when Citigroup, Inc. stock was issued.


A more optimal answer comes from Mikhail Virovets at https://developercommunity.visualstudio.com/comments/497084/view.html

Decrease the compiler process priority to below normal. This means it will use as much CPU as possible but without interfering with other things you're trying to use.

Define a registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\cl.exe\PerfOptions

Then create a DWORD value named CpuPriorityClass = 5 (5 means "below normal").

Note that this affects all processes named "cl.exe".

How is C programming language still used today?, - and extremely flexible. So flexible, in fact, that as you use the language, you probably go through many different programming styles as you work out how to use the language to produce good, maintainable, reliable code. Programming Languages Development - C++ has been used extensively in developing new programming languages like C#, Java, JavaScript, Perl, UNIX’s C Shell, PHP and Python, and Verilog etc. Computation Programming - C++ is the best friends of scientists because of fast speed and computational efficiencies.


Which programs are written in C language?, is best choice when you start programming as it is most basic. Microsoft C++, C, and Assembler documentation. Learn how to use C++, C, and assembly language to develop applications, services, and tools for your platforms and devices.


Learn C, . Some of the examples are operating systems, more specifically OS kernels, device drivers and interfaces, etc. Learn C# programming - for beginning developers, developers new to C#, and experienced C# / .NET developers


C Tutorial, C programming is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone  C-SPAN.org gives you access to C-SPAN's daily coverage of Washington and more than 200,000 hours of extensively indexed and archived C-SPAN video.