本文介绍了英特尔TBB和Microsoft PPL之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划开始播放基于任务的并行性的跨平台项目。我想使用英特尔线程构建块。我从Windows和Visual Studio开始。

I'm planning to start "playing" with task-based parallelism for a cross-platform project. I wanted to use Intel Threading Building Blocks. I'm starting with Windows and Visual Studio.

由于我只想要原型,我正在考虑只在窗口播放,然后有足够的

As I just want to prototype for the moment, I'm thinking about "playing" only on windows, then have enough knowledge to use the library on all compatible platforms.

我知道自从VS2010以来,Microsoft提供了一个类似的库,并行处理库,它们(几乎)是相同的

I've learned that since VS2010, Microsoft provide a similar library, Parallel Processing Library, that have (almost) the same interface than Intel TBB.

有些来源建议,包括TBB的团队博客,他们建立在一起,它是同一个图书馆。

Some sources suggest, including TBB's team blog, that they build it together and that it's the same library.

但是它不是很明确,因为它往往暗示两个库之间有微小的差异。

However its not really explicit because it's often suggested that there are minor differences between the two libraries.

那么,如果有的话?我应该直接从最后一个稳定的ITBB开始,还是低风险只是在原型中使用Microsoft PPL并在跨平台的真实项目中使用ITBB?

So, what are those differences, if any? Should I start directly with last stable ITBB or is it low-risk to just play with Microsoft PPL in prototypes and use ITBB on the cross-platform "real" project?

推荐答案

是(如在VS2010中),因此它提供了所有PPL API以及PPL没有的自己的API。

TBB is a superset of PPL (as in VS2010), so it provides all PPL API plus its own APIs that PPL does not have.

请注意,在VS2010中还包含并发运行时(ConcRT,在其上构建PPL)的API,异步代理等。TBB没有大部分,虽然它有一些(例如 critical_section )。作为异步代理的替代方案,最新版本的TBB功能。

Note that namespace Concurrency in VS2010 also contains APIs of Concurrency Runtime (ConcRT, on top of which PPL is built), Asynchronous Agents and etc. TBB does not have most of that, though it has some (e.g. critical_section). As an alternative to Asynchronous Agents, the recent version of TBB features the new flow graph API.

理论上,要从PPL切换到TBB,只需要替换从ppl.h所在的路径(使用TBB,头在 < tbbdir> / include / tbb / compat )并且当然与TBB DLL链接。但在这种情况下,您将仅限于PPL API。要使用PPL中不存在的额外TBB API(例如 parallel_pipeline parallel_reduce concurrent_priority_queue 等),你需要从一开始就使用TBB。

In theory, to switch from PPL to TBB, you just need to replace a path from where you take ppl.h (with TBB, the header comes in <tbbdir>/include/tbb/compat) and of course link with the TBB DLL. However in this case you will be limited to PPL API. To use the "extra" TBB API that does not exist in PPL (such as parallel_pipeline, parallel_reduce, concurrent_priority_queue and other), you need to work with TBB from the very beginning.

这篇关于英特尔TBB和Microsoft PPL之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 12:55