11 const std::vector<int> &location_dependencies,
12 std::vector<std::vector<int>> &global_dependencies)
17 std::vector<int> depcount_per_loc(P, 0);
18 int current_loc_dep_count = location_dependencies.size();
19 MPI_Allgather(¤t_loc_dep_count,
21 depcount_per_loc.data(),
26 std::vector<int> raw_depvec_displs(P, 0);
27 int recv_buf_size = depcount_per_loc[0];
28 for (
int locI=1; locI<P; ++locI)
30 raw_depvec_displs[locI] = raw_depvec_displs[locI-1] + depcount_per_loc[locI-1];
31 recv_buf_size += depcount_per_loc[locI];
34 std::vector<int> raw_dependencies(recv_buf_size,0);
36 MPI_Allgatherv(location_dependencies.data(),
37 int(location_dependencies.size()),
39 raw_dependencies.data(),
40 depcount_per_loc.data(),
41 raw_depvec_displs.data(),
45 for (
int locI=0; locI<P; ++locI)
47 global_dependencies[locI].resize(depcount_per_loc[locI], 0);
48 for (
int c=0; c < depcount_per_loc[locI]; ++c)
50 int addr = raw_depvec_displs[locI] + c;
51 global_dependencies[locI][c] = raw_dependencies[addr];
static chi::MPI_Info & mpi
const MPI_Comm & comm
MPI communicator.
const int & process_count
Total number of processes.
void CommunicateLocationDependencies(const std::vector< int > &location_dependencies, std::vector< std::vector< int > > &global_dependencies)