In this assignment you reimplement the heat diffusion exercise from Assignment 4 in MPI.

Implementation

Implement in C using MPI a program called diffusion that

  1. Reads array size and initial values from a text file called "init".
  2. Executes a given number of steps of heat diffusion with given diffusion constant, and
  3. Outputs the average of temperatures, say X, as average: X.
  4. Outputs the average absolute difference of each temperature to the average of all temperatures, say Y, as average absolute difference: Y.

As in Assignment 4, we will mostly neglect numerical accuracy.

Your program should accept command line arguments

mpirun -n 1 ./diffusion -n20 -d0.02

to compute 20 iterations with diffusion constant 0.02. You may only use MPI parallelism.