Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-10

building fpc / fpmake and multicore cpu ?

4 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin

I noticed, when I build fpc, then I get cpu usage between 70% and 100%. So it appears that both cores of my pentium are used.

But when a package is compiled using fpmake, then it drops to 50%, so apparently only one core is used?

Is that correct? Does the old Makefile driven compilation use both/all cores, while packages done via fpmake, are using one core only?

Reply by email

Mattias Gaertner
to Martin
I noticed, when I build fpc, then I get cpu usage between 70% and 100%. So it appears that both cores of my pentium are used.

No, it can simply mean that the OS moves the process around, which can for example reduce cooling power.

Show quoted text 5 lines
But when a package is compiled using fpmake, then it drops to 50%, so apparently only one core is used? Is that correct? Does the old Makefile driven compilation use both/all cores, while packages done via fpmake, are using one core only?

AFAIK the makefile does not use parallel compilation.

Mattias

Reply by email

Graeme Geldenhuys
to Mattias Gaertner
Mattias Gaertner wrote 5 lines
> > Is that correct? Does the old Makefile driven compilation use both/all > cores, while packages done via fpmake, are using one core only? AFAIK the makefile does not use parallel compilation.

Yes it does, at least for compiling FPC itself (or rather parts thereof
- but which parts I don't know, probably the FCL).

eg:
make -j 5 all

Then when looking at the CPU monitor from Gnome, I see heavy CPU load on one core only. After some initial compilation on one core, it will switch to using all 4 cores in my system. This shaves about 30 seconds off the time for a clean compile of FPC on my system (if I remember correctly).

I think it was Michael van Canneyt who told me about this switch a while back, and that it indeed works with FPC too. How you apply this to your own work / projects, I have no idea.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Joost van der Sluis
to Martin: I noticed, when I build fpc, then I get cpu usage between 70% and 100%. So it appears…
Martin wrote 8 lines
I noticed, when I build fpc, then I get cpu usage between 70% and 100%. So it appears that both cores of my pentium are used. But when a package is compiled using fpmake, then it drops to 50%, so apparently only one core is used? Is that correct? Does the old Makefile driven compilation use both/all cores, while packages done via fpmake, are using one core only?

Not completely, when you use 'make -Jx' with x>1 then the old makefiles can use multiple threads to actually compile. But it could be that some overhead is done in a second thread?

As fpmake is now used in trunk the biggest disadvantage is that for each unit that is compiled a instance of the compiler is invoked. If you add '-bu' to the fpmake commandline, it outperforms the 'older' makefiles.

There's also a multi-threaded version of fpmake, but that's not comitted yet.

Joost

Reply by email