3 ms·
I see suggestions to use ‘make -j$(nproc)’. However, I was taught when learning MPI programming 20 years ago, you want think at least “one to load, one to run”
by oso2k 6y ago
I see suggestions to use ‘make -j$(nproc)’. However, I was taught when learning MPI programming 20 years ago, you want think at least “one to load, one to run”. The idea being that processes and threads waiting on IO will sleep/yield while another process or thread can continue executing. An especially useful strategy if you can afford the RAM (trading RAM for CPU). Consequently, I tend to run twice as many ‘make’ jobs as threads on my systems.
- richardwhiuk 6y agoI think that would justify adding a single extra, not an entire slate.
- oso2k 6y agoI think logic still holds. There’s an order magnitude more cache in today’s server CPUs. There’s higher likelihood today that your thread or process will remain in the cache, keeping it performant.
- edgyquant 6y agoYeah I think so I was taught to run make -j(number of threads + 1) by taught I mean I saw it in a lot of tutorials during my early years of learning Linux, C and make.
- kevin_thibedeau 6y agoThat was before mainstream SMT.
- flafla2 6y agoI’ve heard about this trick/incantation as well, but haven’t managed to measure a significant performance gain (though it makes sense in theory). Do you know of any quantitative evidence that this is solid advice? I suppose my testing is not at all scientific, just my anecdotal experience using make -j(i+1)
- usefulcat 6y agoThis is probably more worthwhile when using spinning disks, as opposed to SSDs.