In this exercise, you should parallelize the two dimensional heat equation with hybrid MPI + OpenMP parallelization. Starting point is a working MPI code parallelized over columns (in Fortran) or rows (in C/C++). See Code description for some theory and more details about the code.
Here, parallel regions are only within the computational routines and all the MPI communication is handled by the master process. Your tasks are thus:
- Initialize MPI with appropriate thread safety level
- Determine the number of threads in the main routine (cpp/main.cpp or fortran/main.F90)
- Parallelize the generation of initial temperature in the routine
generate_field()
(in fortran/setup.F90) or in thegenerate()
method (in cpp/heat.cpp - Parallelize the main computational routine
evolve()
in cpp/core.cpp or fortran/core.F90
Now, there is only one parallel region (within the main routine), however, MPI communication in the halo exchange is still done only by one thread (but not necessarily master).
- Initialize MPI with appropriate thread safety level
- Insert apprioriate OpenMP directives thoughtout the code
To build the code, please use the provided Makefile
(by typing make
). By default, GNU
compiler is used, in order to use Intel compiler type make COMP=intel
.