This is an archive of the discontinued LLVM Phabricator instance.

Add hint to readme, how to use automatically the optimal number of CPU cores
AcceptedPublic

Authored by SunBlack on Oct 28 2021, 4:47 AM.

Details

Reviewers
rsmith
lattner
Summary

Usually the best compile performance you get via calling make -j$(nproc) as it is using the number of available CPU cores (more doesn't increase usually the performance but increases the required memory).

Usually you get the best compilation performance by calling make -j$(nproc), since it uses the number of CPU cores available (more usually does not increase performance, but increases the memory needed). Furthermore, the change fixes the incorrect wording of specifying the number of CPUs (which is usually 1 on desktop systems) instead of CPU cores.

Diff Detail

Event Timeline

SunBlack requested review of this revision.Oct 28 2021, 4:47 AM
SunBlack created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2021, 4:47 AM

$(nproc) isn't set for me in bash, I don't think we should point people to that. I agree "CPUs" is probably the wrong thing but your suggestion doesn't cover SMT systems, maybe "the number of CPU cores/threads you have"?

You are right, CPU cores is still not correct. I believed at SMT the virtual cores are also called cores, but apparently they are not, if I look e.g. in the specification of Intel processors. I think the reference to $(nproc) is useful if your system supports it, though a rewording to say that it only exists on some systems would be better.

SunBlack updated this revision to Diff 383760.Nov 1 2021, 3:38 AM

Updates the description. I'm still thinking about writing that the use of `-j$(nproc)` is recommended, if the system supports it, in environments with a number of dynamic CPU threads (e.g. due to different build agents).

lattner accepted this revision.Nov 1 2021, 11:04 AM

LGTM, thanks!

This revision is now accepted and ready to land.Nov 1 2021, 11:04 AM

Is there any chance that this will be merged? Or do I still have to do something for it?

Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 4:45 AM

Oh sorry, I assumed you had commit access. If not, it is easy to get, please read the LLVM Developer Policy and request access according to its instructions, thanks!