超线程对编译器性能的影响?
假设我们想要尽快编译一个大型项目(例如 GCC 或 Linux 内核)。具有超线程功能的 CPU(例如 Intel Core i7)在启用或禁用超线程的情况下运行编译器的速度是否会更快?是否有任何已发布的基准测试可以对此进行测试?
我对超线程的理解是每个核心可以从两个(或更多进程)中选择指令。这通常会使核心更加高效,因为功能单元不太可能闲置。然而,由于在同一核心上运行的进程共享缓存等资源,并且可能会相互干扰,因此可能会造成性能损失。性能是否真正提高取决于工作负载。
那么对于编译器工作负载来说,性能是否会提高?如果是这样,幅度是多少?
Say we want to compile a large project (say GCC or the Linux kernel) as fast as possible. Does a CPU with hyperthreading capability (say an Intel Core i7) run the compiler any faster with hyperthreading enabled or disabled? Are there any published benchmarks that test this?
My understanding of hyperthreading is that each core can select instructions from two (or more processes). This usually makes the core more efficient since it's less likely that functional units will be idle. However, there's potential for a performance penalty since processes running on the same core share resources such as cache and may interfere with one another. Whether or not performance actually increases depends on the workload.
So for a compiler workload, does performance increase? If so, by how much?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
上编译 coreutils-8.4
在启用 HT 的 Ubuntu 8.04 x86 Intel Atom 1.6 GHz
:因此超线程将运行时间减少到 75%,相当于处理能力提高了 33%。 (我运行了两次,以确保所有内容都在内存缓存中。)
这是一个控制实验,表明单独使用
make -j2
并不能提高在 Ubuntu 8.04 x86 上编译 coreutils-8.4 的速度单核 Core 2 四核 2.5 GHz 虚拟机(无 HT):
Compiling coreutils-8.4 on Ubuntu 8.04 x86
Intel Atom 1.6 GHz with HT enabled:
So Hyper-Threading reduces the run time to 75%, which is equivalent to 33% more processing power. (I ran them twice to ensure that everything is in the memory cache.)
And here is a control experiment to show that
make -j2
alone does not improve the speed for compiling coreutils-8.4 on Ubuntu 8.04 x86Single-core Core 2 Quad 2.5 GHz VM (no HT):
这完全取决于编译器是否被编写为多线程。如果是,那么超线程肯定会加快速度,因为操作系统可以将编译器线程的不同部分调度到不同的内核上。我同意 Ken 的观点,即编译通常比处理密集型更受 I/O 限制,因此拥有快速硬盘驱动器比具有 100 个内核的快速处理器更为必要。
It all depends on if the compiler is written to be multi-threaded or not. If it is, then definitely hyperthreading speeds things up a bit since then the OS can schedule different parts of the compiler's threads onto different cores. I agree with Ken that compilations generally are more I/O bound than processing intensive, so having a speedy hard-drive would be more of a necessity than a speedy processor with 100's of cores.