1 #include "colls_private.h"
3 int flattree_segment_in_byte = 8192;
6 smpi_coll_tuned_bcast_flattree_pipeline(void *buff, int count,
7 MPI_Datatype data_type, int root,
10 int i, j, rank, num_procs;
14 extent = smpi_datatype_get_extent(data_type);
16 int segment = flattree_segment_in_byte / extent;
17 int pipe_length = count / segment;
18 int increment = segment * extent;
20 rank = smpi_comm_rank(comm);
21 num_procs = smpi_comm_size(comm);
23 MPI_Request *request_array;
24 MPI_Status *status_array;
26 request_array = (MPI_Request *) xbt_malloc(pipe_length * sizeof(MPI_Request));
27 status_array = (MPI_Status *) xbt_malloc(pipe_length * sizeof(MPI_Status));
30 for (i = 0; i < pipe_length; i++) {
31 request_array[i] = smpi_mpi_irecv((char *)buff + (i * increment), segment, data_type, root, tag, comm);
33 smpi_mpi_waitall(pipe_length, request_array, status_array);
37 // Root sends data to all others
38 for (j = 0; j < num_procs; j++) {
42 for (i = 0; i < pipe_length; i++) {
43 smpi_mpi_send((char *)buff + (i * increment), segment, data_type, j, tag, comm);