Visual Studio 2010, maximum C ++ parallel compilation for Hyper-Threading processors

I am trying to optimize the compilation time of a large VC ++ project. My processor is a Core i7 950 (4 cores, 8 threads since it supports Intel Hyper-Threading Technology).

In Microsoft Visual Studio 2010, if you go to Tools> Options> Projects and Solutions> VC ++ Project Settings> Maximum C ++ Parallel Compilations

you can choose the maximum number of CPU cores for parallel compilation of C ++. I select 0 there (so that all my kernels are used), which gives exactly the same results as when using 4 or 8.

Now, if I open the task manager while compiling the project, I will see that 4 parallel compilation threads are running (in the section “Processes that have a description: Microsoft C / C ++ Compiler Driver”), and that the total CPU usage is a bit less 50% all the time.

So my question is:

Is it possible to have 8 parallel compilation threads in a quad core processor with a hyperthread? If this is not possible, is it possible to somehow use about 100% of the processor power during compilation?

It will save me a tremendous amount of time.

Thank you very much,

Nicholas

+4
source share
3 answers

It will save me a tremendous amount of time.

No, it will not. Hyper-threading is useful when you have different startup tasks that use additional resources inside the CPU. For example, one thread uses a lot of floating point, and the other does not. While the former does floating point math, the rest of the processor is available for another thread.

For obvious reasons, a bunch of compiled threads require the same internal CPU resources. All that you achieve is twice as many threads fighting over cache memory and processor resources. More cache conflicts will make life slower rather than faster.


Well, the above explains why you won’t get BIG gains from Hyperthreading and consistent code. The usual wisdom for parallel make is to set the number of jobs to one more than the number of cores, and it is assumed that 1 / N processes are likely to do disk I / O. Of course, for Unix to do, where work does a lot of makefile processing in addition to the actual compilation.

If you turned the knob to 8 and did not see any changes (note, this may be a negative change in bandwidth for the reasons described above) in the task manager reported CPU consumption, this is probably due to the fact that some tasks are interdependent in your solution compilations are performed sequentially. If one task depends on the output of another (pre-compiled headers often lead to this), then this limits the number of simultaneous tasks - even if you have a 16-core system, you still will not get more parallelism than the structure of the resolution project.

+5
source

Maybe you are limited only by the disk, not the limited CPU.

0
source

I think this is a problem with visual studio. Try running make files using the "jom" parallel clone of nmake. You should see a 35% increase when using it via msvc, called for compilation with 4 cores.

0
source

All Articles