Algorithmique Numérique Distribuée Public GIT Repository
 author Augustin Degomme Thu, 11 Jul 2013 13:58:08 +0000 (15:58 +0200) committer Augustin Degomme Thu, 11 Jul 2013 19:26:35 +0000 (21:26 +0200)

index 26e809b..69de4f4 100644 (file)
@@ -636,7 +636,7 @@ int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
MPI_Group * newgroup)
{
-  int retval, i, newrank, rank, size, index, add;
+  int retval, i, rank, newrank,oldrank, size, index, add;

smpi_bench_end();
if (group == MPI_GROUP_NULL) {
@@ -650,37 +650,57 @@ 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 && rank <= ranges[i][1]; /* Last */
-             rank += ranges[i][2] /* Stride */ ) {
+             rank >= 0; /* Last */
+              ) {
size--;
+
+          rank += ranges[i][2]; /* Stride */
+         if (ranges[i][0]<ranges[i][1]){
+             if(rank > ranges[i][1])
+               break;
+         }else{
+             if(rank < ranges[i][1])
+               break;
+         }
}
}
if (size == 0) {
*newgroup = MPI_GROUP_EMPTY;
} else {
*newgroup = smpi_group_new(size);
-        newrank = 0;
+        newrank=0;
+        oldrank=0;
while (newrank < size) {
for (i = 0; i < n; i++) {
-            for (rank = ranges[i][0];   /* First */
-                 rank >= 0 && rank <= ranges[i][1];     /* Last */
-                 rank += ranges[i][2] /* Stride */ ) {
-              if (rank == newrank) {
-                break;
+            for (rank = ranges[i][0];rank >= 0;){
+              if(rank==oldrank){
+                  break;
+              }
+
+              rank += ranges[i][2]; /* Stride */
+
+              if (ranges[i][0]<ranges[i][1]){
+                  if(rank > ranges[i][1])
+                    break;
+              }else{
+                  if(rank < ranges[i][1])
+                    break;
}
-            }
-            if (add == 1) {
-              index = smpi_group_index(group, newrank);
-              smpi_group_set_mapping(*newgroup, index, newrank);
}
}
-          newrank++; //added to avoid looping, need to be checked ..