【问题标题】:How do we compute the `MPI_graph_create` index array?我们如何计算 `MPI_graph_create` 索引数组?
【发布时间】:2015-09-28 22:14:02
【问题描述】:

谁能用通俗易懂的英文解释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

【问题讨论】:

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


    【解决方案1】:

    您理解正确,但索引编写错误。也就是说,“答案”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() 提供它想要的索引。

    【讨论】:

    • 哇,这是一个非常直截了当的算法,简而言之:- index [ i ] = incident_edges_at[ i ] + incident_edges_at[ i - 1 ] for all i > 0,否则 index [ i ] = incident_edges_at[ i ] ,即对于 i==0 如果我理解正确?
    • 我会在算法上将它写成index[i] = sum( incident_edges_at[j], for all j <= i )。但我认为这就是你的意思,所以是的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-03
    • 2010-11-29
    • 1970-01-01
    • 2014-09-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多