Assignment

Due date: Thursday, October 28th (2021) at 11:55 pm.

Log into Teach login node, teach01, with your Compute Canada account credentials or your lcl_uothpc383sNNNN temporary account and copy the course material to your scratch directory:

$ ssh -Y USER@teach.scinet.utoronto.ca

$ cd $SCRATCH

$ cp -r /scinet/course/mpi/advanced-mpi .

$ cd advanced-mpi

$ source setup

Inspect 2D diffusion equation serial code:

$ cd $SCRATCH/advanced-mpi/diffusion2d

    $ # source ../setup

    $ make diffusion2dc

    $ ./diffusion2dc

And 2D diffusion equation parallel code so you get familiar with their solutions:

    $ make diffusion2dc-mpi-nonblocking

    $ # or srun 

    $ mpirun -np 4 ./diffusion2dc-mpi-nonblocking

Part I: Use MPI derived datatypes instead of packing and unpacking the data manually:

$ cp diffusion2dc-mpi-nonblocking.c diffusion2dc-mpi-nonblocking-datatype.c

Build with "make diffusion2dc-mpi-nonblocking-datatype"

Test on 4..9 processors

Part II: Use MPI Cartesian topology routines to map the 2D cartesian grid of the diffusion equation domain into a 2D layout of processes. Get rid of the manually done mapping:

$ cp diffusion2dc-mpi-nonblocking-datatype.c diffusion2dc-mpi-nonblocking-carttopo.c

Build with "make diffusion2dc-mpi-nonblocking-carttopo"

Submit your two solutions, diffusion2dc-mpi-nonblocking-datatype.c and diffusion2dc-mpi-nonblocking-carttopo.c, to this website.

Tips: 

  • Switch off graphics (in Makefile, change "USEPGPLOT=-DPGPLOT" to "USEPGPLOT=")
  • Get familiar with the serial code in 2D and review the 1D one if needed.
  • If you get stuck debugging, try to decrease the problem size and the number of steps.