This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Ada] Speed up build of gnatools


On 09/06/2011 01:56 PM, Arnaud Charlet wrote:
this means using as many processes as there are CPUs, right? It seems pretty

Right, but only for gnattools, which is a relatively short time, and which always occurs at the end of the build (so with nothing else running at the same time).

dubious to me to use more processes than the user maybe asked for.  For example
I have to restrict the number of CPUs used when building GCC to less than I have
since otherwise my machine overheats and turns itself off.  Is there some way
to get at the -j level the user passed to the top-level make and use that?

No, I'm not aware of a way to get this information.

The solution would be to support running gnatmake as a client of make's job server. In short:


1) gnatmake should look for the MAKEFLAGS environment variable, and look for the --jobserver-fds= option found inside it. The option receives a comma-separated list of two file descriptors. The first is an "input" pipe, the second is an "output" pipe.

2) before invoking any child process, gnatmake should ensure the child doesn't see the two pipes (unless the child were also an instance of make/gnatmake).

3) *after* invoking any child process, gnatmake should perform a blocking 1-byte read from the "input" pipe.

4) after reaping any child process, gnatmake should perform a blocking 1-byte write to the "output" pipe.

5) you should add a + in front of rules that use gnatmake.

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]