Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fixing some compiler warnings for adding to void pointer and also
authorMark Stillwell <mark.stillwell@ens-lyon.fr>
Tue, 19 Jul 2011 09:26:28 +0000 (11:26 +0200)
committerMark Stillwell <mark.stillwell@ens-lyon.fr>
Tue, 19 Jul 2011 09:26:28 +0000 (11:26 +0200)
some bugs in the alltoall_bruck...

src/smpi/smpi_base.c
src/smpi/smpi_coll.c

index 012cc39..9ba0db2 100644 (file)
@@ -384,13 +384,13 @@ void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     smpi_datatype_extent(recvtype, &lb, &recvext);
     // Local copy from root
     smpi_datatype_copy(sendbuf, sendcount, sendtype, 
     smpi_datatype_extent(recvtype, &lb, &recvext);
     // Local copy from root
     smpi_datatype_copy(sendbuf, sendcount, sendtype, 
-        recvbuf + root * recvcount * recvext, recvcount, recvtype);
+        (char *)recvbuf + root * recvcount * recvext, recvcount, recvtype);
     // Receive buffers from senders
     requests = xbt_new(MPI_Request, size - 1);
     index = 0;
     for(src = 0; src < size; src++) {
       if(src != root) {
     // Receive buffers from senders
     requests = xbt_new(MPI_Request, size - 1);
     index = 0;
     for(src = 0; src < size; src++) {
       if(src != root) {
-        requests[index] = smpi_irecv_init(recvbuf + src * recvcount * recvext, 
+        requests[index] = smpi_irecv_init((char *)recvbuf + src * recvcount * recvext, 
                                           recvcount, recvtype, 
                                           src, system_tag, comm);
         index++;
                                           recvcount, recvtype, 
                                           src, system_tag, comm);
         index++;
@@ -422,7 +422,7 @@ void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     smpi_datatype_extent(recvtype, &lb, &recvext);
     // Local copy from root
     smpi_datatype_copy(sendbuf, sendcount, sendtype, 
     smpi_datatype_extent(recvtype, &lb, &recvext);
     // Local copy from root
     smpi_datatype_copy(sendbuf, sendcount, sendtype, 
-                       recvbuf + displs[root] * recvext, 
+                       (char *)recvbuf + displs[root] * recvext, 
                        recvcounts[root], recvtype);
     // Receive buffers from senders
     requests = xbt_new(MPI_Request, size - 1);
                        recvcounts[root], recvtype);
     // Receive buffers from senders
     requests = xbt_new(MPI_Request, size - 1);
@@ -430,8 +430,8 @@ void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     for(src = 0; src < size; src++) {
       if(src != root) {
         requests[index] =
     for(src = 0; src < size; src++) {
       if(src != root) {
         requests[index] =
-            smpi_irecv_init(recvbuf + displs[src] * recvext, recvcounts[src]
-                            recvtype, src, system_tag, comm);
+            smpi_irecv_init((char *)recvbuf + displs[src] * recvext
+                            recvcounts[src], recvtype, src, system_tag, comm);
         index++;
       }
     }
         index++;
       }
     }
@@ -458,7 +458,8 @@ void smpi_mpi_allgather(void *sendbuf, int sendcount,
   smpi_datatype_extent(recvtype, &lb, &recvext);
   // Local copy from self
   smpi_datatype_copy(sendbuf, sendcount, sendtype, 
   smpi_datatype_extent(recvtype, &lb, &recvext);
   // Local copy from self
   smpi_datatype_copy(sendbuf, sendcount, sendtype, 
-                     recvbuf + rank * recvcount * recvext, recvcount, recvtype);
+                     (char *)recvbuf + rank * recvcount * recvext, recvcount, 
+                     recvtype);
   // Send/Recv buffers to/from others;
   requests = xbt_new(MPI_Request, 2 * (size - 1));
   index = 0;
   // Send/Recv buffers to/from others;
   requests = xbt_new(MPI_Request, 2 * (size - 1));
   index = 0;
@@ -468,7 +469,7 @@ void smpi_mpi_allgather(void *sendbuf, int sendcount,
           smpi_isend_init(sendbuf, sendcount, sendtype, other, system_tag,
                           comm);
       index++;
           smpi_isend_init(sendbuf, sendcount, sendtype, other, system_tag,
                           comm);
       index++;
-      requests[index] = smpi_irecv_init(recvbuf + other * recvcount * recvext, 
+      requests[index] = smpi_irecv_init((char *)recvbuf + other * recvcount * recvext, 
                                         recvcount, recvtype, other, 
                                         system_tag, comm);
       index++;
                                         recvcount, recvtype, other, 
                                         system_tag, comm);
       index++;
@@ -496,7 +497,7 @@ void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
   smpi_datatype_extent(recvtype, &lb, &recvext);
   // Local copy from self
   smpi_datatype_copy(sendbuf, sendcount, sendtype, 
   smpi_datatype_extent(recvtype, &lb, &recvext);
   // Local copy from self
   smpi_datatype_copy(sendbuf, sendcount, sendtype, 
-                     recvbuf + displs[rank] * recvext, 
+                     (char *)recvbuf + displs[rank] * recvext, 
                      recvcounts[rank], recvtype);
   // Send buffers to others;
   requests = xbt_new(MPI_Request, 2 * (size - 1));
                      recvcounts[rank], recvtype);
   // Send buffers to others;
   requests = xbt_new(MPI_Request, 2 * (size - 1));
@@ -508,7 +509,7 @@ void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
                           comm);
       index++;
       requests[index] =
                           comm);
       index++;
       requests[index] =
-          smpi_irecv_init(recvbuf + displs[other] * recvext, recvcounts[other],
+          smpi_irecv_init((char *)recvbuf + displs[other] * recvext, recvcounts[other],
                           recvtype, other, system_tag, comm);
       index++;
     }
                           recvtype, other, system_tag, comm);
       index++;
     }
@@ -538,14 +539,14 @@ void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     // FIXME: check for errors
     smpi_datatype_extent(sendtype, &lb, &sendext);
     // Local copy from root
     // FIXME: check for errors
     smpi_datatype_extent(sendtype, &lb, &sendext);
     // Local copy from root
-    smpi_datatype_copy(sendbuf + root * sendcount * sendext,
+    smpi_datatype_copy((char *)sendbuf + root * sendcount * sendext,
       sendcount, sendtype, recvbuf, recvcount, recvtype);
     // Send buffers to receivers
     requests = xbt_new(MPI_Request, size - 1);
     index = 0;
     for(dst = 0; dst < size; dst++) {
       if(dst != root) {
       sendcount, sendtype, recvbuf, recvcount, recvtype);
     // Send buffers to receivers
     requests = xbt_new(MPI_Request, size - 1);
     index = 0;
     for(dst = 0; dst < size; dst++) {
       if(dst != root) {
-        requests[index] = smpi_isend_init(sendbuf + dst * sendcount * sendext, 
+        requests[index] = smpi_isend_init((char *)sendbuf + dst * sendcount * sendext, 
                                           sendcount, sendtype, dst,
                                           system_tag, comm);
         index++;
                                           sendcount, sendtype, dst,
                                           system_tag, comm);
         index++;
@@ -577,7 +578,7 @@ void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
     // FIXME: check for errors
     smpi_datatype_extent(sendtype, &lb, &sendext);
     // Local copy from root
     // FIXME: check for errors
     smpi_datatype_extent(sendtype, &lb, &sendext);
     // Local copy from root
-    smpi_datatype_copy(sendbuf + displs[root] * sendext, sendcounts[root], 
+    smpi_datatype_copy((char *)sendbuf + displs[root] * sendext, sendcounts[root], 
                        sendtype, recvbuf, recvcount, recvtype);
     // Send buffers to receivers
     requests = xbt_new(MPI_Request, size - 1);
                        sendtype, recvbuf, recvcount, recvtype);
     // Send buffers to receivers
     requests = xbt_new(MPI_Request, size - 1);
@@ -585,7 +586,7 @@ void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
     for(dst = 0; dst < size; dst++) {
       if(dst != root) {
         requests[index] =
     for(dst = 0; dst < size; dst++) {
       if(dst != root) {
         requests[index] =
-            smpi_isend_init(sendbuf + displs[dst] * sendext, sendcounts[dst], 
+            smpi_isend_init((char *)sendbuf + displs[dst] * sendext, sendcounts[dst], 
                             sendtype, dst, system_tag, comm);
         index++;
       }
                             sendtype, dst, system_tag, comm);
         index++;
       }
index 024856d..7798de8 100644 (file)
@@ -196,6 +196,8 @@ void nary_tree_barrier(MPI_Comm comm, int arity)
  * Alltoall Bruck
  *
  * Openmpi calls this routine when the message size sent to each rank < 2000 bytes and size < 12
  * Alltoall Bruck
  *
  * Openmpi calls this routine when the message size sent to each rank < 2000 bytes and size < 12
+ * FIXME: uh, check smpi_pmpi again, but this routine is called for > 12, not
+ * less...
  **/
 int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
                                    MPI_Datatype sendtype, void *recvbuf,
  **/
 int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
                                    MPI_Datatype sendtype, void *recvbuf,
@@ -205,20 +207,21 @@ int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
   int system_tag = 777;
   int i, rank, size, err, count;
   MPI_Aint lb;
   int system_tag = 777;
   int i, rank, size, err, count;
   MPI_Aint lb;
-  MPI_Aint sendextent = 0;
-  MPI_Aint recvextent = 0;
+  MPI_Aint sendext = 0;
+  MPI_Aint recvext = 0;
   MPI_Request *requests;
 
   // FIXME: check implementation
   rank = smpi_comm_rank(comm);
   size = smpi_comm_size(comm);
   XBT_DEBUG("<%d> algorithm alltoall_bruck() called.", rank);
   MPI_Request *requests;
 
   // FIXME: check implementation
   rank = smpi_comm_rank(comm);
   size = smpi_comm_size(comm);
   XBT_DEBUG("<%d> algorithm alltoall_bruck() called.", rank);
-  err = smpi_datatype_extent(sendtype, &lb, &sendextent);
-  err = smpi_datatype_extent(recvtype, &lb, &recvextent);
+  err = smpi_datatype_extent(sendtype, &lb, &sendext);
+  err = smpi_datatype_extent(recvtype, &lb, &recvext);
   /* Local copy from self */
   err =
   /* Local copy from self */
   err =
-      smpi_datatype_copy(&((char *) sendbuf)[rank * sendextent], sendcount,
-                         sendtype, &((char *) recvbuf)[rank * recvextent],
+      smpi_datatype_copy((char *)sendbuf + rank * sendcount * sendext, 
+                         sendcount, sendtype, 
+                         (char *)recvbuf + rank * recvcount * recvext,
                          recvcount, recvtype);
   if (err == MPI_SUCCESS && size > 1) {
     /* Initiate all send/recv to/from others. */
                          recvcount, recvtype);
   if (err == MPI_SUCCESS && size > 1) {
     /* Initiate all send/recv to/from others. */
@@ -232,7 +235,7 @@ int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
         continue;
       }
       requests[count] =
         continue;
       }
       requests[count] =
-          smpi_irecv_init(&((char *) recvbuf)[i * recvextent], recvcount,
+          smpi_irecv_init((char *)recvbuf + i * recvcount * recvext, recvcount,
                           recvtype, i, system_tag, comm);
       count++;
     }
                           recvtype, i, system_tag, comm);
       count++;
     }
@@ -244,7 +247,7 @@ int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
         continue;
       }
       requests[count] =
         continue;
       }
       requests[count] =
-          smpi_isend_init(&((char *) sendbuf)[i * sendextent], sendcount,
+          smpi_isend_init((char *)sendbuf + i * sendcount * sendext, sendcount,
                           sendtype, i, system_tag, comm);
       count++;
     }
                           sendtype, i, system_tag, comm);
       count++;
     }
@@ -278,10 +281,10 @@ int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount,
   err = smpi_datatype_extent(sendtype, &lb, &sendext);
   err = smpi_datatype_extent(recvtype, &lb, &recvext);
   /* simple optimization */
   err = smpi_datatype_extent(sendtype, &lb, &sendext);
   err = smpi_datatype_extent(recvtype, &lb, &recvext);
   /* simple optimization */
-  err = smpi_datatype_copy(sendbuf + rank * sendcount * sendext, sendcount, 
-                           sendtype, 
-                           recvbuf + rank * recvcount * recvext, recvcount, 
-                           recvtype);
+  err = smpi_datatype_copy((char *)sendbuf + rank * sendcount * sendext, 
+                           sendcount, sendtype, 
+                           (char *)recvbuf + rank * recvcount * recvext, 
+                           recvcount, recvtype);
   if (err == MPI_SUCCESS && size > 1) {
     /* Initiate all send/recv to/from others. */
     requests = xbt_new(MPI_Request, 2 * (size - 1));
   if (err == MPI_SUCCESS && size > 1) {
     /* Initiate all send/recv to/from others. */
     requests = xbt_new(MPI_Request, 2 * (size - 1));
@@ -289,7 +292,7 @@ int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount,
     count = 0;
     for (i = (rank + 1) % size; i != rank; i = (i + 1) % size) {
       requests[count] =
     count = 0;
     for (i = (rank + 1) % size; i != rank; i = (i + 1) % size) {
       requests[count] =
-          smpi_irecv_init(recvbuf + i * recvcount * recvext, recvcount, 
+          smpi_irecv_init((char *)recvbuf + i * recvcount * recvext, recvcount, 
                           recvtype, i, system_tag, comm);
       count++;
     }
                           recvtype, i, system_tag, comm);
       count++;
     }
@@ -300,7 +303,7 @@ int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount,
      */
     for (i = (rank + size - 1) % size; i != rank; i = (i + size - 1) % size) {
       requests[count] =
      */
     for (i = (rank + size - 1) % size; i != rank; i = (i + size - 1) % size) {
       requests[count] =
-          smpi_isend_init(sendbuf + i * sendcount * sendext, sendcount,
+          smpi_isend_init((char *)sendbuf + i * sendcount * sendext, sendcount,
                           sendtype, i, system_tag, comm);
       count++;
     }
                           sendtype, i, system_tag, comm);
       count++;
     }
@@ -370,10 +373,10 @@ int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts,
   err = smpi_datatype_extent(recvtype, &lb, &recvext);
   /* Local copy from self */
   err =
   err = smpi_datatype_extent(recvtype, &lb, &recvext);
   /* Local copy from self */
   err =
-      smpi_datatype_copy(sendbuf + senddisps[rank] * sendext, sendcounts[rank]
-                         sendtype,
-                         recvbuf + recvdisps[rank] * recvext, recvcounts[rank],
-                         recvtype);
+      smpi_datatype_copy((char *)sendbuf + senddisps[rank] * sendext
+                         sendcounts[rank], sendtype,
+                         (char *)recvbuf + recvdisps[rank] * recvext, 
+                         recvcounts[rank], recvtype);
   if (err == MPI_SUCCESS && size > 1) {
     /* Initiate all send/recv to/from others. */
     requests = xbt_new(MPI_Request, 2 * (size - 1));
   if (err == MPI_SUCCESS && size > 1) {
     /* Initiate all send/recv to/from others. */
     requests = xbt_new(MPI_Request, 2 * (size - 1));
@@ -387,8 +390,8 @@ int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts,
         continue;
       }
       requests[count] =
         continue;
       }
       requests[count] =
-          smpi_irecv_init(recvbuf + recvdisps[i] * recvext, recvcounts[i]
-                          recvtype, i, system_tag, comm);
+          smpi_irecv_init((char *)recvbuf + recvdisps[i] * recvext
+                          recvcounts[i], recvtype, i, system_tag, comm);
       count++;
     }
     /* Now create all sends  */
       count++;
     }
     /* Now create all sends  */
@@ -400,8 +403,8 @@ int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts,
         continue;
       }
       requests[count] =
         continue;
       }
       requests[count] =
-          smpi_isend_init(sendbuf + senddisps[i] * sendext, sendcounts[i]
-                          sendtype, i, system_tag, comm);
+          smpi_isend_init((char *)sendbuf + senddisps[i] * sendext
+                          sendcounts[i], sendtype, i, system_tag, comm);
       count++;
     }
     /* Wait for them all. */
       count++;
     }
     /* Wait for them all. */