您今天推荐什么并行编程模型来利用明天的众核处理器? [英] What parallel programming model do you recommend today to take advantage of the manycore processors of tomorrow?
问题描述
如果您今天从头开始编写一个新应用程序,并希望它扩展到明天可以投入的所有内核,您会选择哪种并行编程模型/系统/语言/库?为什么?
If you were writing a new application from scratch today, and wanted it to scale to all the cores you could throw at it tomorrow, what parallel programming model/system/language/library would you choose? Why?
我对这些轴上的答案特别感兴趣:
I am particularly interested in answers along these axes:
- 程序员生产力/易用性(凡人能成功使用吗?)
- 目标应用领域(它(不)擅长什么问题?)
- 并发风格(它是否支持任务、管道、数据并行、消息...?)
- 可维护性/面向未来(20 年后还会有人使用它吗?)
- 性能(它如何在何种硬件上扩展?)
我故意对应用程序的性质含糊其辞,以期获得对各种应用程序有用的良好的通用答案.
I am being deliberately vague on the nature of the application in anticipation of getting good general answers useful for a variety of applications.
推荐答案
多核编程实际上可能需要不止一种范式.目前的一些竞争者是:
Multi-core programming may actually require more than one paradigm. Some current contenders are:
- MapReduce.这适用于可以轻松将问题分解为并行块的问题.
- 嵌套数据并行.这类似于 MapReduce,但实际上支持问题的递归分解,即使递归块的大小不规则.期待 NDP 在运行在大规模并行但有限的硬件(如 GPU)上的纯函数式语言中取得巨大成功.
- 软件事务内存.如果您需要传统线程,STM 让它们变得可以忍受.您在关键部分付出了 50% 的性能损失,但您可以轻松地将复杂的锁定方案扩展到数百个处理器.但是,这不适用于分布式系统.
- 具有消息传递的并行对象线程.Erlang 使用了这个非常聪明的模型.每个对象"成为一个轻量级线程,对象通过异步消息和模式匹配进行通信.它基本上是真正的并行 OO.这在几个现实世界的应用程序中取得了很好的成功,并且非常适用于不可靠的分布式系统.
- MapReduce. This works well where a problem can be easily decomposed into parallel chunks.
- Nested Data Parallelism. This is similar to MapReduce, but actually supports recursive decomposition of a problem, even when the recursive chunks are of irregular size. Look for NDP to be a big win in purely functional languages running on massively parallel but limited hardware (like GPUs).
- Software Transactional Memory. If you need traditional threads, STM makes them bearable. You pay a 50% performance hit in critical sections, but you can scale complex locking schemes to 100s of processors without pain. This will not, however, work for distributed systems.
- Parallel object threads with messaging. This really clever model is used by Erlang. Each "object" becomes a lightweight thread, and objects communicate by asynchronous messages and pattern matching. It's basically true parallel OO. This has succeeded nicely in several real-world applications, and it works great for unreliable distributed systems.
其中一些范例可以为您提供最高性能,但只有在问题完全分解时才有效.其他人牺牲了一些性能,但允许更广泛的算法.我怀疑上述的某种组合最终会成为一个标准的工具包.
Some of these paradigms give you maximum performance, but only work if the problem decomposes cleanly. Others sacrifice some performance, but allow a wider variety of algorithms. I suspect that some combination of the above will ultimately become a standard toolkit.
这篇关于您今天推荐什么并行编程模型来利用明天的众核处理器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!