7 ms·
i think the true insanity lies within the mind of the developer whose build system depends on the number of jobs being ran in parallel..! interesting academic
by foxhill 12y ago
i think the true insanity lies within the mind of the developer whose build system depends on the number of jobs being ran in parallel..!
interesting academic exercise though. unless i'm mistaken, this will only detect up to 32 build jobs? i'd hate to see the Makefile that works for arbitrary values..
- chaosfactor 12y agoIt makes some sense to want to know this. You might know that your build process doesn't benefit from more than 4 jobs, and want to alert this to the developer who tries to use more.
- moonbug 12y agoNot all problems need a solution in code.
- nsajko 12y agoAwesome! This goes in my fortune file :D
- stormbrew 12y agoI really have to echo the person who replied to you on a different thread and ask.. why? What do you think you're saving the user from exactly?
- xorcist 12y agoPlease avoid such things. Useless warnings just create noise that mask real ones. Just this one may not matter, but the same rationality would apply to hundreds more.
- jordigh 12y agoI was the one who asked the original question. My purpose was so that Mercurial's test suite could specify the amount of parallelism from the Makefile. The "test" rule in the Makefile invokes "run-tests.py". This latter script itself accepts a -j option. It's possible to invoke it directly, but this misses the second part of the "test" rule in the Makefile, which executes some tests that run-tests.py can't do.
- pavpanchekha 12y agoSay one of your build rules generates a data file by performing some expensive computations. The parallelism is internal to the code (say, it's a Monte-Carlo simulation), so it should run on a lot of cores, but if you're doing it multiple times (with, say, different parameters) in parallel, you don't want the total number of threads spawned to be more than the machine has.
- foxhill 12y agotrue, however my only complaint - > you don't want the total number of threads spawned to be more than the machine has that may not be necessarily true, and regardless, it might be a sane decision for yourself, but it might not be for others.
- rlpb 12y agoWhy would you want to do it multiple times with different parameters in parallel? If your code can already scale to multiple cores, then just have each parameter set run one at a time, and you're already maximizing your CPU use. Or integrate with make's jobserver as someone else has described.