2

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;
}
4

1 に答える 1

3

MPI_Comm_create()MPI_COMM_NULLグループ外のすべてのプロセスに戻ります。に渡そうMPI_COMM_NULLとしていますがMPI_Comm_free()、これは許可されていません。

于 2012-09-29T03:10:48.480 に答える