Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / smpi / colls / smpi_openmpi_selector.c
index 939b643..b0fb666 100644 (file)
@@ -1,6 +1,6 @@
 /* selector for collective algorithms based on openmpi's default coll_tuned_decision_fixed selector */
 
-/* Copyright (c) 2009, 2010. The SimGrid Team.
+/* Copyright (c) 2009-2010, 2013-2014. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -76,12 +76,12 @@ int smpi_coll_tuned_alltoall_ompi( void *sbuf, int scount,
                                                     comm);
 
     } else if (block_dsize < 3000) {
-        return smpi_coll_tuned_alltoall_simple(sbuf, scount, sdtype, 
+        return smpi_coll_tuned_alltoall_basic_linear(sbuf, scount, sdtype, 
                                                            rbuf, rcount, rdtype, 
                                                            comm);
     }
 
-    return smpi_coll_tuned_alltoall_pair (sbuf, scount, sdtype, 
+    return smpi_coll_tuned_alltoall_ring (sbuf, scount, sdtype, 
                                                     rbuf, rcount, rdtype,
                                                     comm);
 }
@@ -94,7 +94,7 @@ int smpi_coll_tuned_alltoallv_ompi(void *sbuf, int *scounts, int *sdisps,
                                               )
 {
     /* For starters, just keep the original algorithm. */
-    return smpi_coll_tuned_alltoallv_pair(sbuf, scounts, sdisps, sdtype, 
+    return smpi_coll_tuned_alltoallv_ompi_basic_linear(sbuf, scounts, sdisps, sdtype, 
                                                         rbuf, rcounts, rdisps,rdtype,
                                                         comm);
 }
@@ -237,10 +237,11 @@ int smpi_coll_tuned_reduce_ompi( void *sendbuf, void *recvbuf,
     const double b2 =  9.7128;
     const double a3 =  0.0422 / 1024.0; /* [1/B] */
     const double b3 =  1.1614;
-    //const double a4 =  0.0033 / 1024.0; /* [1/B] */
+    //const double a4 =  0.0033 / 1024.0;  [1/B]
     //const double b4 =  1.6761;
 
-    //const int max_requests = 0; /* no limit on # of outstanding requests */
+    /* no limit on # of outstanding requests */
+    //const int max_requests = 0;
 
     communicator_size = smpi_comm_size(comm);
 
@@ -285,13 +286,13 @@ int smpi_coll_tuned_reduce_ompi( void *sendbuf, void *recvbuf,
         return smpi_coll_tuned_reduce_ompi_binary( sendbuf, recvbuf, count, datatype, op, root,
                                                     comm/*, module, segsize, max_requests*/);
     }
-    /*if (communicator_size > (a4 * message_size + b4)) {
+//    if (communicator_size > (a4 * message_size + b4)) {
         // Pipeline_32K 
-        segsize = 32*1024;
-    } else {
+//        segsize = 32*1024;
+//    } else {
         // Pipeline_64K 
-        segsize = 64*1024;
-    }*/
+//        segsize = 64*1024;
+//    }
     return smpi_coll_tuned_reduce_ompi_pipeline (sendbuf, recvbuf, count, datatype, op, root, comm/*, module, 
                                                   segsize, max_requests*/);
 
@@ -596,9 +597,18 @@ int smpi_coll_tuned_scatter_ompi(void *sbuf, int scount,
 
     if ((communicator_size > small_comm_size) &&
         (block_size < small_block_size)) {
-        return smpi_coll_tuned_scatter_ompi_binomial (sbuf, scount, sdtype, 
-                                                       rbuf, rcount, rdtype, 
-                                                       root, comm);
+        if(rank!=root){
+            sbuf=xbt_malloc(rcount*smpi_datatype_get_extent(rdtype));
+            scount=rcount;
+            sdtype=rdtype;
+        }
+        int ret=smpi_coll_tuned_scatter_ompi_binomial (sbuf, scount, sdtype,
+            rbuf, rcount, rdtype,
+            root, comm);
+        if(rank!=root){
+            xbt_free(sbuf);
+        }
+        return ret;
     }
     return smpi_coll_tuned_scatter_ompi_basic_linear (sbuf, scount, sdtype, 
                                                        rbuf, rcount, rdtype,