Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do we compute the `MPI_graph_create` index array?

Can anyone use plain simple English to explain how index in function MPI_Graph_create(MPI_Comm comm_old, int nnodes, const int index[], const int edges[], int reorder, MPI_Comm *comm_graph)

I have been analyzing the MPI_Graph_create function as specified in the MPI man pages. I miss the way index[] is computed. The standard specifies that index variable refers to the degree of the nodes which means a count of edges incident from the particular node . For the adjacency matrix below, the standard has index = 2, 3, 4, 6 . I was expecting 2 , 1 ,1 ,2 based on the edges specified n the adjacency matrix.

Process  Neighbors
0         1,3
1         0
2         3
3         0,2

Correct answers from the MPI standard are :-

nnodes = 4
index  = 2,  3,  4,  6 
edges  = 1 ,3, 0, 3,  0 ,2
like image 981
Walker Avatar asked Apr 09 '26 18:04

Walker


1 Answers

You understand it correctly, but are writing the indices incorrectly. That is, the "answer" index= 2, 3, 4, 6 is identical to index= 2, 1, 1, 2.

Simply notice that

2 = 2
3 = 2 + 1
4 = 2 + 1 + 1
6 = 2 + 1 + 1 + 2

and you can see how your understanding of the problem matches up with the specification's answer. All you have to do is sum up your version in order to give MPI_Graph_create() the indices it wants.

like image 171
NoseKnowsAll Avatar answered Apr 12 '26 09:04

NoseKnowsAll



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!