By Dr. Mario Deilmann
A new tutorial document, Intel® Concurrent Collections in Action, has just been published and is available for download in its entirety. This tutorial presents a basic introduction into the world of Intel® Concurrent Collections (known as CnC). This introduction is targeted towards new users, who are in favor of a hands-on approach. It will step by step unveil the basic CnC concepts. By stepping through a simple example you will learn different and new ideas and see how the CnC tool chain can be applied to a given problem. CnC is a language and framework to express dependencies in applications and induce parallelism. With this walkthrough we want to show you how easy it is to think in CnC terms.
What is the basic difference between CnC and other parallel approaches? The CnC approach is a novel approach for designing software for parallelism. It overcomes the over-constraint nature of serial languages by providing a conclusive programming concept. This is done by adding a graph-based, data-flow model to the procedural serial program. While other approaches like OpenMP, TBB and Cilk abstract over threads or tasks, they still inherit nondeterministic problems like race conditions and deadlock. All these approaches are based on the idea of expressing parallelism by embedding concurrency within their serial semantics. Serial code requires a serial ordering. Even if there is no semantically required ordering, an arbitrary ordering must be chosen. Execution of the code in parallel often requires a complex analysis to determine if reordering is possible. Overwriting of memory locations makes this analysis difficult. The arbitrary serialization makes it difficult to uncover alternate valid executions either manually or automatically. For these reasons, embedding parallelism in serial code can limit both the language's effectiveness and its ease of use.
The design principle of the Concurrent Collections approach, however, abstracts over parallelism on the whole. The objective of Concurrent Collections is to make the programmer focus on the program semantics and not on using a certain parallel API, Library or language addition. It lets the programmer define the dependencies (or ordering constraints) between computational units. The programmer provides only the information, which is necessary to guarantee a correct program execution and deterministic results. But it requires not more than that, for example one can specify the order of computations (if semantically prescribed) but not the exact "when". The CnC approach doesn't require explicit parallelization techniques like synchronization primitives or message passing, and it provides an interface between the application semantics and the actual execution strategy. The CnC approach is very different in comparison to an imperative programming model. In an imperative programming model, the program is modeled as a series of operations, where the data paths between the different operations are almost invisible. This distinction may seem minor, but it allows the CnC model to be easily parallelized on multiprocessor systems.
The full CnC tutorial document may be downloaded here: CnC_In_Action.
You can find more material about CnC, including a free download for either Linux or Windows, here.
Refer to our Optimization Notice for more information regarding performance and optimization choices in Intel software products.