当我想要对编译器的性能进行基准测试时,需要使用多少个内核?

发布于 2025-01-15 11:26:01 字数 214 浏览 0 评论 0原文

我重新排序编译器优化。

我想与 gcc O3 比较输出的性能。

我有一个测试套件。

我需要使用多少个核心来进行基准测试?

我确信它们的可执行文件是不同的。

我用一个单核来测量它们的运行时间,时间同样是相同的。

但我不限制核心数量来衡量运行时间,我的编译器的可执行文件比 gcc O3 更快。

如何确定哪个编译器更好?

I reorder the compiler optimization.

And I want to compare the performance of the output with gcc O3.

I have a test-suite.

How many cores do I need to use for benchmark?

I'm sure that the executable files of them are different.

And I use one single core to measure the run time of them, the time is similarly same.

But I don't limit the number of cores to measure the run time, the executable from my compiler is faster than gcc O3.

How can I determine which compiler is better?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

要走干脆点 2025-01-22 11:26:01

问题

当我想要对编译器的性能进行基准测试时,我需要使用多少个内核?


嗯,越多越好。正如您提到的,绝对不推荐使用单核。既然您提到了 gcc,那么您就必须研究 GCC 基准测试

然而,在前面提到的“越多越好”的背景下,请注意“收益递减法则”,正如本答案如下:

在基准测试战争中,各个制造商将投入尽可能多的核心/处理器/CPU 来解决问题。但总是存在(除了在一些非常奇怪的情况下)“收益递减定律”——第二个核心只会增加 60-80%,第三个核心会少于这个数字,等等(并且这假设了一个足够多的问题) -线程化以实际利用添加的核心。)因此,您不能查看给定的基准并假设两倍的核心将提供两倍的性能。事实上,在某些情况下,您可以将核心数量增加一倍,但实际上会降低性能。在高度多线程应用程序中实现良好的性能介于艺术和黑魔法之间。


Question

How many cores do I need to use when I want to benchmark the performance of my compiler?


Well, the more the merrier. Single-core as you mentioned is definitely not recommended. Since you have mentioned gcc, you have to look into GCC benchmarks.

However, in the context of aforementioned "the more the merrier" beware of "law of diminishing return" as rightly put by this answer below:

In the benchmark wars the individual manufacturers will will throw as many cores/processors/CPUs at the problem as they can be effective with. But there's always (except in some very weird circumstances) a "law of diminishing return" -- the second core will only add 60-80%, the third core less than that, etc. (And this assumes a problem that is sufficiently multi-threaded to actually make use of the added cores.) So you can't look at a given benchmark and assume that twice as many cores will provide twice the performance. In fact, in some cases you could double the number of cores and actually reduce performance. Achieving good performance in a highly multi-threaded application is somewhere between an art and black magic.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文