I'm running Visual Studio 2008 with the stuff-of-nightmares awful MS test framework. Trouble is that it's sending my CPU to 100% (well 25% on a quad-core).
My question is why can't Visual Studio run on more than one core? Surely M$ must have a sufficient handle on threading to get this to work.
For Visual Studio 2010 Go to Tools > Options > Projects & Solutions > Build and Run.
You will then see an entry to enter a number for the 'maximum number of parallel project builds'; my PC has an i7-3770 CPU, a Quad Core with HyperThreading, so it is set to 8.
For information on different versions of Visual Studio go here and select your version: https://msdn.microsoft.com/en-us/library/cyhcc7zc(v=vs.100).aspx
e.g. for Visual Studio 2010 this property only affects C++ builds:
But for Visual Studio it's for C++ and C#:
You can ask VS to compile multiple projects in parallel as well as compiling parallelly (!?) within a project.
Tools > Options > Projects and Solutions > maximum number of parallel projects build.
This will build C++ and C# in parallel as well!
I'm sure it's very hard. Huge existing GUI-heavy non-threaded code base to multi-threaded. Sounds like a 10 to me.
But it seems to use multi-cores to me. The Intellesense seems threaded. The build system has multi-project building and for C++ multi-file building as well.
You problems with these tools sounds a bit deeper then how well they use you CPUs.
We also added multiple core support for doing multi-threaded builds on the command line for those of you with a lot of projects and long build times. Enabling multiple core support requires only a few new properties, and MSBuild manages all of the work to schedule projects efficiently and effectively. The MSBuild team has tested this ability to scale by building some projects on a 64-CPU machine.
that is from somasegar blog
So they sort of started doing it, well at least for the build.
Now that Visual Studio 2010 has been released for a bit, consider upgrading to make use of the
parallelTestCount
attribute in MSTest's.testsettings
file, as described at How to: Run Unit Tests Faster Using a Computer with Multiple CPUs or Cores.There are a few limitations, such as:
Example, using 0 to mean auto-detect (the default is 1):
A few blogs have noted that you might have to close and re-open your project for Visual Studio to notice you added/changed that attribute. Also, if you edit the test settings file using the GUI, you'll probably have to re-add the
parallelTestCount
attribute.I have VS2008 running on all 4 CPUs. Just set this environment variable / project flag.
/MP
(It can be set in C/C++ Settings, Advanced. In project settings)
Edit: The MP flag can also accept a number, e.g. /MP2 which means it will only run on 2 cores. Leaving it as just /MP means it will run on the maximum amount of cores.
Edit2: The MP flag is probably for the compiler only.