bug-make
[Top][All Lists]
Advanced

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

[bug #57178] Job server not invoked in initial pass


From: Paul Berg
Subject: [bug #57178] Job server not invoked in initial pass
Date: Wed, 6 Nov 2019 06:07:44 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0

URL:
  <https://savannah.gnu.org/bugs/?57178>

                 Summary: Job server not invoked in initial pass
                 Project: make
            Submitted by: paulberg
            Submitted on: Wed 06 Nov 2019 11:07:42 AM UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.2.1
        Operating System: Any
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

In a recipe, a call to a sub-make process using the $(MAKE) macro coordinates
with the job server to maintain a maximum number of parallel jobs as
instructed by the -j parameter. It is expected that any use of this macro
would do the same, but in the initial expansion, use of this macro does not
coordinate and is restricted to -j1.

To Repro use 2 files (below) Makefile and test.mk. test.mk called with -j10
will return 10 normally (some race conditions possible). However, if Makefile
is called with -j10, it invokes test.mk as a sub-make and test.mk will report
that only -j1 was invoked, indicating that the job server is not being
utilized.

Expected: This test when invoked with -j n should report n (or close to n,
race conditions permitting) since the job server should coordinate the number
of available jobs and the sub process should parallelize accordingly.

FILE1 Makefile:

$(info $(shell $(MAKE) -f test.mk all))

all:
        @:

FILE2 test.mk:

all: | parallel ; @echo $(JOB_COUNT)

parallel: .parallel ; @$(eval JOB_COUNT := $(shell sort -n $< | tail -n 1))
.parallel: FORCE ; @$(MAKE) -f test.mk --no-print-directory par 2>/dev/null
>$@ || true
FORCE:

to_n = $(words $2) $(if $(filter-out $1,$(words x $2)),$(call to_n,$1,x $2))

PAR_COUNT :=
par: $(addprefix par-,$(call to_n,32))
par-%: ; @$(eval PAR_COUNT += x)@echo $(words $(PAR_COUNT)) && sleep 1 &&
false





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57178>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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