Center for High Performance Computing (CHPC)


A (very) Brief Introduction to MPI

The following examples are intended to give a (very) brief introduction to the Message-Passing Interface (MPI).  A sample piece of code is presented followed by a parallelized version. The extra code needed for parallelization is then explained.  The codes presented should not be considered as good examples of either coding or numerical methods.  They merely serve as an introduction to MPI.

A Toy Problem

We'll approximate a simple integral using a Monte Carlo technique. Monte Carlo uses the approximation:


The integral that we will try to solve numerically is:


Fortran | C