[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Prioritizing non-dependent targets in parallel make

From: tom honermann
Subject: Re: Prioritizing non-dependent targets in parallel make
Date: Mon, 28 Dec 2009 18:16:16 -0800
User-agent: Thunderbird (Windows/20090812)

On 12/25/2009 4:36 PM, Philip Guenther wrote:
On Thu, Dec 24, 2009 at 7:16 AM, Paul Smith <address@hidden> wrote:
You can already completely control the order in which targets are
invoked, even when using -j.

At all times, make will try to build prerequisites starting with the
first one in the prerequisite list, and continuing in order to the last
one in the list.

The problem is that only works for the direct dependencies.  I think
the OP's request is more about stuff buried more than one level deep.
E.g., program "prog" requires two libraries, each one of which has
multiple objects of varying size, with one object in each taking
particularly long to compile, say:

prog: prog.o liba.a libb.a
liba.a: a1big.o a2.o a3.o a4.o a5.o
        ${AR} rc $@ $^
libb.a: b1big.o b2.o b3.o b5.o b5.o
        ${AR} rc $@ $^

Now, let's say a2.o, a3.o, a4.o, a5.o and b1big.o are out of date.
"make -j2 prog" will rebuild them in that exact order, but it would
take less total time if make started rebuilding b1big.o first.  Static
reorderings of the prerequisite lists can't solve this.
Actually, while also an interesting case, this isn't quite the case I had in mind. I hadn't even considered the case of optimizing partially completed builds in this way. My focus has been on optimizing a full build - or rather, getting make to invoke specific targets as soon as possible. I like this line of thinking though - a comprehensive optimization solution could potentially
solve many interesting cases like this.
Personally, while I'm sympathetic to the concern, I think this is the
sort of problem where the consequences of the solution are likely to
be greater than expected and it should probably be handed to some CS
grad student as a possible research project.  Isn't that what grad
schools are for, banging on possibly open-ended problems?
I agree - this would be a great project for a grad student! Perhaps a good Google Summer Of
Code project or similar.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]