Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Multi-processor compilation + precompiled header

Poeter__Manuel
Beginner
701 Views

Hi,

is it possible to combine multi-processor compilation with precompiled headers? I am using Visual Studio 2013 with Intel Composer XE 2013 SP1. I have set up my project to use multi-processor compilation (/MP) and I have a pch.h + pch.cpp for the precompiled header. For the project I have selected "use" precompiled header (/Yu) while for pch.cpp this is set to "create" (/Yc). I use "force include" to automatically include the pch.h in every cpp file. This configuration works fine with the Microsoft Compiler. The Intel compiler also compiles everything just fine, but totally ignores the /MP switch -> compiling one file after the other with just a single icl process runnning.
When I completely deactivate the precompiled header (for both, the project and the pch.cpp file) the multi-processor compilation works as expected (on my machine resulting in 8 icl processes running concurrently).

Is there a reason why this does not work with precompiled headers? Am I doing something wrong?

Regards,
Manuel

0 Kudos
7 Replies
Anoop_M_Intel
Employee
701 Views

Hi Manuel

When doing multiple process compilation, look for multiple instances of mcpcom.exe. Could you please confirm if you can see that while using /MP compiler option with precompiled headers.

Thanks and Regards
Anoop 

0 Kudos
Judith_W_Intel
Employee
701 Views

 

I don't know what the Microsoft compiler is doing, but with the Intel compiler you can't create and use the same pch simultaneously. You need to create it first and then use it after it is created. I would try separating the compilation of pch.cpp from the other files and do it separately first.

Judy

0 Kudos
Poeter__Manuel
Beginner
701 Views

There is also just a single mcpcom process running. (The way I understand it there is a 1-to-1 relationship between mcpcom and icl - right?)

Of course the compiler can't create and use the pch simultaneously.Both (the Microsoft and the Intel Compiler) recognize that a pch is used and therefore first create the pch by compiling pch.cpp and after that all the other cpp files.

In the case of the Microsoft Compiler multi-processor compilation kicks in after the pch is successfully created (the remaining files are compiled in parallel), the Intel Compiler continues compiling one file after the after.

Regards,
Manuel

0 Kudos
Om_S_Intel
Employee
701 Views
Could you please help us with a testcase to investigate the issue? Thanks, Om
0 Kudos
Poeter__Manuel
Beginner
701 Views

Hi,

sure, I will create a small sample project as soon as I can.

Regards,
Manuel

0 Kudos
jimdempseyatthecove
Honored Contributor III
701 Views

VS uses Solution containing Project(s)

Add a Project that builds the precompiled header and then set the Project Build order to compile that project first (making the original project dependent on the new pch project could do this for you too).

Note, these two projects may have to have (use) the same output directories as well as same source directory.

I forgot to add that if Rebuild All has issue with which project builds the pch, then after Clean, Right-Click on pch build project, Project Only | Build. Then Build.

Jim Dempsey

0 Kudos
Poeter__Manuel
Beginner
701 Views

@Jim: besides any other issues that this setup could cause it doesn't work either - because as soon as the project uses a PCH the parallel compilation does not work.

I have tried to create a simple test project but unfortunately I am not able to reproduce this behavior with this sample project. I used the same settings as in the project where we have this issue. I have even checked the temp file that is passed to mcpcom.exe and aside from path and file names the files are identical. I have no idea why everything works fine with the one project but not with the other...

Any ideas what else I could try/check? Some compiler output maybe? Compiling from command line?

Regards,
Manuel

0 Kudos
Reply