您是否在关注多核? [英] Are you concerned about multicore?

查看:92
本文介绍了您是否在关注多核?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是不可否认的:多核计算机将继续存在.

This is undeniable: multicore computers are here to stay.

这是这样:有效的多核编程非常困难.这不仅仅是了解pthread的情况.

So is this: efficient multicore programming is pretty difficult. It's not just a case of understanding pthreads.

这是有争议的:街头开发者"需要使他/她自己关注这些发展.

This is arguable: the 'developer on the street' need concern him/herself with these developments.

您在多大程度上担心必须扩展多核技能?您正在编写的软件是否适合并行化?如果是,您是否正在做任何事情来进行自我教育(如果您还不了解这些技术的话)?还是您相信操作系统将完成大部分工作,语言运行时将发挥应有的作用,您的应用程序将快乐地坐在一个内核上,而让其他人来做自己的事情?

To what extent are you concerned about having to expand your skillset for multicore? Is the software you are writing a candidate for parallelisation, and if so are you doing anything to educate yourself (if you didn't already know the techniques)? Or do you believe that the operating system will take care of most of it, the language runtime will do its bit and your application will happily sit on one core and let the others do their thing?

推荐答案

您的程序通常受CPU约束吗?

Are your programs typically CPU bound?

如果没有,就算了.它与您无关,并为您的用户提供了更流畅的体验,而对您完全没有任何要求.

If not, forget it. It doesn't concern you, and gives your users a smoother experience without making any demands on you at all.

很酷,是吗?

如果您受CPU限制,并且您的问题是可并行化的,则您也许可以利用多个内核.是时候开始担心它了.

If you are CPU bound, and your problem is parallelizable, you might be able to leverage the multiple cores. That's the time to start worrying about it.

从评论中:

建议改善答案:给出粗略的解释 如何判断您的程序是否受CPU限制. –柳条人

Suggestion for improving answer: give rough explanation of how to tell if your program is CPU bound. – Earwicker

CPU限制意味着阻止程序更快运行的原因是缺乏计算能力.与 IO绑定(有时与网络绑定)进行比较.主板和处理器的选择不当也会导致计算机受内存限制(是的,我在查看 you ,alpha).

CPU bound means that the thing preventing the program from running faster is a lack of computational horse-power. Compare to IO bound (or sometimes network bound). A poor choice of motherboard and processor can result in machines being memory bound as well (yes, I'm looking at you, alpha).

因此,您将不时需要知道程序在做什么(以及机器的繁忙程度...).要在类似Unix的系统上进行查找,请运行top.在Windows上使用taskmanager(感谢Roboprog).

So you'll need to know what your program is doing from moment to moment (and how busy the machine is...) To find out on a unix-like systems run top. On windows use the taskmanager (thanks Roboprog).

在每核负载小于1的计算机上(即,当您不做任何事情时为台式计算机),受CPU约束的进程将始终拥有超过50%的处理器(通常超过90%) ).当平均负载高于平均负载时(例如,您有3个编译器SETI @ home,并且有2个对等网络在后台运行),与CPU绑定的进程将有很大一部分(# of cores)/(load average).

On a machine with a load less than 1 per core (i.e. your desktop machine when you're not doing much of anything), a CPU bound process will consistently have more that 50% of a processor (often more than 90%). When the load average is higher than that (i.e. you have three compiles, SETI@home, and two peer-to-peer networks running in the background) a CPU bound process will have a large fraction of (# of cores)/(load average).

这篇关于您是否在关注多核?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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