| 139 | } |
| 140 | |
| 141 | void PMI_PrintMeshcoords(const pmi_mesh_coord_t *pmi_mesh_coord) { |
| 142 | unsigned short all_x_meshcoords[ParallelDescriptor::NProcs()]; |
| 143 | unsigned short all_y_meshcoords[ParallelDescriptor::NProcs()]; |
| 144 | unsigned short all_z_meshcoords[ParallelDescriptor::NProcs()]; |
| 145 | MPI_Gather(&pmi_mesh_coord->mesh_x, |
| 146 | 1, |
| 147 | MPI_UNSIGNED_SHORT, |
| 148 | all_x_meshcoords, |
| 149 | 1, |
| 150 | MPI_UNSIGNED_SHORT, |
| 151 | ParallelDescriptor::IOProcessorNumber(), |
| 152 | ParallelDescriptor::Communicator()); |
| 153 | MPI_Gather(&pmi_mesh_coord->mesh_y, |
| 154 | 1, |
| 155 | MPI_UNSIGNED_SHORT, |
| 156 | all_y_meshcoords, |
| 157 | 1, |
| 158 | MPI_UNSIGNED_SHORT, |
| 159 | ParallelDescriptor::IOProcessorNumber(), |
| 160 | ParallelDescriptor::Communicator()); |
| 161 | MPI_Gather(&pmi_mesh_coord->mesh_z, |
| 162 | 1, |
| 163 | MPI_UNSIGNED_SHORT, |
| 164 | all_z_meshcoords, |
| 165 | 1, |
| 166 | MPI_UNSIGNED_SHORT, |
| 167 | ParallelDescriptor::IOProcessorNumber(), |
| 168 | ParallelDescriptor::Communicator()); |
| 169 | |
| 170 | amrex::Print() << "PMI statistics:" << '\n'; |
| 171 | |
| 172 | std::vector<unsigned short> PMI_x_meshcoord(all_x_meshcoords, all_x_meshcoords + ParallelDescriptor::NProcs()); |
| 173 | std::vector<unsigned short> PMI_y_meshcoord(all_y_meshcoords, all_y_meshcoords + ParallelDescriptor::NProcs()); |
| 174 | std::vector<unsigned short> PMI_z_meshcoord(all_z_meshcoords, all_z_meshcoords + ParallelDescriptor::NProcs()); |
| 175 | |
| 176 | std::ranges::sort(PMI_x_meshcoord); |
| 177 | std::ranges::sort(PMI_y_meshcoord); |
| 178 | std::ranges::sort(PMI_z_meshcoord); |
| 179 | |
| 180 | auto last = std::unique(PMI_x_meshcoord.begin(), PMI_x_meshcoord.end()); |
| 181 | amrex::Print() << "# of unique groups: " << std::distance(PMI_x_meshcoord.begin(), last) << '\n'; |
| 182 | |
| 183 | last = std::unique(PMI_y_meshcoord.begin(), PMI_y_meshcoord.end()); |
| 184 | amrex::Print() << "# of unique groups: " << std::distance(PMI_y_meshcoord.begin(), last) << '\n'; |
| 185 | |
| 186 | last = std::unique(PMI_z_meshcoord.begin(), PMI_z_meshcoord.end()); |
| 187 | amrex::Print() << "# of unique groups: " << std::distance(PMI_z_meshcoord.begin(), last) << '\n'; |
| 188 | } |
| 189 | #endif |
| 190 | |
| 191 | #ifdef BL_USE_MPI |
no test coverage detected