Chapter 4: Message Passing Parallel PatternletsΒΆ

As we introduced in Chapter 1, Parallel programs contain patterns: code that recurs over and over again in solutions to many problems. The following examples show very simple examples of small portions of these patterns that can be combined to solve a problem. These C code examples use the Message Passing Interface (MPI) library, which is suitable for use on either a single multiprocessor machine or a cluster of machines.

In Chapter 1 we introduced these most common Strategy Patterns:


And these councurrent hoardware patterns:


In these diagrams, the patterns with a gray background are found exclusively in MPI. The white boxes are patterns that are found in both, as are the boxes that are half orange and half gray. We will demonstrate examples of those patterns that pertain to MPI in this chapter. Note that in MPI, the basic unit of execution is a process, so inherent in every MPI example is the process creation and destruction pattern found in the Concurrent Hardware Patterns under Execution Units in the diagram above. In addition, the CPU architecture used by MPI is MIMD.

All of the code examples in this chapter were originally written by Joel Adams of Calvin University.

If you are working on these for the first time, you may want to visit them in order. If you are returning to review a particular patternlet or the pattern category from the diagrams, you can go to that category linked below.

You have attempted of activities on this page