mpich icon indicating copy to clipboard operation
mpich copied to clipboard

comm: Segmentation fault in MPI_Intercomm_create_from_groups

Open geimer opened this issue 2 years ago • 1 comments

According to MPI 4.1 (Section 7.6, p. 355), MPI_Intercomm_create_from_groups should be a local operation and return MPI_COMM_NULL if MPI_GROUP_EMPTY is supplied as the local_group or remote_group or both. However, MPICH 4.2.0rc2 crashes with a segmentation fault in this case. Please find a minimal reproducer below. (Note that this is the "extreme" case with both groups being empty. The segfault also occurs if one of the two groups is non-empty.)

#include <mpi.h>

int main(int argc, char** argv)
{
    MPI_Init(&argc, &argv);

    MPI_Comm newcomm;
    MPI_Intercomm_create_from_groups(MPI_GROUP_EMPTY, 0,
                                     MPI_GROUP_EMPTY, 0,
                                     "42",
                                     MPI_INFO_NULL,
                                     MPI_ERRORS_ARE_FATAL,
                                     &newcomm);
    if (newcomm != MPI_COMM_NULL)
    {
        MPI_Comm_free(&newcomm);
    }
    MPI_Finalize();

    return 0;
}

geimer avatar Feb 09 '24 11:02 geimer

Thanks for the bug report. Fixed in #6903.

hzhou avatar Feb 09 '24 15:02 hzhou