1.1 Case Study: Trapezoidal Program

Under this guide, you can find how to apply MPI in a real world problem

What is the trapezoidal rule?

Recall in calculus, we can use the area of trapezoids to estimate the area under a curve/function, this is commonly used in all mathematics such as integrals, cumulative distribution functions, etc. We want to build a program that exploits the advantage of parallelism and calculate thousands of trapezoids for a specific function

figure 1.1
figure 1.2

Pseudo-code for a serial program

Parallelizing the Trapezoidal Rule

  1. Partition problem solutions into tasks – As many tasks as possible.

  2. Identify communication channels between tasks.

  3. Aggregate tasks into composite tasks.

  4. Map composite tasks to cores.

Suppose we have 4 processes, we can assign equal amounts of tasks evenly to all processes, then add them up in the end

Tree

We can also treat each process as a tree node, when all the nodes are finished, they can start assembling the final result to the master node

1.3

Last updated