I am working with a c++ projects. Initially, i am using the visual studio compiler in following. The compiling and linking can be finished in 2.5 minutes.
However, when i use Intel oneAPI compiler. the compiling and linking takes very long. Compiling takes 3.5 min, linking takes 7min.
So i am kindly asking if there is a way to reduce the time
Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\CL.exe
As the project information is confidential, contact me if you need further information
visual studio version is Microsoft Visual Studio Professional 2019 Version 16.9.3, compiler version is 14.28.29910
oneAPI version is 2021.2.0.
Following is the command i am using for the build
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\CL.exe /c /I /Zi /nologo /W3 /WX- /diagnostics:column /MP /O2 /Ob2 /D _CONSOLE /D "WIN32=\"WIN32\"" /D _CRT_SECURE_NO_WARNINGS=_CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE=_CRT_SECURE_NO_DEPRECATE /D BOOST_AUTO_LINK_TAGGED=BOOST_AUTO_LINK_/Gm- /EHsc /MT /GS- /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Release\\" /Fd"Release\vc142.pdb" /Gd /TP /wd4267 /wd4334 /FC /errorReport:queue /W3 /GR /Zm200 /vmg /TP /Gy /bigobj "C:\application_source_includes.cpp"
C:\Program Files (x86)\Intel\oneAPI\compiler\2021.2.0\windows\bin\icx.exe /c /Qm64 /Zi /nologo /W3 /O2 /Ob2 /Qipo /D _CONSOLE /D "WIN32=\"WIN32\"" /D _CRT_SECURE_NO_WARNINGS=_CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE=_CRT_SECURE_NO_DEPRECATE /D BOOST_AUTO_LINK_TAGGED=BOOST_AUTO_LINK_TAGGED /D /EHsc /MT /GS- /Zc:forScope /Fo"Release\\" /TP /W3 /GR /Zm200 /vmg /TP /Gy /bigobj "C:\application_source_includes.cpp"
Try removing /Qipo from the icx options. IPO can be very slow on larger applications and may offer little or no performance benefit.
Also, I don't think /Zc:forScope is recognized or needed with icx. Some of the other icx options you are using may also not be recognized or needed.
I removed Qipo, it makes the situation even worse. Using Qibo, the compiling time is 5min 20second. Without Qibo, compiling time is 8min50second.
I also tried with latest 2021.04 release, the performance does not improve.
I would ask to share any performance data that Intel oneapi compiler vs. other compiler on compiling and linking performance.
It makes no sense that removing /Qipo would make it slower so maybe your system state/load is highly variable. You also need to remove the IPO option from the link command.
I suggest removing all the options that aren't necessary from the compile and link commands. This is work you need to do before asking for more help here. Specifically:
- /Zi includes debugging information so much larger object files and pdb generation => slower
- /Gy is deprecated and may make linking slower
- /bigobj might make compiling slower
- /Zm200 uses more RAM and is archaic
- /GR is on by default so not needed
- /GS- is on by default so not needed
- /Ob2 is implied by /O2 so not needed
- /TP is not needed with a .cpp file
- /Qm64 is the default on a 64-bit system so probably not needed
- /D /EHsc makes no sense -- you don't define anything
- Your cl compile uses /MP for parallel compiles: to get the same effect with icx I think you need to do it from the build system, e.g.
make -j 8
jom /J 8
Some of your options are MSVC specific (not documented as icx options) and may be accepted by icx but ignored. The icx documentation is not complete yet.
Even though clang-based icx is going to compile faster than the classic icc compiler it is probably still slower than cl.
I removed these flags with your suggestio. compiling time remain same, no improvement. I see every core CPU core utilzation is lower than 30%. However, with vistual studio compiler, the CPU utlization is higher than 50%.
I am calling visual studio msbuild.exe, which is calling icx compiler, so i am not able to set parallel compiling directly. As the CPU utlization is such lower, there should be no parallel compiling happening. As Intel oneAPI compiler has already support working visual studio. Why parallel compiling is not working?
“C:\Program Files (x86)\Intel\oneAPI\compiler\2021.4.0\windows\bin\icx.exe” /c /Qm64 / nologo /W3 /O2 /D _CONSOLE /D "WIN32=\"WIN32\"" /D MTL /D _CRT_SECURE_NO_WARNINGS=_CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE=_CRT_SECURE_NO_DEPRECATE /D BOOST_AUTO_LINK_TAGGED=BOOST_AUTO_LINK_TAGGED /D COFS_MODEL_TYPE_APPLICATION_MODELING=COFS_MODEL_TYPE_APPLICATION_MODELING /D COFS_SOURCE_CODEGEN_SYSTEMC=COFS_SOURCE_CODEGEN_SYSTEMC /EHsc /MT /Zc:forScope /Fo"Release\\" /
If none of the option changes make it faster then maybe something else is driving your compile speed, such as the use of a network drive for the compiler, sources, or outputs.
For parallel compiles you will need to build with something other than MSBuild, such as one of the tools I mentioned or ninja.
Yes, that make sense to order to improve the performance. But i have to give up using MSbuild, that is default tools of my projects.
As Intel oneAPI tookit has made the support to visual studio with a plug in. I would expect using oneAPI compiler would be same simple as using the visual studio embeded compiler and have the same performance.
I expect the owner of doing the Integration of oneAPI into visual studio can really look into the compiling performance issue. Currently, i am not able to use oneAPI compiler as development vehicle because this.
Using Intel C++ is not as fast or simple as using MSVC so unless your Intel C++ build is showing significantly better performance or you need some special capability such as recent OpenMP version support you are better off sticking with MSVC. But if you really need Intel C++ you have to adapt to it. That means:
- Making sure your VS version is compatible and not updating it beyond the supported versions (and the compatibility document is not updated enough).
- Using a build tool that supports parallel compilation.
- Learning a new set of compiler options (for 2 compilers if you want to use icl and icx for now).
- For icx, experimenting with the options (which aren't well documented yet).
- Accepting slower compiles: we use MSVC or Clang for most day-to-day development and Intel C++ for performance testing/tuning.
- Dealing with more compiler bugs.
- Now you also have checking that the icx performance is acceptable: for us the icx release builds are currently ~25% slower than icl (with OpenMP).
- Dealing with less support in packages such as CMake (doesn't support icx yet) and Qt (code using Qt 6 currently won't build with icl or icx and they don't test with Intel compilers).
This is not worth it for most projects.
Mentzer , thank you a lot for your support. Yes, I am also uing MSVC for most day-to-day development and Intel C++ for performance testing/tuning. So let's close this ticket.