本文介绍了如何使用gnu Make来确定--load-average的良好值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您是否有一个很好的策略来设定装载限制的值?我的机器似乎有很大的不同。

解决方案

我建议不要使用 -l 选项。



原则上, -l 看起来比优越 - Ĵ -j 表示,开始这么多工作。 -l 说,确保这么多作业正在运行。通常情况下,这些都是几乎相同的事情,但是当你有I / O绑定作业是其他的怪事时,那么 -l 应该会更好。



也就是说,平均负载的概念有点可疑。这必然是对系统进行的一个抽样。因此,如果您运行 make -j -l N (对于某些 N ),并且您有一个写得很好的makefile,那么即使在第一个系统负载样本可以被采用之前,也会立即开始大量的作业并耗尽文件描述符或内存。另外,负载平均值的计算方式在不同的操作系统上有所不同,一些模糊的算法根本就没有。在实践中,你会好起来的使用 -j 并且会减少头痛。为了从构建中获得更多性能,请调整您的makefile,使用编译器选项并使用ccache或类似方法。



(我怀疑 -l 选项源自多个处理器非常少见且I / O速度非常慢的时间。)


In Make this flag exists:

Do you have a good strategy for what value to use for the load limit ? It seems to differ a lot between my machines.

解决方案

I recommend against using the -l option.

In principle, -l seems superior to -j. -j says, start this many jobs. -l says, make sure this many jobs are running. Often, those are almost the same thing, but when you have I/O bound jobs are other oddities, then -l should be better.

That said, the concept of load average is a bit dubious. It is necessarily a sampling of what goes on on the system. So if you run make -j -l N (for some N) and you have a well-written makefile, then make will immediately start a large number of jobs and run out of file descriptors or memory before even the first sample of the system load can be taken. Also, the accounting of the load average differs across operating systems, and some obscure ones don't have it at all.

In practice, you'll be as well off using -j and will have less headaches. To get more performance out of the build, tune your makefiles, play with compiler options, and use ccache or similar.

(I suspect the original reason for the -l option stems from a time when multiple processors were rare and I/O was really slow.)

这篇关于如何使用gnu Make来确定--load-average的良好值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 03:54