Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add allgatherv algo from ompi
[simgrid.git] / src / smpi / colls / allgatherv-GB.c
1 #include "colls_private.h"
2
3 // Allgather - gather/bcast algorithm
4 int smpi_coll_tuned_allgatherv_GB(void *send_buff, int send_count,
5                                  MPI_Datatype send_type, void *recv_buff,
6                                  int *recv_counts, int *recv_disps, MPI_Datatype recv_type,
7                                  MPI_Comm comm)
8 {
9   smpi_mpi_gatherv(send_buff, send_count, send_type, recv_buff, recv_counts,
10                    recv_disps, recv_type, 0, comm);
11   int num_procs, i, current, max = 0;
12   num_procs = smpi_comm_size(comm);
13   for (i = 0; i < num_procs; i++) {
14     current = recv_disps[i] + recv_counts[i];
15     if (current > max)
16       max = current;
17   }
18   mpi_coll_bcast_fun(recv_buff, max, recv_type, 0, comm);
19
20   return MPI_SUCCESS;
21 }