Sign in Join

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

Mailing lists / lazarus / 2009-11

make option -j

8 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Alexander Kaupp

Hello all,

I dont know if everyone knows this:

I have a dualcore CPU now and was wondering how to use both cores for compiling for example lazarus.

make -j2 all

uses both cpus and works great with lazarus :)

for a quad-core use option: -j4

hope someone finds this useful

regards
alex

Reply by email

ik
to Alexander Kaupp

Does it actually works with FPC ?

Ido

http://ik.homelinux.org/

Alexander Kaupp wrote 27 lines
Hello all, I dont know if everyone knows this: I have a dualcore CPU now and was wondering how to use both cores for compiling for example lazarus. make -j2 all uses both cpus and works great with lazarus :) for a quad-core use option: -j4 hope someone finds this useful regards alex -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20091113/d7098e1f/attachment-0001.html>

Reply by email

Alexander Kaupp
to ik

Hi Ido,

i tested it on fpc-2.2.4 src

It seem that it works partial with FPC. Maybe the problem is that the -j option means that 2 tagets will be processed in parallel, if it is possible.
I think with FPC it is not allways possible. Compiling works but not all CPUs are used all the time.

greetings
alex

ik wrote 43 lines
Does it actually works with FPC ? Ido http://ik.homelinux.org/ On Fri, Nov 13, 2009 at 6:38 PM, Alexander Kaupp wrote: Hello all, I dont know if everyone knows this: I have a dualcore CPU now and was wondering how to use both cores for compiling for example lazarus. make -j2 all uses both cpus and works great with lazarus :) for a quad-core use option: -j4 hope someone finds this useful regards alex -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

David W Noon
to Alexander Kaupp: I dont know if everyone knows this: I have a dualcore CPU now and was wondering how to…

On Fri, 13 Nov 2009 17:38:20 +0100, Alexander Kaupp wrote about [Lazarus] make option -j:

Show quoted text 12 lines
I dont know if everyone knows this: I have a dualcore CPU now and was wondering how to use both cores for compiling for example lazarus. make -j2 all uses both cpus and works great with lazarus :) for a quad-core use option: -j4 hope someone finds this useful

This is not wholly dependent on having an SMP hardware configuration.

Even on a uniprocessor system, make can be accelerated by specifying -j2 or -j3 or even higher. This is because it is not the make program exploiting multiple processes but the Linux (or other) kernel having multiple processes to despatch (or "schedule", as UNIX boffins misname this). It doesn't need multiple CPUs, just time-slicing and enough RAM.

Of course, the more processor cores you have on your system, the higher the number that can sensibly follow -j. The rule-of-thumb I use for make is:

1. Let n denote the number of CPUs installed on the system.

2. Try 3*n+2 for the number to follow -j.

3. If that number seems too high, typically by causing paging, then try 2*n+1 instead.

So, for a monadic system, I try -j5 first, then -j3 if the machine pages.

For a dyadic system, I try -j8 first, then -j5 if the machine pages.

For a tetradic system, I try -j14 first, then -j9 if the machine pages.

... And so on.

But that is not a hard and fast rule, just a rule-of-thumb.

Note:
=====
Monadic = 1 CPU
Dyadic = 2 CPUs
Tetradic = 4 CPUs

These terms came into use in the 1960s when mainframes first acquired SMP (or "polyadic") configurations.

My dream is to have a hexadekadic box under my desk!! You should now be able to work out what that means, from the above. ... ;-)

Regards, Dave [RLU #314465] ======================================================================= (David W Noon) =======================================================================

Reply by email

Alexander Kaupp
to David W Noon

Hi,

you are right :) I am happy to see both cpu/cores doing the compiling :)

greetings
alex

David W Noon wrote 57 lines
On Fri, 13 Nov 2009 17:38:20 +0100, Alexander Kaupp wrote about [Lazarus] make option -j: > I dont know if everyone knows this: > > I have a dualcore CPU now and was wondering how to use both cores for > compiling for example lazarus. > > make -j2 all > > uses both cpus and works great with lazarus :) > > for a quad-core use option: -j4 > > hope someone finds this useful This is not wholly dependent on having an SMP hardware configuration. Even on a uniprocessor system, make can be accelerated by specifying -j2 or -j3 or even higher. This is because it is not the make program exploiting multiple processes but the Linux (or other) kernel having multiple processes to despatch (or "schedule", as UNIX boffins misname this). It doesn't need multiple CPUs, just time-slicing and enough RAM. Of course, the more processor cores you have on your system, the higher the number that can sensibly follow -j. The rule-of-thumb I use for make is: 1. Let n denote the number of CPUs installed on the system. 2. Try 3*n+2 for the number to follow -j. 3. If that number seems too high, typically by causing paging, then try 2*n+1 instead. So, for a monadic system, I try -j5 first, then -j3 if the machine pages. For a dyadic system, I try -j8 first, then -j5 if the machine pages. For a tetradic system, I try -j14 first, then -j9 if the machine pages. ... And so on. But that is not a hard and fast rule, just a rule-of-thumb. Note: ===== Monadic = 1 CPU Dyadic = 2 CPUs Tetradic = 4 CPUs These terms came into use in the 1960s when mainframes first acquired SMP (or "polyadic") configurations. My dream is to have a hexadekadic box under my desk!! You should now be able to work out what that means, from the above. ... ;-)

Reply by email

Marc Weustink
to Alexander Kaupp: I dont know if everyone knows this: I have a dualcore CPU now and was wondering how to…
Alexander Kaupp wrote 14 lines
Hello all, I dont know if everyone knows this: I have a dualcore CPU now and was wondering how to use both cores for compiling for example lazarus. make -j2 all uses both cpus and works great with lazarus :) for a quad-core use option: -j4 hope someone finds this useful

It won't make a big difference. (only making components I think)

All lcl units are compiled by fpc through the allunits.pp "project" (we use this to let fpc figure out the dependencies)
The same counts for the ide.

I hope when specifying -j2 it builds the lcl first and after that the lcl/interfaces. If not, it wont work.

So, you won't gain much.

Marc

Reply by email

David W Noon
to Marc Weustink

On Fri, 13 Nov 2009 23:47:10 +0100, Marc Weustink wrote about Re: [Lazarus] make option -j:

[snip]

Show quoted text 6 lines
All lcl units are compiled by fpc through the allunits.pp "project" (we use this to let fpc figure out the dependencies) The same counts for the ide. I hope when specifying -j2 it builds the lcl first and after that the lcl/interfaces. If not, it wont work.

The make utility still has to follow the dependency graph of the project. It can only parallelize specific builds within a node of that graph.

So, you won't gain much.

Indeed, this is often the case on fairly small projects.

Regards, Dave [RLU #314465] ======================================================================= (David W Noon) =======================================================================

Reply by email

Henry Vermaak
to David W Noon

2009/11/14 David W Noon :

Show quoted text 18 lines
On Fri, 13 Nov 2009 23:47:10 +0100, Marc Weustink wrote about Re: [Lazarus] make option -j: [snip] > All lcl units are compiled by fpc through the allunits.pp > "project" (we use this to let fpc figure out the dependencies) > The same counts for the ide. > > I hope when specifying -j2 it builds the lcl first and after that the > lcl/interfaces. If not, it wont work. The make utility still has to follow the dependency graph of the project. It can only parallelize specific builds within a node of that graph. > So, you won't gain much. Indeed, this is often the case on fairly small projects.

I don't even gain much when compiling fpc with -j 8 on my quad core. It makes a huge difference when compiling the kernel, but I should probably try and compare gcc. Must be a dependency issue as you say, I hope fpmake can fix this somehow.

Henry

Reply by email