PDA

View Full Version : Multi Processor tweaks



Ashe
11-26-2002, 02:29 PM
Just a quick question here. Where is the switch to turn on the multiprocessor compilation? When I do kernel compiles it uses both processor equally but when I do the SEQ compiles it will alternate between processors. I'm guessing that it's in my makefile but I was hoping that I could get a jump start on where to look specificaly.

Ok, after typing this up I felt bad that I hadn't done any work on it so I now know that you need a -j2 as a command option for gcc to use two threads to compile (use two processors). This won't have an effect on single processor guys expect for that the error messages when they come out might not necessarily be in the right order.

But....

I still don't know where to add this to make it take effect.

high_jeeves
11-26-2002, 03:47 PM
just type make -j2. It is make that will use 2 processors (by spawning 2 copies of gcc at once), gcc only uses one.

--Jeeves

eggman
11-26-2002, 04:26 PM
Ashe,

Using multiple parrallel jobs with make is not only beneficial to SMP systems. In many circumstances an additional thread will assist in hiding the latency introduced to your compile time by disk I/O. A good example of this would be a large source tree that uses many files (the kernel is an example of this). On a uniprocessor machine try `time make` then `time make -j2`. You will notice a significant reduction in the amount of wall time required. For SMP systems I generally use make -j (#CPU's + (#CPU's / 2)).

Cheers,
-Egg

btw - for the time tests be sure to `make clean` between tests.