Conversation
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
| $ cat >dune <<EOF | ||
| > (rule (alias runtest) (action (echo "make -j%{jobs}"))) | ||
| > EOF | ||
| $ dune runtest -jauto |
There was a problem hiding this comment.
Could you modify this test to censor out the resulting j value? Otherwise this test will fail anywhere -j isn't set to 16.
There was a problem hiding this comment.
yeah this is a bit silly ;)
|
Just a heads up: this will feature make it so that your |
Hmm, I haven't thought of that, thanks.
Ok, I'll add a caveat post to the Discuss thread. Do you see a tweak (besides implementing the whole GNU jobserver) so that changing the number of jobs wouldn't re-trigger the rule? A weak reference, of sorts? I suppose setting an env var will also re-trigger the rules? |
It depends if the build is sandboxed. If it is, make will not have access to its previous build artifacts will do a clean build. Sandboxing of course is much safer and in general all non trivial and manually written makefiles do not specify their dependencies correctly.
The alternative are all fundamentally unsafe and rely on actions being co-operative. One alternative might be dune export its j value in some sort of environment variable that is visible to actions. That will not affect the digest of the action. |
Thanks for the explanations!
True.
Both GNU Make and BSD Make recognize the Another way to alleviate the problem would be for the foreign build system to auto-detect the number of cores; Ninja (used as a backend for Meson, and an optional backend for CMake) does this. I can document all of that regardless of whether we accept the |
%{jobs}is the maximum number of concurrent jobs Dune has been allowed to have (see https://dune.readthedocs.io/en/latest/reference/config/jobs.html). An initial value ofautofor the config variable expands to the auto-detected number of cores.See Dune, cmake and
-jon Discuss (cc @tbrk).A grep for
%{jobs}returned a few matches, that are direct translations of opamjobsvariable. I don't understand whether it was actually supported somehow or not, it seems not, but maybe I've missed something.I wrote on Discuss:
It's just important not to run an unbounded number of jobs.