Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright notices
[simgrid.git] / src / smpi / colls / bcast-ompi-pipeline.c
index 63c2067..3aebd8c 100644 (file)
@@ -1,3 +1,9 @@
+/* Copyright (c) 2013-2014. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
  #include "colls_private.h"
  #include "coll_tuned_topo.h"
 
@@ -38,7 +44,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
 
     size = smpi_comm_size(comm);
     rank = smpi_comm_rank(comm);
-    xbt_assert( size > 1 );
+    if(size==1)return MPI_SUCCESS;
 
 
     const double a_p16  = 3.2118e-6; /* [1 / byte] */
@@ -96,7 +102,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
             for( i = 0; i < tree->tree_nextsize; i++ ) { 
                 send_reqs[i] = smpi_mpi_isend(tmpbuf, sendcount, datatype,
                                          tree->tree_next[i], 
-                                         777, comm);
+                                         COLL_TAG_BCAST, comm);
            } 
 
             /* complete the sends before starting the next sends */
@@ -124,7 +130,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
          */
         req_index = 0;
         recv_reqs[req_index]=smpi_mpi_irecv(tmpbuf, count_by_segment, datatype,
-                           tree->tree_prev, 777,
+                           tree->tree_prev, COLL_TAG_BCAST,
                            comm);
         
         for( segindex = 1; segindex < num_segments; segindex++ ) {
@@ -134,7 +140,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
             /* post new irecv */
             recv_reqs[req_index]= smpi_mpi_irecv( tmpbuf + realsegsize, count_by_segment,
                                 datatype, tree->tree_prev, 
-                                777, 
+                                COLL_TAG_BCAST,
                                 comm);
             
             /* wait for and forward the previous segment to children */
@@ -144,7 +150,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
             for( i = 0; i < tree->tree_nextsize; i++ ) { 
                 send_reqs[i]=smpi_mpi_isend(tmpbuf, count_by_segment, datatype,
                                          tree->tree_next[i], 
-                                         777, comm );
+                                         COLL_TAG_BCAST, comm );
             } 
             
             /* complete the sends before starting the next iteration */
@@ -161,7 +167,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
         for( i = 0; i < tree->tree_nextsize; i++ ) {
             send_reqs[i] = smpi_mpi_isend(tmpbuf, sendcount, datatype,
                                      tree->tree_next[i], 
-                                     777, comm);
+                                     COLL_TAG_BCAST, comm);
         }
         
         smpi_mpi_waitall( tree->tree_nextsize, send_reqs, 
@@ -180,7 +186,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
         */
         req_index = 0;
         recv_reqs[req_index] = smpi_mpi_irecv(tmpbuf, count_by_segment, datatype,
-                                 tree->tree_prev, 777,
+                                 tree->tree_prev, COLL_TAG_BCAST,
                                  comm);
 
         for( segindex = 1; segindex < num_segments; segindex++ ) {
@@ -188,7 +194,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
             tmpbuf += realsegsize;
             /* post receive for the next segment */
             recv_reqs[req_index] = smpi_mpi_irecv(tmpbuf, count_by_segment, datatype, 
-                                     tree->tree_prev, 777, 
+                                     tree->tree_prev, COLL_TAG_BCAST,
                                      comm);
             /* wait on the previous segment */
             smpi_mpi_wait( &recv_reqs[req_index ^ 0x1], 
@@ -199,6 +205,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
     }
 
     if( NULL != send_reqs ) free(send_reqs);
+    xbt_free(tree);
 
     return (MPI_SUCCESS);
 }