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.
开发者_如何学GoI've learned that since VS2010, Microsoft provide a similar library, Parallel Processing Library, that have (almost) the same interface than Intel 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.
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?
TBB is a superset of PPL (as in VS2010), so it provides all PPL API plus its own APIs that PPL does not have.
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.
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.
精彩评论