There's more...

To obtain a toroidal topology of the size M×N, let's use comm.Create_cart again, but, this time, let's set the periods parameter to periods=(True,True):

cartesian_communicator = comm.Create_cart( (grid_row, grid_column), 
                                 periods=(True, True), reorder=True) 

The following output is obtained:

C:>mpiexec -n 4 python virtualTopology.py
Process = 3 row = 1 column = 1
---->
neighbour_processes[UP] = 1
neighbour_processes[DOWN] = 1
neighbour_processes[LEFT] =2
neighbour_processes[RIGHT]=2

Process = 1 row = 0 column = 1
---->
neighbour_processes[UP] = 3
neighbour_processes[DOWN] = 3
neighbour_processes[LEFT] =0
neighbour_processes[RIGHT]=0

Building a 2 x 2 grid topology:
Process = 0 row = 0 column = 0
---->
neighbour_processes[UP] = 2
neighbour_processes[DOWN] = 2
neighbour_processes[LEFT] =1
neighbour_processes[RIGHT]=1

Process = 2 row = 1 column = 0
---->
neighbour_processes[UP] = 0
neighbour_processes[DOWN] = 0
neighbour_processes[LEFT] =3
neighbour_processes[RIGHT]=3

The output covers the topology represented here:

The virtual toroidal 2x2 topology

The topology represented in the previous diagram indicates that the P0 process is chained to the P1 (RIGHT and LEFT) and P2 (UP and DOWN) processes, the P1 process is chained to the P3 (UP and DOWN) and P0 (RIGHT and LEFT) processes, the P3 process is chained to the P1 (UP and DOWN) and P2 (RIGHT and LEFT) processes, and the P2 process is chained to the P3 (LEFT and RIGHT) and P0 (UP and DOWN) processes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.10.137