From 33c10b9c268ca8ac2008a9b49d3ff0e290808d21 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Mon, 1 Oct 2018 15:59:57 +0200 Subject: [PATCH] Test broadcast to dispatch cells --- src/mesh/GmshReader.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/mesh/GmshReader.cpp b/src/mesh/GmshReader.cpp index 5b9e65164..babd97e8c 100644 --- a/src/mesh/GmshReader.cpp +++ b/src/mesh/GmshReader.cpp @@ -305,12 +305,13 @@ GmshReader::GmshReader(const std::string& filename) } if (commSize() > 1) { - pout() << "Sequential mesh read! Need to be dispatched\n"; + pout() << "Sequential mesh read! Need to be dispatched\n" << std::flush; + CSRGraph mesh_graph; + CellValue<int> cell_parts; if (commRank() == 0) { mesh_graph = m_mesh->cellToCellGraph(); - CellValue<int> cell_parts; switch(m_mesh->meshDimension()) { case 1: { @@ -337,8 +338,24 @@ GmshReader::GmshReader(const std::string& filename) std::exit(1); } } - Partitioner P; - cell_parts = P.partition(mesh_graph); + } + + Partitioner P; + Array<int> cell_new_owner = broadcast(P.partition(mesh_graph), 0); + + for (int i_rank=0; i_rank<commSize(); ++i_rank) { + if (commRank() == i_rank) { + size_t cpt=0; + std::cout << i_rank << " -> "; + for (size_t i=0; i<cell_new_owner.size(); ++i) { + if (commRank() == cell_new_owner[i]) { + std::cout << i << ' '; + cpt++; + } + } + std::cout << " [" << cpt << "]\n" << std::flush; + } + barrier(); } Messenger::destroy(); -- GitLab