1 /* Copyright (c) 2013-2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "colls_private.h"
10 smpi_coll_tuned_bcast_flattree(void *buff, int count, MPI_Datatype data_type,
11 int root, MPI_Comm comm)
16 int i, rank, num_procs;
17 int tag = COLL_TAG_BCAST;
19 rank = smpi_comm_rank(comm);
20 num_procs = smpi_comm_size(comm);
23 smpi_mpi_recv(buff, count, data_type, root, tag, comm, MPI_STATUS_IGNORE);
27 reqs = (MPI_Request *) xbt_malloc((num_procs - 1) * sizeof(MPI_Request));
30 // Root sends data to all others
31 for (i = 0; i < num_procs; i++) {
34 *(req_ptr++) = smpi_mpi_isend(buff, count, data_type, i, tag, comm);
37 // wait on all requests
38 smpi_mpi_waitall(num_procs - 1, reqs, MPI_STATUSES_IGNORE);