Sign in Join

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

Mailing lists / fpc-devel / 2012-03

New less verbose compilation of trunk

21 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

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

Andrew Haines

Hi,

Just wanted to say I like the new less verbose compilation of fpc trunk. Is this part of the result of moving to fpmake?

Regards,

Andrew Haines

Reply by email

Jonas Maebe
Andrew Haines wrote
Just wanted to say I like the new less verbose compilation of fpc trunk. Is this part of the result of moving to fpmake?

Sort of, yes, although it would be trivial have regular "make" be less verbose also ( output of make when compiling the Linux kernel).

Jonas

Reply by email

Graeme Geldenhuys
to Andrew Haines: Just wanted to say I like the new less verbose compilation of fpc trunk. Is this part of…
Andrew Haines wrote
Hi, Just wanted to say I like the new less verbose compilation of fpc trunk.

+1 [ there was no "Like" button, so I had to resort to Google's +1 ;-) ]

I really like the compilation percentage being displayed. This gives me a good indication if I can go for that coffee break or not. :)

PS:
Adding any more (if possible) parallel compilation support would be awesome too. This already saves me over 1 minute in compile time on my quad core. Yes, I hate it if CPU's just sit idle.

Regards,   - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email

Marco van de Voort
to Graeme Geldenhuys

In our previous episode, Graeme Geldenhuys said:

PS: Adding any more (if possible) parallel compilation support would be awesome too. This already saves me over 1 minute in compile time on my quad core. Yes, I hate it if CPU's just sit idle.

IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads)

Reply by email

Mattias Gaertner
to Marco van de Voort

Marco van de Voort hat am 7. März 2012 um 11:27
geschrieben:

Show quoted text 7 lines
In our previous episode, Graeme Geldenhuys said: > PS: > Adding any more (if possible) parallel compilation support would be > awesome too. This already saves me over 1 minute in compile time on my > quad core. Yes, I hate it if CPU's just sit idle. IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads)

I tried this and saw only short periods more than one processor used. Only for a few seconds three were used. Is this normal?

Mattias

Reply by email

Marco van de Voort
to Mattias Gaertner

In our previous episode, Mattias Gaertner said:

Show quoted text 10 lines
> In our previous episode, Graeme Geldenhuys said: > > PS: > > Adding any more (if possible) parallel compilation support would be > > awesome too. This already saves me over 1 minute in compile time on my > > quad core. Yes, I hate it if CPU's just sit idle. > > IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads) I tried this and saw only short periods more than one processor used. Only for a few seconds three were used. Is this normal?

IIRC I noticed a small improvement when Joost mentioned (like 10s on an overal 200 secs overall build). I have no other info on this than that it exists :-)

Reply by email

Henry Vermaak
to Marco van de Voort: In our previous episode, Graeme Geldenhuys said: IIRC add FPMAKEOPT='-T 3' (3= number…
Marco van de Voort wrote 7 lines
In our previous episode, Graeme Geldenhuys said: > PS: > Adding any more (if possible) parallel compilation support would be > awesome too. This already saves me over 1 minute in compile time on my > quad core. Yes, I hate it if CPU's just sit idle. IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads)

This makes a big difference for me:

Without FPCMAKEOPT: 1m48.056s
With FPCMAKEOPT="-T 9": 1m13.833s

Unfortunately, cycling the compiler is taking really long and -j 9 isn't helping much (or at all).

Henry

Reply by email

Marco van de Voort
to Henry Vermaak

In our previous episode, Henry Vermaak said:

Show quoted text 14 lines
>> PS: >> Adding any more (if possible) parallel compilation support would be >> awesome too. This already saves me over 1 minute in compile time on my >> quad core. Yes, I hate it if CPU's just sit idle. > > IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads) This makes a big difference for me: Without FPCMAKEOPT: 1m48.056s With FPCMAKEOPT="-T 9": 1m13.833s Unfortunately, cycling the compiler is taking really long and -j 9 isn't helping much (or at all).

fpmake only handles packages/.

fpmake (or make -j the way FPC used it in the past) can't really speed up runs that are a single compiler invocation (like the compiler), unless it can run two such runs in paralel.

In packages this is possible, in the compiler cycle compiler depends on RTL, and the "next" rtl depends on the "previous" compiler, so nothing can be done there.

To exploit paralellism in single compiler invocations, threading should be brought into the compiler, but that is an huge and uncertain job.

Reply by email

Henry Vermaak
to Marco van de Voort
Marco van de Voort wrote 28 lines
In our previous episode, Henry Vermaak said: >>> PS: >>> Adding any more (if possible) parallel compilation support would be >>> awesome too. This already saves me over 1 minute in compile time on my >>> quad core. Yes, I hate it if CPU's just sit idle. >> >> IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads) > > This makes a big difference for me: > > Without FPCMAKEOPT: 1m48.056s > With FPCMAKEOPT="-T 9": 1m13.833s > > Unfortunately, cycling the compiler is taking really long and -j 9 isn't > helping much (or at all). fpmake only handles packages/. fpmake (or make -j the way FPC used it in the past) can't really speed up runs that are a single compiler invocation (like the compiler), unless it can run two such runs in paralel. In packages this is possible, in the compiler cycle compiler depends on RTL, and the "next" rtl depends on the "previous" compiler, so nothing can be done there. To exploit paralellism in single compiler invocations, threading should be brought into the compiler, but that is an huge and uncertain job.

With c, the compilation of .c -> .o is isolated, so many of them can be run in parallel, which means that compiling e.g. the linux kernel, you get great performance from make -j %d. Is it possible to have fpc do the same thing somehow? Bringing threading into the compiler sounds very scary, indeed.

Henry

Reply by email

Graeme Geldenhuys
to Marco van de Voort: In our previous episode, Graeme Geldenhuys said: IIRC add FPMAKEOPT='-T 3' (3= number…
Marco van de Voort wrote
IIRC add  FPMAKEOPT='-T 3'   (3= number of paralel threads)

I use the following when I recompile a new FPC. Recommendation (on the internet) was to always use a -j value one greater than your number of cores.

make all -j 5 FPC=$COMPILER

How does this differ to your suggestion? Or does it translate to something similar.

Regards,   - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email

Sven Barth
to Henry Vermaak: With c, the compilation of .c -> .o is isolated, so many of them can be run in parallel,…
Henry Vermaak wrote 37 lines
On 07/03/12 12:02, Marco van de Voort wrote: > In our previous episode, Henry Vermaak said: >>>> PS: >>>> Adding any more (if possible) parallel compilation support would be >>>> awesome too. This already saves me over 1 minute in compile time on my >>>> quad core. Yes, I hate it if CPU's just sit idle. >>> >>> IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads) >> >> This makes a big difference for me: >> >> Without FPCMAKEOPT: 1m48.056s >> With FPCMAKEOPT="-T 9": 1m13.833s >> >> Unfortunately, cycling the compiler is taking really long and -j 9 isn't >> helping much (or at all). > > fpmake only handles packages/. > > fpmake (or make -j the way FPC used it in the past) can't really speed up > runs that are a single compiler invocation (like the compiler), unless it > can run two such runs in paralel. > > In packages this is possible, in the compiler cycle compiler depends > on RTL, > and the "next" rtl depends on the "previous" compiler, so nothing can be > done there. > > To exploit paralellism in single compiler invocations, threading > should be > brought into the compiler, but that is an huge and uncertain job. With c, the compilation of .c -> .o is isolated, so many of them can be run in parallel, which means that compiling e.g. the linux kernel, you get great performance from make -j %d. Is it possible to have fpc do the same thing somehow? Bringing threading into the compiler sounds very scary, indeed.

In C the dependencies between the .o files are resolved at link time while in Pascal they are already resolved at compile time (the unit concept). So the only feasible possibility for a speed up there is threading support in the compiler as only the compiler fully knows the dependencies between the units.

Regards,
Sven

Reply by email

Sven Barth
to Graeme Geldenhuys: I use the following when I recompile a new FPC. Recommendation (on the internet) was to…
Graeme Geldenhuys wrote 16 lines
On 7 March 2012 12:27, Marco van de Voort wrote: > > IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads) I use the following when I recompile a new FPC. Recommendation (on the internet) was to always use a -j value one greater than your number of cores. make all -j 5 FPC=$COMPILER How does this differ to your suggestion? Or does it translate to something similar.

With fpmake "-j x" isn't usable anymore, because AFAIK Joost found no way to "hook" into Make's threading mechanism to utilize that for fpmake. So you'll need to use the parameter above (which is handed over to fpmake). As threading is basically only useable when compiling the packages this shouldn't make a big difference to the "-j" approach.

Regards,
Sven

Reply by email

Jonas Maebe
to Henry Vermaak: This makes a big difference for me: Without FPCMAKEOPT: 1m48.056s With FPCMAKEOPT="-T 9":…
Henry Vermaak wrote
Unfortunately, cycling the compiler is taking really long and -j 9 isn't helping much (or at all).

It can be sped up by adding proper unit dependency information in your platform's RTL Makefile.fpc, and then removing the .NOTPARALLEL. Except for the Darwin RTL, no RTL currently has proper dependency information. It also won't work for the Windows RTLs, because they use build units (which is another way to speed up things, although you can't take advantage of any parallelism in that case without modifying the compiler).

Jonas

Reply by email

Henry Vermaak
to Jonas Maebe
Jonas Maebe wrote 12 lines
On 07 Mar 2012, at 12:29, Henry Vermaak wrote: > Unfortunately, cycling the compiler is taking really long and -j 9 > isn't helping much (or at all). It can be sped up by adding proper unit dependency information in your platform's RTL Makefile.fpc, and then removing the .NOTPARALLEL. Except for the Darwin RTL, no RTL currently has proper dependency information. It also won't work for the Windows RTLs, because they use build units (which is another way to speed up things, although you can't take advantage of any parallelism in that case without modifying the compiler).

Thanks for the information. Do you have benchmarks of the Darwin RTL compilation before and after adding the dependency information?

Henry

Reply by email

Mattias Gaertner
to Sven Barth: In C the dependencies between the .o files are resolved at link time while in Pascal they…

Sven Barth hat am 7. März 2012 um 14:04
geschrieben:

Show quoted text 6 lines
Am 07.03.2012 13:11, schrieb Henry Vermaak: > On 07/03/12 12:02, Marco van de Voort wrote: >> In our previous episode, Henry Vermaak said: >>>>> PS: >>>>> Adding any more (if possible) parallel compilation support would be >>>>> awesome too. This already saves me over 1 minute in compile time on

my

Show quoted text 10 lines
>>>>> quad core. Yes, I hate it if CPU's just sit idle. >>>> >>>> IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads) >>> >>> This makes a big difference for me: >>> >>> Without FPCMAKEOPT: 1m48.056s >>> With FPCMAKEOPT="-T 9": 1m13.833s >>> >>> Unfortunately, cycling the compiler is taking really long and -j 9

isn't

Show quoted text 5 lines
>>> helping much (or at all). >> >> fpmake only handles packages/. >> >> fpmake (or make -j the way FPC used it in the past) can't really speed

up

>> runs that are a single compiler invocation (like the compiler), unless

it

Show quoted text 5 lines
>> can run two such runs in paralel. >> >> In packages this is possible, in the compiler cycle compiler depends >> on RTL, >> and the "next" rtl depends on the "previous" compiler, so nothing can

be

Show quoted text 9 lines
>> done there. >> >> To exploit paralellism in single compiler invocations, threading >> should be >> brought into the compiler, but that is an huge and uncertain job. > > With c, the compilation of .c -> .o is isolated, so many of them can be > run in parallel, which means that compiling e.g. the linux kernel, you > get great performance from make -j %d. Is it possible to have fpc do

the

Show quoted text 8 lines
> same thing somehow? Bringing threading into the compiler sounds very > scary, indeed. In C the dependencies between the .o files are resolved at link time while in Pascal they are already resolved at compile time (the unit concept). So the only feasible possibility for a speed up there is threading support in the compiler as only the compiler fully knows the dependencies between the units.

Compiling C typically starts many times the compiler. Each time the OS has to load the compiler, resolve the symbols, load all needed header files, translate them, ... This is a waste of resources. Of course you can do this waste easily in parallel.
FPC is clever enough to do most things only once. That's hard to do in parallel.

Loading the PPU files takes about 10-50%. This might be doable in parallel.

Mattias

Reply by email

Jonas Maebe
to Henry Vermaak: Thanks for the information. Do you have benchmarks of the Darwin RTL compilation before…
Henry Vermaak wrote
Thanks for the information. Do you have benchmarks of the Darwin RTL compilation before and after adding the dependency information?

No, but you can simply compile without -j and with -j 2 to see the difference. Note that these numbers are on a PowerMac G5/1.8GHz (dual cpu). I don't know how representative these numbers are for a modern x86 machine.

Without -j

real 0m21.710s
user 0m14.912s
sys 0m6.541s

With -j 2

real 0m14.848s
user 0m15.187s
sys 0m6.891s

Jonas

Reply by email

Jonas Maebe
to Mattias Gaertner: Sven Barth hat am 7. März 2012 um 14:04 geschrieben: my isn't up it be the Compiling C…
Mattias Gaertner wrote 7 lines
Compiling C typically starts many times the compiler. Each time the OS has to load the compiler, resolve the symbols, load all needed header files, translate them, ... This is a waste of resources. Of course you can do this waste easily in parallel.

If you want to optimize for speed on large parallel systems, starting from a fast sequential algorithm is usually the worst approach you can take. Optimizing for parallelism requires a completely different way of thinking, and indeed often includes approaches that would seem wasteful in a purely sequential environment.

Jonas

Reply by email

Mark Morgan Lloyd
to Sven Barth: With fpmake "-j x" isn't usable anymore, because AFAIK Joost found no way to "hook" into…

Apologies for reviving an old thread, but I've been reinstalling Debian on one of may larger systems and rebuilding FPC on it.

Sven Barth wrote
Am 07.03.2012 13:51, schrieb Graeme Geldenhuys: > On 7 March 2012 12:27, Marco van de Voort wrote: >> >> IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads)

What version did this start working with- 2.6 or 2.7?

> I use the following when I recompile a new FPC. Recommendation (on the > internet) was to always use a -j value one greater than your number of > cores.

That recommendation goes back to "mainframe shops", and is based on the premise that CPUs are expensive and it's best to keep them busy. My experience (from kernel builds etc.) suggests that there's little if any advantage attempting to parallelise beyond the number of CPUs, and there's rarely any advantage going beyond 8 since that tends to saturate the cache/bus bandwidth.

Using a test that I've run for years on a wide range of systems, and noting that these are from Suns which might not scale quite the same as PCs,

Two-CPU system:

Job count: 1
real 1m40.216s
user 0m42.423s
sys 1m4.216s

Job count: 2
real 1m10.183s
user 0m43.903s
sys 0m59.856s

Job count: 3
real 1m9.460s
user 0m44.787s
sys 1m0.524s

Job count: 4
real 1m9.618s
user 0m45.883s
sys 0m59.880s

Twelve-CPU system:

Job count: 1
real 1m39.623s
user 1m8.568s
sys 0m55.355s

Job count: 2
real 0m52.394s
user 1m9.072s
sys 0m58.828s

Job count: 3
real 0m36.387s
user 1m10.608s
sys 0m58.600s

Job count: 4
real 0m28.359s
user 1m11.712s
sys 0m59.476s

Job count: 5
real 0m23.438s
user 1m12.893s
sys 0m58.936s

Job count: 6
real 0m20.338s
user 1m12.825s
sys 0m58.256s

Job count: 7
real 0m18.658s
user 1m13.021s
sys 0m57.944s

Job count: 8
real 0m17.824s
user 1m12.509s
sys 0m58.556s

Job count: 9
real 0m17.210s
user 1m12.593s
sys 0m59.168s

Job count: 10
real 0m16.808s
user 1m12.589s
sys 0m59.764s

Job count: 11
real 0m16.531s
user 1m12.385s
sys 1m0.324s

Job count: 12
real 0m16.599s
user 1m13.093s
sys 0m59.652s

Job count: 13
real 0m16.584s
user 1m13.557s
sys 0m59.536s

Job count: 14
real 0m16.713s
user 1m12.629s
sys 1m0.624s

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Sven Barth
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 7 lines
Sven Barth wrote: > Am 07.03.2012 13:51, schrieb Graeme Geldenhuys: >> On 7 March 2012 12:27, Marco van de Voort wrote: >>> >>> IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads) What version did this start working with- 2.6 or 2.7?

The need for FPMAKEOPT was added with 2.7.1 where we transitioned the compilation of packages to fpmake. In 2.6.0 you should be able to just pass "-j N" (N = number of parallel threads) to "make".

Regards,
Sven

Reply by email

Mark Morgan Lloyd
to Sven Barth
Sven Barth wrote 12 lines
On 19.01.2013 11:54, Mark Morgan Lloyd wrote: > Sven Barth wrote: >> Am 07.03.2012 13:51, schrieb Graeme Geldenhuys: >>> On 7 March 2012 12:27, Marco van de Voort wrote: >>>> >>>> IIRC add FPMAKEOPT='-T 3' (3= number of paralel threads) > > What version did this start working with- 2.6 or 2.7? The need for FPMAKEOPT was added with 2.7.1 where we transitioned the compilation of packages to fpmake. In 2.6.0 you should be able to just pass "-j N" (N = number of parallel threads) to "make".

Thanks, noted.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email