为什么要使用````''' - j'数量的核心时间1.5?
我看到了一些说明,说我应该将make -j
与我的CPU内核数量1.5一起使用。例如 this
所以我的问题是,这个数字会创造出最佳的构建性能,还是只是一个化妆号码?如果它是随机组成的,那么我应该如何将数字传递给make -j
以获得最佳速度?
谢谢!
I have seen some instructions saying that I should use make -j
with my number of CPU cores times 1.5. For example this
So my question is, will this number create the best build performance or it's just a made-up number? If it is made up randomly, so how should I pass number to make -j
to get the best speed?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会说这是一个虚构的数字,但这很有意义。
编译的很大一部分只是I/O等待,如果您使用“ make -j” nproc`“某些内核将只是等待磁盘访问(通常是一个顺序的过程)。
因此,尝试将那些正在等待编译代码的内核通过超额订阅的并行任务数量进行编译是有道理的。
这可能有可能有效,具体取决于您的核心数量,磁盘速度,磁盘缓存,内存,内存上的缓存文件,代码大小,预编译标题,语言的复杂性(C ++比Fortran或C)编译要复杂得多) ,汇编依赖性和较长的等。
以我的经验,如果您有32个或更多的核心,则1.5的倍数无法正常工作,磁盘I/O的压力太大。对于8个内核,它运行良好。
I would say that it's a made-up number, but it makes sense.
A big part of compiling is just I/O waiting, if you use "make -j `nproc`" some of the cores will be just waiting for disk access (which normally is a sequential process).
So it makes sense to try to put those cores that are waiting to compile code by oversubscribing the number of parallel tasks.
This may or not work, depending on your number of cores, disk speed, disk cache, memory, cached files on memory, code size, precompiled headers, complexity of the language (C++ is a lot more complex to compile than Fortran or C), compilation dependencies, and a long etcetera.
In my experience a factor of 1.5 doesn't work well if you have 32 or more cores, too much pressure on the disk I/O. For 8 cores it works well.