Assignment
Due date: Thursday, May 18th (2023) at 11:55 pm.
Log into Teach login node, teach01, with your lcl_uothpc383sNNNN temporary account (NNNN are integer numbers unique to your account) and copy the course material to your scratch directory:
$ ssh -Y lcl_uothpc383sNNNN@teach.scinet.utoronto.ca
(Send me a message if you have not received an email with these instructions yet!)
and copy the course material to your scratch directory:
$ 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 # if you see errors, most probably you didn't set up your environment properly. This line is just a reminder to source your setup if you have not done so yet.
$ make diffusion2dc
$ ./diffusion2dc
And 2D diffusion equation parallel code so you get familiar with their solutions:
$ make diffusion2dc-mpi-nonblocking
$ mpirun -np 4 ./diffusion2dc-mpi-nonblocking # or srun
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. Use srun to allocate compute node resources instead of running it on the login node.
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.