Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
star-mpi's pairwise alltoall is only valid for power of 2 cases, add openmpi's one...
authorAugustin Degomme <degomme@idpann.imag.fr>
Thu, 20 Jun 2013 08:11:46 +0000 (10:11 +0200)
committerAugustin Degomme <degomme@idpann.imag.fr>
Thu, 20 Jun 2013 08:11:46 +0000 (10:11 +0200)
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/DefinePackages.cmake
src/smpi/colls/alltoall-ompi-pairwise.c [new file with mode: 0644]
src/smpi/colls/colls.h
src/smpi/colls/smpi_openmpi_selector.c

index c8a7fb3..0b80e67 100644 (file)
@@ -395,7 +395,7 @@ if(NOT enable_memcheck)
     FOREACH (ALLTOALL_COLL 2dmesh 3dmesh pair pair_one_barrier pair_light_barrier
                           pair_mpi_barrier rdb ring ring_light_barrier
                           ring_mpi_barrier ring_one_barrier
-                          simple bruck basic_linear ompi)
+                          simple bruck basic_linear ompi mpich ompi_pairwise)
         ADD_TEST(smpi-alltoall-coll-${ALLTOALL_COLL} ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg smpi/alltoall:${ALLTOALL_COLL} --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/alltoall_coll.tesh)
     ENDFOREACH()
     
index 5f96eab..20da690 100644 (file)
@@ -165,6 +165,7 @@ set(SMPI_SRC
   src/smpi/colls/alltoall-ring-mpi-barrier.c
   src/smpi/colls/alltoall-ring-one-barrier.c
   src/smpi/colls/alltoall-simple.c
+  src/smpi/colls/alltoall-ompi-pairwise.c
   src/smpi/colls/alltoallv-pair.c   
   src/smpi/colls/alltoallv-pair-light-barrier.c
   src/smpi/colls/alltoallv-pair-mpi-barrier.c
diff --git a/src/smpi/colls/alltoall-ompi-pairwise.c b/src/smpi/colls/alltoall-ompi-pairwise.c
new file mode 100644 (file)
index 0000000..e23944f
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
+ *                         University Research and Technology
+ *                         Corporation.  All rights reserved.
+ * Copyright (c) 2004-2006 The University of Tennessee and The University
+ *                         of Tennessee Research Foundation.  All rights
+ *                         reserved.
+ * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
+ *                         University of Stuttgart.  All rights reserved.
+ * Copyright (c) 2004-2005 The Regents of the University of California.
+ *                         All rights reserved.
+ * $COPYRIGHT$
+ *
+ * Additional copyrights may follow
+ *
+ * $HEADER$
+ */
+
+#include "colls_private.h"
+#define MCA_COLL_BASE_TAG_ALLTOALL 101
+
+int smpi_coll_tuned_alltoall_ompi_pairwise(void *sbuf, int scount, 
+                                            MPI_Datatype sdtype,
+                                            void* rbuf, int rcount,
+                                            MPI_Datatype rdtype,
+                                            MPI_Comm comm)
+{
+    int rank, size, step;
+    int sendto, recvfrom;
+    void * tmpsend, *tmprecv;
+    MPI_Aint lb, sext, rext;
+
+    size = smpi_comm_size(comm);
+    rank = smpi_comm_rank(comm);
+
+    XBT_VERB(
+                 "coll:tuned:alltoall_ompi_pairwise rank %d", rank);
+
+    smpi_datatype_extent (sdtype, &lb, &sext);
+    smpi_datatype_extent (rdtype, &lb, &rext);
+
+    
+    /* Perform pairwise exchange - starting from 1 so the local copy is last */
+    for (step = 1; step < size + 1; step++) {
+
+        /* Determine sender and receiver for this step. */
+        sendto  = (rank + step) % size;
+        recvfrom = (rank + size - step) % size;
+
+        /* Determine sending and receiving locations */
+        tmpsend = (char*)sbuf + sendto * sext * scount;
+        tmprecv = (char*)rbuf + recvfrom * rext * rcount;
+
+        /* send and receive */
+        smpi_mpi_sendrecv( tmpsend, scount, sdtype, sendto, 
+                                        MCA_COLL_BASE_TAG_ALLTOALL,
+                                        tmprecv, rcount, rdtype, recvfrom, 
+                                        MCA_COLL_BASE_TAG_ALLTOALL,
+                                        comm, MPI_STATUS_IGNORE);
+    }
+
+    return MPI_SUCCESS;
+}
index c870515..67b62a0 100644 (file)
@@ -143,7 +143,8 @@ COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_mpi_barrier) COLL_sep \
 COLL_APPLY(action, COLL_ALLTOALL_SIG, ring_one_barrier) COLL_sep \
 COLL_APPLY(action, COLL_ALLTOALL_SIG, simple) COLL_sep \
 COLL_APPLY(action, COLL_ALLTOALL_SIG, ompi) COLL_sep \
-COLL_APPLY(action, COLL_ALLTOALL_SIG, mpich)
+COLL_APPLY(action, COLL_ALLTOALL_SIG, mpich)COLL_sep \
+COLL_APPLY(action, COLL_ALLTOALL_SIG, ompi_pairwise)
 
 COLL_ALLTOALLS(COLL_PROTO, COLL_NOsep)
 
index 8109fba..e092bdd 100644 (file)
@@ -81,7 +81,7 @@ int smpi_coll_tuned_alltoall_ompi( void *sbuf, int scount,
                                                            comm);
     }
 
-    return smpi_coll_tuned_alltoall_pair (sbuf, scount, sdtype, 
+    return smpi_coll_tuned_alltoall_ompi_pairwise (sbuf, scount, sdtype, 
                                                     rbuf, rcount, rdtype,
                                                     comm);
 }