我们如何计算`MPI_graph_create`索引数组?

时间:2015-09-28 22:14:03

标签: c++ parallel-processing mpi distributed-computing

任何人都可以使用简单的简单英语来解释函数index

中的MPI_Graph_create(MPI_Comm comm_old, int nnodes, const int index[], const int edges[], int reorder, MPI_Comm *comm_graph)

我一直在分析MPI手册页中指定的MPI_Graph_create函数。我想念index[]的计算方式。该标准规定index变量是指节点的程度,这意味着从特定节点入射的边数。对于下面的邻接矩阵,标准具有index = 2, 3, 4, 6。基于邻接矩阵指定的边缘,我期待2 , 1 ,1 ,2

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

MPI标准的正确答案是: -

nnodes = 4
index  = 2,  3,  4,  6 
edges  = 1 ,3, 0, 3,  0 ,2

1 个答案:

答案 0 :(得分:2)

您理解正确,但写错了索引。也就是说,"答案" index= 2, 3, 4, 6index= 2, 1, 1, 2相同。

只需注意

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

您可以看到您对问题的理解与规范的答案相符。您所要做的就是总结您的版本,以便为MPI_Graph_create()提供所需的索引。