Jump to content

Parallel Patterns Library

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by MargRhi (talk | contribs) at 15:09, 26 August 2011 (PPL is native, not .NET. Added an example.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The Parallel Patterns Library is a Microsoft library designed for use by native C++ developers that provides features for multicore programming.[1] It was first bundled with Visual Studio 2010. It resembles the Standard Library in style and works well with the C++11 language feature, lambdas, also introduced with Visual Studio 2010.

For example, this sequential loop:

  for (int x=0; x < width; ++x)
  {
     //Something parallelizable
  }

Can be made into a parallel loop by replacing the for with a parallel_for:

  #include <ppl.h>
  // . . .
 Concurrency::parallel_for (0, width, [=](int x)
 {
     //Something parallelizable
 });

This still requires the developer to know that the loop is parallelizable, but all the other work is borne by the library.


References

  1. ^ "The Visual C++ Weekly". March 12, 2011.