This page imported from: /afs/bu.edu/cwis/webuser/web/s/c/scv/documentation/tutorials/MPI/alliance/virtual_topology/cart_sub_example1.html

MPI_Cart_sub Example 1

MPI_Cart_sub Example 1.


Example in Fortran

For a 2D cartesian grid, create column subgrids, then let the last
members of each column (subgrid) to gather data from their
respective members.



unix-prompt% mpirun -np 6 cart_sub_example1 produces
the following output:


      MPI_Cart_sub example:
  3x2 cartesian grid ==> 2 (3x1) column subgrids

   Iam     2D      2D          1D       1D      aij
  Rank   Rank    coords.     Rank  coords.
     0|     0|     0     0|     0|       0|    -1    -1    -1
     3|     3|     1     1|     1|       1|    -1    -1    -1
     1|     1|     0     1|     0|       0|    -1    -1    -1
     5|     5|     2     1|     2|       2|    12    22    32
     4|     4|     2     0|     2|       2|    11    21    31
     2|     2|     1     0|     1|       1|    -1    -1    -1