Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove MPI_COMM_WORLD references from star-mpi collectives
authorAugustin Degomme <degomme@idpann.imag.fr>
Fri, 12 Jul 2013 16:13:01 +0000 (18:13 +0200)
committerAugustin Degomme <degomme@idpann.imag.fr>
Fri, 12 Jul 2013 17:13:32 +0000 (19:13 +0200)
src/smpi/colls/allreduce-NTS.c
src/smpi/colls/allreduce-lr.c
src/smpi/colls/bcast-NTSB.c
src/smpi/colls/bcast-NTSL-Isend.c
src/smpi/colls/bcast-NTSL.c
src/smpi/colls/bcast-arrival-nb.c
src/smpi/colls/bcast-arrival-pattern-aware-wait.c
src/smpi/colls/bcast-arrival-pattern-aware.c
src/smpi/colls/bcast-arrival-scatter.c
src/smpi/colls/reduce-NTSL.c
src/smpi/colls/reduce-arrival-pattern-aware.c

index 51e3aed..85c790b 100644 (file)
@@ -20,8 +20,8 @@ smpi_coll_tuned_allreduce_NTS(void *sbuf, void *rbuf, int rcount,
   int send_offset, recv_offset;
   int remainder, remainder_flag, remainder_offset;
 
-  rank = smpi_comm_rank(MPI_COMM_WORLD);
-  size = smpi_comm_size(MPI_COMM_WORLD);
+  rank = smpi_comm_rank(comm);
+  size = smpi_comm_size(comm);
 
   /* make it compatible with all data type */
   MPI_Aint extent;
index 9bb4149..664c707 100644 (file)
@@ -23,8 +23,8 @@ smpi_coll_tuned_allreduce_lr(void *sbuf, void *rbuf, int rcount,
   int send_offset, recv_offset;
   int remainder, remainder_flag, remainder_offset;
 
-  rank = smpi_comm_rank(MPI_COMM_WORLD);
-  size = smpi_comm_size(MPI_COMM_WORLD);
+  rank = smpi_comm_rank(comm);
+  size = smpi_comm_size(comm);
 
   /* make it compatible with all data type */
   MPI_Aint extent;
index 4ebfc15..1af70f6 100644 (file)
@@ -18,8 +18,8 @@ int smpi_coll_tuned_bcast_NTSB(void *buf, int count, MPI_Datatype datatype,
   MPI_Aint extent;
   extent = smpi_datatype_get_extent(datatype);
 
-  rank = smpi_comm_rank(MPI_COMM_WORLD);
-  size = smpi_comm_size(MPI_COMM_WORLD);
+  rank = smpi_comm_rank(comm);
+  size = smpi_comm_size(comm);
 
   /* source node and destination nodes (same through out the functions) */
   int from = (rank - 1) / 2;
index ecdcdc7..70edbef 100644 (file)
@@ -20,8 +20,8 @@ int smpi_coll_tuned_bcast_NTSL_Isend(void *buf, int count, MPI_Datatype datatype
   MPI_Aint extent;
   extent = smpi_datatype_get_extent(datatype);
 
-  rank = smpi_comm_rank(MPI_COMM_WORLD);
-  size = smpi_comm_size(MPI_COMM_WORLD);
+  rank = smpi_comm_rank(comm);
+  size = smpi_comm_size(comm);
 
   /* source node and destination nodes (same through out the functions) */
   int to = (rank + 1) % size;
index 53a7d76..23a51bc 100644 (file)
@@ -20,8 +20,8 @@ int smpi_coll_tuned_bcast_NTSL(void *buf, int count, MPI_Datatype datatype,
   MPI_Aint extent;
   extent = smpi_datatype_get_extent(datatype);
 
-  rank = smpi_comm_rank(MPI_COMM_WORLD);
-  size = smpi_comm_size(MPI_COMM_WORLD);
+  rank = smpi_comm_rank(comm);
+  size = smpi_comm_size(comm);
 
   /* source node and destination nodes (same through out the functions) */
   int to = (rank + 1) % size;
index e1de48c..84a06ae 100644 (file)
@@ -39,8 +39,8 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count,
 
 
 
-  rank = smpi_comm_rank(MPI_COMM_WORLD);
-  size = smpi_comm_size(MPI_COMM_WORLD);
+  rank = smpi_comm_rank(comm);
+  size = smpi_comm_size(comm);
 
 
   /* segment is segment size in number of elements (not bytes) */
@@ -84,7 +84,7 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count,
         //      for (j=0;j<1000;j++) {
         for (i = 1; i < size; i++) {
           if (already_sent[i] == 0)
-            smpi_mpi_iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i],
+            smpi_mpi_iprobe(i, MPI_ANY_TAG, comm, &flag_array[i],
                        MPI_STATUSES_IGNORE);
         }
         //}
@@ -95,7 +95,7 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count,
 
           /* message arrive */
           if ((flag_array[i] == 1) && (already_sent[i] == 0)) {
-            smpi_mpi_recv(temp_buf, 1, MPI_CHAR, i, tag, MPI_COMM_WORLD, &status);
+            smpi_mpi_recv(temp_buf, 1, MPI_CHAR, i, tag, comm, &status);
             header_buf[header_index] = i;
             header_index++;
             sent_count++;
@@ -134,7 +134,7 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count,
       }                         /* while loop */
       
       for(i=0; i<size; i++)
-        if(to_clean[i]!=0)smpi_mpi_recv(temp_buf, 1, MPI_CHAR, i, tag, MPI_COMM_WORLD, &status);
+        if(to_clean[i]!=0)smpi_mpi_recv(temp_buf, 1, MPI_CHAR, i, tag, comm, &status);
     }
 
     /* non-root */
@@ -188,11 +188,11 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count,
         for (k = 0; k < 3; k++) {
           for (i = 1; i < size; i++) {
             if ((already_sent[i] == 0) && (will_send[i] == 0)) {
-              smpi_mpi_iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i],
+              smpi_mpi_iprobe(i, MPI_ANY_TAG, comm, &flag_array[i],
                          &temp_status_array[i]);
               if (flag_array[i] == 1) {
                 will_send[i] = 1;
-                smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, MPI_COMM_WORLD,
+                smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, comm,
                          &status);
                 i = 1;
               }
@@ -315,10 +315,10 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count,
 
       /* probe before exit in case there are messages to recv */
       for (i = 1; i < size; i++) {
-        smpi_mpi_iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i],
+        smpi_mpi_iprobe(i, MPI_ANY_TAG, comm, &flag_array[i],
                    &temp_status_array[i]);
         if (flag_array[i] == 1)
-          smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, MPI_COMM_WORLD, &status);
+          smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, comm, &status);
       }
     }
 
@@ -327,7 +327,7 @@ int smpi_coll_tuned_bcast_arrival_nb(void *buf, int count,
     else {
 
       /* if root already send a message to this node, don't send one-byte message */
-      smpi_mpi_iprobe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[0], &status);
+      smpi_mpi_iprobe(0, MPI_ANY_TAG, comm, &flag_array[0], &status);
 
       /* send 1-byte message to root */
       if (flag_array[0] == 0)
index 11fb5da..06693db 100644 (file)
@@ -49,8 +49,8 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware_wait(void *buf, int count,
 
 
 
-  rank = smpi_comm_rank(MPI_COMM_WORLD);
-  size = smpi_comm_size(MPI_COMM_WORLD);
+  rank = smpi_comm_rank(comm);
+  size = smpi_comm_size(comm);
 
 
   /* segment is segment size in number of elements (not bytes) */
@@ -114,11 +114,11 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware_wait(void *buf, int count,
       for (k = 0; k < 3; k++) {
         for (i = 1; i < size; i++) {
           if ((already_sent[i] == 0) && (will_send[i] == 0)) {
-            smpi_mpi_iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i],
+            smpi_mpi_iprobe(i, MPI_ANY_TAG, comm, &flag_array[i],
                        &temp_status_array[i]);
             if (flag_array[i] == 1) {
               will_send[i] = 1;
-              smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, MPI_COMM_WORLD,
+              smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, comm,
                        &status);
               i = 0;
             }
index 073f085..39498ea 100644 (file)
@@ -39,8 +39,8 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware(void *buf, int count,
 
 
 
-  rank = smpi_comm_rank(MPI_COMM_WORLD);
-  size = smpi_comm_size(MPI_COMM_WORLD);
+  rank = smpi_comm_rank(comm);
+  size = smpi_comm_size(comm);
 
 
   /* segment is segment size in number of elements (not bytes) */
@@ -80,7 +80,7 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware(void *buf, int count,
 
       while (sent_count < (size - 1)) {
         for (i = 1; i < size; i++) {
-          smpi_mpi_iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i],
+          smpi_mpi_iprobe(i, MPI_ANY_TAG, comm, &flag_array[i],
                      MPI_STATUSES_IGNORE);
         }
 
@@ -90,7 +90,7 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware(void *buf, int count,
 
           /* message arrive */
           if ((flag_array[i] == 1) && (already_sent[i] == 0)) {
-            smpi_mpi_recv(temp_buf, 1, MPI_CHAR, i, tag, MPI_COMM_WORLD, &status);
+            smpi_mpi_recv(temp_buf, 1, MPI_CHAR, i, tag, comm, &status);
             header_buf[header_index] = i;
             header_index++;
             sent_count++;
@@ -172,7 +172,7 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware(void *buf, int count,
         //iteration++;
         //start = MPI_Wtime();
         for (i = 1; i < size; i++) {
-          smpi_mpi_iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i],
+          smpi_mpi_iprobe(i, MPI_ANY_TAG, comm, &flag_array[i],
                      &temp_status_array[i]);
         }
         //total = MPI_Wtime() - start;
@@ -185,7 +185,7 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware(void *buf, int count,
         for (i = 1; i < size; i++) {
           /* message arrive */
           if ((flag_array[i] == 1) && (already_sent[i] == 0)) {
-            smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, MPI_COMM_WORLD,
+            smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, comm,
                      &status);
             header_buf[header_index] = i;
             header_index++;
@@ -285,7 +285,7 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware(void *buf, int count,
       }                         /* while loop */
 
       for(i=0; i<size; i++)
-        if(to_clean[i]!=0)smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, MPI_COMM_WORLD,
+        if(to_clean[i]!=0)smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, comm,
                      &status);
       //total = MPI_Wtime() - start2;
       //total *= 1000;
index 2b56092..609490d 100644 (file)
@@ -47,8 +47,8 @@ int smpi_coll_tuned_bcast_arrival_scatter(void *buf, int count,
   /* source and destination */
   int to, from;
 
-  rank = smpi_comm_rank(MPI_COMM_WORLD);
-  size = smpi_comm_size(MPI_COMM_WORLD);
+  rank = smpi_comm_rank(comm);
+  size = smpi_comm_size(comm);
 
   /* message too small */
   if (count < size) {
@@ -90,11 +90,11 @@ int smpi_coll_tuned_bcast_arrival_scatter(void *buf, int count,
       for (k = 0; k < 3; k++) {
         for (i = 1; i < size; i++) {
           if ((already_sent[i] == 0) && (will_send[i] == 0)) {
-            smpi_mpi_iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i],
+            smpi_mpi_iprobe(i, MPI_ANY_TAG, comm, &flag_array[i],
                        &temp_status_array[i]);
             if (flag_array[i] == 1) {
               will_send[i] = 1;
-              smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, MPI_COMM_WORLD,
+              smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, comm,
                        &status);
               i = 0;
             }
index 2bb714a..f02a7ff 100644 (file)
@@ -21,8 +21,8 @@ int smpi_coll_tuned_reduce_NTSL(void *buf, void *rbuf, int count,
   MPI_Aint extent;
   extent = smpi_datatype_get_extent(datatype);
 
-  rank = smpi_comm_rank(MPI_COMM_WORLD);
-  size = smpi_comm_size(MPI_COMM_WORLD);
+  rank = smpi_comm_rank(comm);
+  size = smpi_comm_size(comm);
 
   /* source node and destination nodes (same through out the functions) */
   int to = (rank - 1 + size) % size;
index b743323..7ae69a8 100644 (file)
@@ -89,7 +89,7 @@ int smpi_coll_tuned_reduce_arrival_pattern_aware(void *buf, void *rbuf,
 
         for (i = 1; i < size; i++) {
           if (already_received[i] == 0) {
-            smpi_mpi_iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i],
+            smpi_mpi_iprobe(i, MPI_ANY_TAG, comm, &flag_array[i],
                              MPI_STATUSES_IGNORE);
             simcall_process_sleep(0.0001);
             }
@@ -103,7 +103,7 @@ int smpi_coll_tuned_reduce_arrival_pattern_aware(void *buf, void *rbuf,
 
           /* 1-byte message arrive */
           if ((flag_array[i] == 1) && (already_received[i] == 0)) {
-            smpi_mpi_recv(temp_buf, 1, MPI_CHAR, i, tag, MPI_COMM_WORLD, &status);
+            smpi_mpi_recv(temp_buf, 1, MPI_CHAR, i, tag, comm, &status);
             header_buf[header_index] = i;
             header_index++;
             sent_count++;
@@ -214,11 +214,11 @@ int smpi_coll_tuned_reduce_arrival_pattern_aware(void *buf, void *rbuf,
             //if (i == rank)
             //continue;
             if ((already_received[i] == 0) && (will_send[i] == 0)) {
-                smpi_mpi_iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i],
+                smpi_mpi_iprobe(i, MPI_ANY_TAG, comm, &flag_array[i],
                          &temp_status_array[i]);
               if (flag_array[i] == 1) {
                 will_send[i] = 1;
-                smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, MPI_COMM_WORLD,
+                smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, comm,
                          &status);
                 //printf("recv from %d\n",i);
                 i = 1;