bugmake - Bugs: bug #49844, 'make -j' without explicit process...


bug #49844: 'make -j' without explicit process count sometimes doesn't parallelize

Submitted by:  Dima Kogan <dkogan>
Submitted on:  Wed 14 Dec 2016 07:02:15 PM UTC  
Severity:  3 - Normal Item Group:  None
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  None Operating System:  None
Fixed Release:  None Triage Status:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 22 Jun 2017 12:12:18 PM UTC, comment #2: 

Even simpler is to just use "--" (and what's the goal of using xargs?):

  make -j5 -- $(seq 1000)

  make -j -- $(seq 1000)

If that ends up not solving your problem please add a new comment and I'll re-open this issue.

Paul D. Smith <psmith>
Project Administrator
Wed 21 Jun 2017 07:39:39 PM UTC, comment #1: 


There is a bug in your trivial example:

1) 'seq 1000 | xargs -n1000 make -j5'

expands to

'make -j5 1 2 3 4 5 6 7 ...'


2) 'seq 1000 | xargs -n1000 make -j'

expands to

'make -j 1 2 3 4 5 6 7 ...'

As we can see, in second example '1' after '-j' make interprets as number of jobs, so "it not do any parallelization at all".

Michael Builov <mbuilov>
Wed 14 Dec 2016 07:02:15 PM UTC, original submission:  

Hi. I have this trivial Makefile:

echo Starting $@ || true
timeout 5 bash -c 'while true; do true; done' || true
echo Done $@ || true

It's meant to spin the cpu for 5 seconds for each target being built. I can ask for 5 simultaneous jobs with something like 'seq 1000 | xargs -n1000 make -j5' and this command should always redline 5 CPUs. If I give 'make -j' instead of 'make -j5' I would expect it to redline ALL my CPUs, but I see it not do any parallelization at all instead. If the Makefile contains normal (not pattern) rules, then it works how I would expect.

Dima Kogan <dkogan>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by mbuilov (Posted a comment)
  • -email is unavailable- added by dkogan (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-06-22 psmith StatusNone => Not A Bug
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.5