【问题标题】:A very strange behaviour of MPIMPI的一个非常奇怪的行为
【发布时间】:2012-09-20 21:17:28
【问题描述】:

我在使用 MPI 时遇到了一个非常奇怪的错误。无法删除成功创建的通讯器。删除尝试会在所有节点上导致 FATAL ERROR,但通信器组中包含的节点除外。最小的工作示例如下。您如何看待这种奇怪行为的原因?

#include <stdio.h>
#include <mpi.h>

int main(int argc, char* argv[])
{
    MPI_Group group_world;              // group of MPI_COMM_WORLD
    MPI_Group group_new;                // new group
    MPI_Comm  comm_new;                 // new communicator 
    int group_new_ranks[3]={10,20,30};  // new communicator's ranks 

    MPI_Init(&argc, &argv);

    MPI_Comm_group(MPI_COMM_WORLD, &group_world);                 // get group_world - MPI_SUCCESS for all nodes
    MPI_Group_incl(group_world, 3, group_new_ranks, &group_new);  // get new group - MPI_SUCCESS for all nodes
    MPI_Comm_create(MPI_COMM_WORLD, group_new, &comm_new);        // create new communicator - MPI_SUCCESS for all nodes

    MPI_Comm_free(&comm_new);   // FATAL ERROR for all nodes except 10, 20, 30
    MPI_Group_free(&group_new);
    MPI_Group_free(&group_world);

    MPI_Finalize();
    return 0;
}

【问题讨论】:

    标签: mpi


    【解决方案1】:

    MPI_Comm_create()MPI_COMM_NULL 返回给不在组内的所有进程。您将MPI_COMM_NULL 传递给MPI_Comm_free(),这是不允许的。

    【讨论】:

      猜你喜欢
      • 2018-04-02
      • 2016-03-13
      • 2011-03-01
      • 2020-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-20
      • 2020-02-09
      相关资源
      最近更新 更多