-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parallel cmake and make #4783
Parallel cmake and make #4783
Conversation
mk/spksrc.compile.mk
Outdated
@@ -33,7 +33,7 @@ compile_msg: | |||
pre_compile_target: compile_msg | |||
|
|||
compile_target: $(PRE_COMPILE_TARGET) | |||
@$(RUN) $(MAKE) $(COMPILE_MAKE_OPTIONS) | |||
@$(RUN) $(MAKE) -j$(NCPUS) $(COMPILE_MAKE_OPTIONS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure if this one does anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is obsolete, as COMPILE_MAKE_OPTIONS += -j$(NCPUS)
is already defined above in this file.
But all custom COMPILE_MAKE_OPTIONS
must be defined with +=
too, to keep the -j option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks having it multiple times doesn't actually hurt AFAIK but makes things messy. Impressive improvements though when packages use the $(COMPILE_MAKE_OPTIONS)
aka include the -j$(NCPUS)
cross/busybox/Makefile
Outdated
.PHONY: busybox_compile | ||
busybox_compile: | ||
$(RUN) CROSS_COMPILE=$(TC_PATH)$(TC_PREFIX) $(MAKE) busybox | ||
$(RUN) CROSS_COMPILE=$(TC_PATH)$(TC_PREFIX) $(MAKE) -j$(NCPUS) busybox | ||
|
||
.PHONY: busybox_install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most of the custom compile-targets adjusted here could be removed by definition of COMPILE_MAKE_OPTIONS
as the default compile_target executes $(RUN) $(MAKE) $(COMPILE_MAKE_OPTIONS)
busybox_compile can be removed by:
COMPILE_MAKE_OPTIONS += CROSS_COMPILE=$(TC_PATH)$(TC_PREFIX) busybox
this work only, when it does not matter that CROSS_COMPILE definition must not be left of $(MAKE) on the command line.
As spksrc.common.mk already defines COMPILE_MAKE_OPTIONS += -j$(NCPUS)
this must not be added here again.
native/elixir/Makefile
Outdated
@@ -22,7 +22,7 @@ include ../../mk/spksrc.native-cc.mk | |||
|
|||
.PHONY: elixir_compile | |||
elixir_compile: | |||
$(RUN) PATH=$$PATH:$(ERLANG_BIN_DIR) $(MAKE) $(MAKE_COMPILE_OPTIONS) | |||
$(RUN) PATH=$$PATH:$(ERLANG_BIN_DIR) $(MAKE) -j$(NCPUS) $(MAKE_COMPILE_OPTIONS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here the PATH definition must preceed the $(MAKE) call, but we can omit the -j$(NCPUS)
, as it is already in MAKE_COMPILE_OPTIONS
.
Humm, rather interesting but there is a need to be really really careful with this... There are two things to be on the lookout:
Let's say you run Currently, as we call |
Hm that is a valid concern. I still think this is an overall improvement and adds consistency. AFAIK lots of packages are already running like you describe (npcroc * npcroc). I guess my focus is to make one arch builds faster to increase development productivity, everything else is secondary IMHO. As for overwhelming your system. It depends entirely how many cores you let docker use. I guess my ultimate aim is to make one arch builds faster to increase development productivity and let the CI build all other architectures. |
I took a totally different approach (ref: b62495f), based on my current PR while fixing Running quick tests on my 12x core AMD show a significant reduction of build time for both regular cross/SVT-AV1
cross/ZLIB
|
spk/fish Before (current master): $ make -C spk/fish clean
$ time make -C spk/fish all-supported
real 22m45.112s
user 27m26.899s
sys 4m33.054s After (this PR): $ make -C spk/fish clean
$ time make -C spk/fish all-supported
real 7m33.658s
user 40m11.263s
sys 5m12.594s
$ make -C spk/fish clean
$ time make -j12 -C spk/fish all-supported
Out of memory (over 18GB) With your PR: (I forgot to clean after 1 arch was build) $ time make -j12 -C spk/fish all-supported
real 2m19.985s
user 19m54.434s
sys 2m30.063s |
Superseded by #4803 |
Motivation: Make compiling faster. I've only tested
fish
andumurmur
so far. (I have an i7-10750H with 6 cores)fish
from 2m29s to 49 s