Scientific Computing & Visualization
Help Contact
About Accounts Computation Visualization Documentation Services

Multiprocessing by Message Passing MPI

The five basic examples in this group are all based on a single application: numerical integration. Numerical integration is chosen because it is trivially parallelizable and at the same time a problem that is very narrowly focused. The same application is employed in each example; different MPI library routines, however, are used. In addition, disadvantages with the use of specific MPI functionalities are pointed out in each example and are remedied in the next example. Hence, improvements in implementation proficiency can be seen from example to example.

If you have not deal with numerical integration before, please spend a few minutes getting familiar with the integration procedure illustrated below. If you are familiar with it, please spend the necessary time to be acquainted with the terminologies and variable names used before going to the parallel application examples.

Example 1. Numerical Integration

The example application is to integrate cosine(x) from a to b numerically. There are various ways to perform numerical integrations of this type. Among them, the Mid-point rule is the least accurate but is chosen nevertheless for its simplicity. Essentially, the integrand, cox(x), is assumed to be constant within the upper and lower limit of integration and is taken to be the mid-point between the limits.

Normally, the integration range need only be divided into a series of smaller intervals so that the mid-point rule can be applied. Here, the integration range is first divided into a series of "partitions", each of which is assigned to a processor. Each processor will then subdivide its own sub-range into smaller segments for mid-point rule integration. The final integral sum is obtained by adding the integral sums from all processors. For single processor, the number of partitions is set to unity and the sub-range is the full range, from a to b.

Example 1 Fortran code

Example 1. C code

Example 1  | Example 1.1 | Example 1.2 | Example 1.3 | Example 1.4 | Example 1.5

Boston University
Boston University
 
OIT | CCS | July 17, 2008  
Scientific Computing & Visualization Boston University home page Boston University home page