使用不同数量的多核工作线程时的不同行为
我正在摆弄我的程序(尝试对几个部分进行多核处理),我注意到“CPU 历史记录”看起来有点不同,具体取决于我启动了多少个工作进程。 2-4 个工作人员似乎会产生“稳定”的工作流程,但是固定 5-8 个工作人员会产生不稳定的行为(从零到最大,请参见图片)。我应该指出,所有运行都以“平滑”最大容量开始(例如,2 个核心只有 25%),并且仅在一分钟左右后才开始表现出不稳定的行为。 这是怎么回事?我有 4 核处理器,您认为这种行为可能与此事实有关吗?
我希望你能看到这些照片。
2名工人
3 名工人
4 名工人
5 名工人
6 名工人
7 名工人
8 名工人
I am playing around a bit with my program (trying to multicore a few parts) and I've noticed the "CPU history" looks a bit different, depend on how many workers I start. 2-4 workers seems to produce a "stable" workflow, however pegging 5-8 workers produces erratic behavior (from zero to max, see pictures). I should point out that all runs started out with "smooth" max capacity (e.g. 2 cores with only 25%), and started to exhibit erratic behavior only after a minute or so.
What's going on? I have 4 core processor, and do you think this behavior may be related to this fact?
I hope you can see the pics.
2 workers
3 workers
4 workers
5 workers
6 workers
7 workers
8 workers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是具有超线程的四核上的经典行为。 R 并没有通过超线程获得优势,因为它经常使用完整的核心来进行计算。因此,如果一个物理处理器产生 2 个逻辑 1,则该处理器必须在两个线程之间连续切换,这解释了这些模式。
对于 R,我推迟了计算机上的超线程。相反,它只是没有帮助。当像 R 通常那样只使用一个线程时,您会损失容量(最大值为 12.5%,而不是 25%)。
This is classic behaviour on a quad-core with hyperthreading. R doesn't gain with hyperthreading, as it uses often the complete core for the calculations. Thus, if one physical processor makes 2 logical ones, the processor has to switch continuously between both threads, which explains the patterns.
For R, I put off the hyperthreading on my computer. It just doesn't help, in contrary. When working with only one thread as R does normally, you lose capacity (max is 12.5% instead of 25%).