+/* 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"
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] */
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 */
*/
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++ ) {
/* 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 */
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 */
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,
*/
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++ ) {
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],
}
if( NULL != send_reqs ) free(send_reqs);
+ xbt_free(tree);
return (MPI_SUCCESS);
}