1 /* Copyright (c) 2013-2019. 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.hpp"
11 Coll_bcast_flattree::bcast(void *buff, int count, MPI_Datatype data_type,
12 int root, MPI_Comm comm)
17 int i, rank, num_procs;
18 int tag = COLL_TAG_BCAST;
21 num_procs = comm->size();
24 Request::recv(buff, count, data_type, root, tag, comm, MPI_STATUS_IGNORE);
28 reqs = (MPI_Request *) xbt_malloc((num_procs - 1) * sizeof(MPI_Request));
31 // Root sends data to all others
32 for (i = 0; i < num_procs; i++) {
35 *(req_ptr++) = Request::isend(buff, count, data_type, i, tag, comm);
38 // wait on all requests
39 Request::waitall(num_procs - 1, reqs, MPI_STATUSES_IGNORE);