GNU make:作业数应等于系统中CPU内核数吗? [英] GNU make: should the number of jobs equal the number of CPU cores in a system?

查看:83
本文介绍了GNU make:作业数应等于系统中CPU内核数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于GNU make中的作业数量是否应该等于核心数量,或者是否可以通过添加一个可以排入队列的额外作业来优化构建时间,似乎存在一些争议. 工作".

在四核系统上使用-j4-j5更好吗?

您是否看到(或完成)了任何一个可以支持一个或另一个的基准测试?

解决方案

我想说的最好的办法就是自己针对特定的环境和工作负载进行基准测试.似乎有太多的变量(一种/全部大小)的答案(源文件的大小/数量,可用内存,磁盘缓存,源目录和系统头文件是否位于不同的磁盘上等等). /p>

我的个人经验(在2核MacBook Pro上)是-j2显着快于-j1,但除此之外(-j3,-j4等)没有可测量的加速比.因此,对于我的环境,工作==核心数"似乎是一个很好的答案. (YMMV)

There seems to be some controversy on whether the number of jobs in GNU make is supposed to be equal to the number of cores, or if you can optimize the build time by adding one extra job that can be queued up while the others "work".

Is it better to use -j4 or -j5 on a quad core system?

Have you seen (or done) any benchmarking that supports one or the other?

解决方案

I would say the best thing to do is benchmark it yourself on your particular environment and workload. Seems like there are too many variables (size/number of source files, available memory, disk caching, whether your source directory & system headers are located on different disks, etc.) for a one-size-fits-all answer.

My personal experience (on a 2-core MacBook Pro) is that -j2 is significantly faster than -j1, but beyond that (-j3, -j4 etc.) there's no measurable speedup. So for my environment "jobs == number of cores" seems to be a good answer. (YMMV)

这篇关于GNU make:作业数应等于系统中CPU内核数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆