help-make
[Top][All Lists]
Advanced

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

Re: default number of JOBS


From: David Boyce
Subject: Re: default number of JOBS
Date: Mon, 27 Jul 2009 09:44:05 -0400

On Mon, Jul 27, 2009 at 9:12 AM, John Breitenbach<address@hidden> wrote:
> Is there anything I can put in my makefile to specify a default number of
> jobs?
>
> I think I see a path where I can test MAKEFLAGS and then perhaps invoke a
> submake with the desired -j something.
> I hoping for something like:
>
> # this makefile has been tested for and is known to build reliably for up to
> 6 simultaneous jobs.
> .MAKE_JOBS := 6
>
> And with this capability, and identifying the jobs flag from the command
> line, you can implement a max or min number of jobs.

The short answer is no - AFAIK there's no such facility, though as you
say it should be possible to check the command line and re-invoke with
"-j $(MAKE_JOB_DEFAULT)" if no -j flag is present.

Beyond that I'd say your hypothetical feature is logically flawed. A
piece of code, whether it be a Makefile or a C++ class, is rarely
"safe for up to N jobs". Generally it's either threadsafe or it's not
and if it is, the appropriate number of parallel threads/jobs is
generally a function of available resources.

In other words, given that the same build might be run on a
developer's workstation during the day and on a massively parallel
server during the nightly build, who's to say what the "right" amount
of parallelism is? I think it's by design that the decision is made at
runtime via a command line flag rather than wired into the Makefile.

Also, if there was to be such a feature it should encompass
--load-average too, because that's another aspect of available
resources.

David Boyce




reply via email to

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