1 |
The routine MPI_Cart_create creates a Cartesian decomposition of the processes, with the number of dimensions given by the ndim argument. It returns a new communicator (in comm2d in example below) with the same processes as in the input communicator, but different topology.
|
2 |
ndim = 2;
|
3 |
dims[0] = 3; dims[1] = 4;
|
4 |
periods[0] = 0; periods[1] = 0; // periodic is false
|
5 |
reorder = 1; // reordering is true
|
6 |
ierr = MPI_Cart_create (MPI_COMM_WORLD, ndim,
|
7 |
dims, periods, reorder, &comm2d);
-
where reorder specifies that it's o.k. to reorder the default process rank in order to achieve a good embedding (with good communication times between neighbors).
|