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

Using multiple cores for compilation

jamiecook
Beginner
1,452 Views

I'm using MSVC 2005 standard with the intel 11.0 c++ compiler and I'm noticing that it doesn't seem to be using multiple cores / threads for compilation. Forgive me if this is a nub question to ask but ... is there a way I can speed up my compilation time by using more than one of the cores on my quad core cpu?

I'm compiling a single large library which takes up to 28-30 minutes to compile.

I have a Intel Core2 Quad [x86 Family 6 Model 15 Stepping 11 GenuineIntel ~2400 Mhz]

I've been searching around on the internet but most hits are for compiling multithreaded applications with the Intel compiler rather than enabling multithreading in the compiler itself.

0 Kudos
1 Solution
shachris23
New Contributor I
1,452 Views
Quoting - jamiecook

I'm using MSVC 2005 standard with the intel 11.0 c++ compiler and I'm noticing that it doesn't seem to be using multiple cores / threads for compilation. Forgive me if this is a nub question to ask but ... is there a way I can speed up my compilation time by using more than one of the cores on my quad core cpu?

I'm compiling a single large library which takes up to 28-30 minutes to compile.

I have a Intel Core2 Quad [x86 Family 6 Model 15 Stepping 11 GenuineIntel ~2400 Mhz]

I've been searching around on the internet but most hits are for compiling multithreaded applications with the Intel compiler rather than enabling multithreading in the compiler itself.

Hi Jamie,

Simply add "/MP" flag as part of the compilr command-line argument, and it would compile multi-core. Please note that this is also documented in the Intel C++ Compiler documentation (simply search for it).

Please also note Intel probably picked this "/MP" keyword because Visual Studio (starting from 2005 onward) also uses the keyword to parallelize its compilation.

Hope this helps,


S.

View solution in original post

0 Kudos
5 Replies
jimdempseyatthecove
Honored Contributor III
1,451 Views

On VS 2005 IDE Look in

Tools | Options | Projects and Solutions | Build and Run

Jim Dempsey

0 Kudos
shachris23
New Contributor I
1,453 Views
Quoting - jamiecook

I'm using MSVC 2005 standard with the intel 11.0 c++ compiler and I'm noticing that it doesn't seem to be using multiple cores / threads for compilation. Forgive me if this is a nub question to ask but ... is there a way I can speed up my compilation time by using more than one of the cores on my quad core cpu?

I'm compiling a single large library which takes up to 28-30 minutes to compile.

I have a Intel Core2 Quad [x86 Family 6 Model 15 Stepping 11 GenuineIntel ~2400 Mhz]

I've been searching around on the internet but most hits are for compiling multithreaded applications with the Intel compiler rather than enabling multithreading in the compiler itself.

Hi Jamie,

Simply add "/MP" flag as part of the compilr command-line argument, and it would compile multi-core. Please note that this is also documented in the Intel C++ Compiler documentation (simply search for it).

Please also note Intel probably picked this "/MP" keyword because Visual Studio (starting from 2005 onward) also uses the keyword to parallelize its compilation.

Hope this helps,


S.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,452 Views
Quoting - jamiecook

I'm using MSVC 2005 standard with the intel 11.0 c++ compiler and I'm noticing that it doesn't seem to be using multiple cores / threads for compilation. Forgive me if this is a nub question to ask but ... is there a way I can speed up my compilation time by using more than one of the cores on my quad core cpu?

I'm compiling a single large library which takes up to 28-30 minutes to compile.

I have a Intel Core2 Quad [x86 Family 6 Model 15 Stepping 11 GenuineIntel ~2400 Mhz]

I've been searching around on the internet but most hits are for compiling multithreaded applications with the Intel compiler rather than enabling multithreading in the compiler itself.

Another point to consider is are you using

#pragma once

in your include files (where including only once is desired).

Jim Dempsey

0 Kudos
jamiecook
Beginner
1,452 Views
Quoting - shachris23

Hi Jamie,

Simply add "/MP" flag as part of the compilr command-line argument, and it would compile multi-core. Please note that this is also documented in the Intel C++ Compiler documentation (simply search for it).

Please also note Intel probably picked this "/MP" keyword because Visual Studio (starting from 2005 onward) also uses the keyword to parallelize its compilation.

Hope this helps,


S.

Thanks for that! Your solution seems to have sorted it out as I can now get up to 100% CPU utilisation when compiling. It's not readily apparent that it is now using multiple as all the threads are started from a single icl.exe so you end up with

[cpp]1> SourceFile1.cpp
1> SourceFile2.cpp
1> SourceFile3.cpp
1> SourceFile4.cpp[/cpp]
instead of the expected

[cpp]1> SourceFile1.cpp
2> SourceFile2.cpp
3> SourceFile3.cpp
1> SourceFile4.cpp[/cpp]

if you had N = 3 separate compilations going at once. But you can see via the task manager than there are multiple mcpcom.exe processes running.

0 Kudos
jamiecook
Beginner
1,452 Views

On VS 2005 IDE Look in

Tools | Options | Projects and Solutions | Build and Run

Jim Dempsey

That [max number of parallel project builds] was already set to 4, but had no effect on the intel compiler... solution was to add /MP to all projects that I want to compile multithreaded.

0 Kudos
Reply