I have a 16 processes and each process is randomizing a number.
I created a cartesian topology for the processes and now I know what are the coordinates of each rank (process).
I wonder where is the "matrix", how can I get the value of each process in the cartesian topolgy?
here is the code:
int dim[2],period[2],coord[2],reorder,myValue;
dim[0] = 4; dim[1] = 4;
period[0] = 1; period[1] = 0;
reorder = 1;
myValue = rand() % 100 + 1;
MPI_Cart_create(MPI_COMM_WORLD,2,dim,period,reorder,&comm);
if (rank == 0) // root
{
//prints the coordinates of each process , i = process rank
for (int i = 0 ; i < DIM*DIM; i++)
{
MPI_Cart_coords(comm,i,2,coord);
cout << coord[0] << coord[1] << i << endl;
}
}