Re:Use `nproc` and not grep /proc/cpuinfo
by moonchild on Thursday November 26, 2020 @08:01PM
(#25224715)
To be fair, having some way to spawn processes like there's no tomorrow is a good way to make sure there are no concurrency issues in your makefile.
I had a makefile with a race condition that triggered only sporadically. However, giving it more threads significantly increased its rate of occurrence.
Re:Use `nproc` and not grep /proc/cpuinfo
by PikachuEXE on Thursday November 26, 2020 @08:03PM
(#25224728)
Any doc that suggest this behaviour?
Re:Use `nproc` and not grep /proc/cpuinfo
by exciteabletom on Thursday November 26, 2020 @08:32PM
(#25224859)
From the man page:
> If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously.
Re:Use `nproc` and not grep /proc/cpuinfo
by stewartesmith on Thursday November 26, 2020 @08:56PM
(#25224960)
What this practically means is that a plain "make -j" will spawn all the processes that could run concurrently. So if you're building 1,000 files, it'll spawn 1,000 processes. This can either be fine, or completely terrible, depending on the number of CPUs you have an the amount of memory each process uses.
make -j without a number should do that, instead of spawning processes like there’s no tomorrow.