sw/lib/mpi/mpi_comm.c
// create a new group with the given ranks
create a new group with the given ranks
create a new group with the given ranks
int MPI_Group_incl(MPI_Group group, int n, const int ranks[], MPI_Group *new)
{
    if (n==0) {
        *new = MPI_GROUP_EMPTY;
    } else {
        unsigned i;
        MPI_Group g = malloc(2*n+2); 
        g->size = n;
        if (group==_MPI_GROUP_WORLD) {
            for (i=0; i<n; i++) g->cids[i] = ranks[i];
        } else {
            for (i=0; i<n; i++) g->cids[i] = group->cids[ranks[i]];
        }
        *new = g;
    }
    return MPI_SUCCESS;
}
int MPI_Group_incl ( MPI_Group group , int n , const int ranks [ ] , MPI_Group * new ) { if ( n == 0 ) { * new = MPI_GROUP_EMPTY ; } else { unsigned i ; MPI_Group g = malloc ( 2 * n + 2 ) ; g -> size = n ; if ( group == _MPI_GROUP_WORLD ) { for ( i = 0 ; i < n ; i ++ ) g -> cids [ i ] = ranks [ i ] ; } else { for ( i = 0 ; i < n ; i ++ ) g -> cids [ i ] = group -> cids [ ranks [ i ] ] ; } * new = g ; } return MPI_SUCCESS ; }
create a new group with the given ranks
create a new group with the given ranks
// hardcoded!