X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/aedc7f54098826e18dc8c2bf32594e9baeb3832f..bdebd1432527a032fe2a9141bc1ced07cfc083dc:/src/smpi/smpi_group.c diff --git a/src/smpi/smpi_group.c b/src/smpi/smpi_group.c index 921f71910e..e9ab955515 100644 --- a/src/smpi/smpi_group.c +++ b/src/smpi/smpi_group.c @@ -155,3 +155,25 @@ int smpi_group_compare(MPI_Group group1, MPI_Group group2) } return result; } + +int smpi_group_incl(MPI_Group group, int n, int* ranks, MPI_Group* newgroup) +{ + int i=0, index=0; + if (n == 0) { + *newgroup = MPI_GROUP_EMPTY; + } else if (n == smpi_group_size(group)) { + *newgroup = group; + if(group!= smpi_comm_group(MPI_COMM_WORLD) + && group != MPI_GROUP_NULL + && group != smpi_comm_group(MPI_COMM_SELF) + && group != MPI_GROUP_EMPTY) + smpi_group_use(group); + } else { + *newgroup = smpi_group_new(n); + for (i = 0; i < n; i++) { + index = smpi_group_index(group, ranks[i]); + smpi_group_set_mapping(*newgroup, index, i); + } + } + return MPI_SUCCESS; +}