Exercise: Subcommunicator
In this exercise we show how MPI_Comm_split can be used to create a new communicator from an already available communicator. It is a collective call and all processes of the parent communicator (group) must call it.
- In the directory Subcommunicator, there are f and c subdirectories for Fortran and C, respectively. If you have loaded the modules as described in exercise Hello, compilers and MPI wrappers are ready for use. The compilations should be carried out using mpiicpc and mpiifort for C++ and Fortran, respectively.
- This code splits MPI_COMM_WORLD into 3 groups leading to 3 new communicators.
- You can execute it as
$ mpirun -n 10 ./a.out |sort -n -k1 |awk -f ../../utils/separator.awk
- What are the numbers in the first column?
Last modified: Tuesday, 2 April 2024, 2:47 PM