Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: [OMPI devel] MPI_Group_compare is broken
From: Geoffrey Irving (irving_at_[hidden])
Date: 2009-05-07 18:20:39


Hello,

MPI_Group_compare is broken in both 1.3.2 and svn. Here is a patch
which fixes the problem:

diff --git a/ompi/mpi/c/group_compare.c b/ompi/mpi/c/group_compare.c
index 0d199c1..89c83f9 100644
--- a/ompi/mpi/c/group_compare.c
+++ b/ompi/mpi/c/group_compare.c
@@ -106,6 +106,7 @@ int MPI_Group_compare(MPI_Group group1, MPI_Group
group2, int *result) {
         } /* end proc2 loop */
         if( match== -1 ) {
             similar=false;
+ identical=false;
             break;
         }
     } /* end proc1 loop */

and a C test program which illustrates it:

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

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

    MPI_Group group;
    MPI_Comm_group(MPI_COMM_WORLD, &group);

    int r1[2] = {0, 1};
    int r2[2] = {1, 2};
    MPI_Group g1, g2;
    MPI_Group_incl(group, 2, r1, &g1);
    MPI_Group_incl(group, 2, r2, &g2);

    int cmp;
    MPI_Group_compare(g1, g2, &cmp);
    printf("compare %d, ident %d\n", cmp, MPI_IDENT);
    assert(cmp != MPI_IDENT);

    MPI_Finalize();
    return 0;
}

A quick glance through the history (thanks git log -pM --follow) seems
to indicate that MPI_Group_compare hasn't ever worked in OpenMPI, so
apparently I'm the only user of this function. :)

Geoffrey