From: Augustin Degomme Date: Mon, 18 Aug 2014 11:38:00 +0000 (+0200) Subject: Fix [#17799] : have mpi_group_range_incl and mpi_group_range_excl better test some... X-Git-Tag: v3_12~850^2~15 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b0530df111c7b3c15a0d99491ae453258251bb9a Fix [#17799] : have mpi_group_range_incl and mpi_group_range_excl better test some corner cases. Two tests added : that the rank is in the right range at all times, and that we don't go after the last one wanted. Hopefully this will be enough to cover all cases. Test commcreate1 from mpich 3 testsuite has been confirmed to pass with one process The test with 1 process has been added to the test suite (it was with 8 processes before) --- diff --git a/src/smpi/smpi_pmpi.c b/src/smpi/smpi_pmpi.c index 9a52cc9aa4..ed24e85576 100644 --- a/src/smpi/smpi_pmpi.c +++ b/src/smpi/smpi_pmpi.c @@ -551,10 +551,12 @@ int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3], size = 0; for (i = 0; i < n; i++) { for (rank = ranges[i][0]; /* First */ - rank >= 0; /* Last */ + rank >= 0 && rank < smpi_group_size(group); /* Last */ ) { size++; - + if(rank == ranges[i][1]){/*already last ?*/ + break; + } rank += ranges[i][2]; /* Stride */ if (ranges[i][0] ranges[i][1]) @@ -570,11 +572,14 @@ int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3], j = 0; for (i = 0; i < n; i++) { for (rank = ranges[i][0]; /* First */ - rank >= 0; /* Last */ + rank >= 0 && rank < smpi_group_size(group); /* Last */ ) { index = smpi_group_index(group, rank); smpi_group_set_mapping(*newgroup, index, j); j++; + if(rank == ranges[i][1]){/*already last ?*/ + break; + } rank += ranges[i][2]; /* Stride */ if (ranges[i][0] ranges[i][1]) @@ -612,10 +617,12 @@ int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3], size = smpi_group_size(group); for (i = 0; i < n; i++) { for (rank = ranges[i][0]; /* First */ - rank >= 0; /* Last */ + rank >= 0 && rank < smpi_group_size(group); /* Last */ ) { size--; - + if(rank == ranges[i][1]){/*already last ?*/ + break; + } rank += ranges[i][2]; /* Stride */ if (ranges[i][0] ranges[i][1]) @@ -635,14 +642,17 @@ int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3], while (newrank < size) { add=1; for (i = 0; i < n; i++) { - for (rank = ranges[i][0];rank >= 0;){ + for (rank = ranges[i][0]; + rank >= 0 && rank < smpi_group_size(group); + ){ if(rank==oldrank){ add=0; break; } - + if(rank == ranges[i][1]){/*already last ?*/ + break; + } rank += ranges[i][2]; /* Stride */ - if (ranges[i][0] ranges[i][1]) break; diff --git a/teshsuite/smpi/mpich3-test/comm/testlist b/teshsuite/smpi/mpich3-test/comm/testlist index 2245d58c49..f8b8296ce8 100644 --- a/teshsuite/smpi/mpich3-test/comm/testlist +++ b/teshsuite/smpi/mpich3-test/comm/testlist @@ -3,6 +3,7 @@ dup 2 #dupic 4 #works, but needs MPI_Comm_set_name commcreate1 8 +commcreate1 1 #needs MPI_Comm_set_name and MPI_Intercomm_create #commname 4 #ic1 4