Skip to content
Snippets Groups Projects
Commit a5277ad4 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add more debugging info [ci-skip]

parent 5799d9f2
Branches
No related tags found
1 merge request!204Remove m_cell_global_index from Connectivity
This commit is part of merge request !204. Comments created here will be created in the context of that merge request.
...@@ -201,7 +201,20 @@ ConnectivityDispatcher<Dimension>::_gatherFrom(const ItemValue<DataType, item_ty ...@@ -201,7 +201,20 @@ ConnectivityDispatcher<Dimension>::_gatherFrom(const ItemValue<DataType, item_ty
{ {
std::vector<Array<const DataType>> recv_item_data_by_proc = this->exchange(data_to_gather); std::vector<Array<const DataType>> recv_item_data_by_proc = this->exchange(data_to_gather);
if constexpr (not(std::is_same_v<std::decay_t<DataType>, CellType>)) {
for (size_t i_rank = 0; i_rank < recv_item_data_by_proc.size(); ++i_rank) {
std::cout << "- from " << rang::fgB::cyan << i_rank << ": recv_" << itemName(item_type)
<< "_data_by_proc=" << recv_item_data_by_proc[i_rank] << rang::fg::reset << '\n';
}
}
const auto& recv_id_correspondance_by_proc = this->_dispatchedInfo<item_type>().m_recv_id_correspondance_by_proc; const auto& recv_id_correspondance_by_proc = this->_dispatchedInfo<item_type>().m_recv_id_correspondance_by_proc;
if constexpr (not(std::is_same_v<std::decay_t<DataType>, CellType>)) {
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
std::cout << rang::fgB::green << "* recv_id_correspondance_by_proc[" << i_rank
<< "] = " << recv_id_correspondance_by_proc[i_rank] << rang::fg::reset << '\n';
}
}
Assert(recv_id_correspondance_by_proc.size() == parallel::size()); Assert(recv_id_correspondance_by_proc.size() == parallel::size());
gathered_array = Array<std::remove_const_t<DataType>>(this->_dispatchedInfo<item_type>().m_number_to_id_map.size()); gathered_array = Array<std::remove_const_t<DataType>>(this->_dispatchedInfo<item_type>().m_number_to_id_map.size());
...@@ -372,8 +385,8 @@ ConnectivityDispatcher<Dimension>::_buildSubItemNumbersToRecvByProc() ...@@ -372,8 +385,8 @@ ConnectivityDispatcher<Dimension>::_buildSubItemNumbersToRecvByProc()
}(); }();
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) { for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
std::cout << "sub_ttem_nb " << i_rank << ": " << rang::fgB::magenta << itemName(SubItemOfItemT::item_type) << "->" std::cout << "sub_item_nb_to_send " << i_rank << ": " << rang::fgB::magenta << itemName(SubItemOfItemT::item_type)
<< itemName(SubItemOfItemT::sub_item_type) << ": " << sub_item_numbers_to_send_by_proc[i_rank] << "->" << itemName(SubItemOfItemT::sub_item_type) << ": " << sub_item_numbers_to_send_by_proc[i_rank]
<< rang::fg::reset << '\n'; << rang::fg::reset << '\n';
} }
...@@ -393,6 +406,13 @@ ConnectivityDispatcher<Dimension>::_buildSubItemNumbersToRecvByProc() ...@@ -393,6 +406,13 @@ ConnectivityDispatcher<Dimension>::_buildSubItemNumbersToRecvByProc()
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) { for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
const_sub_item_numbers_to_recv_by_proc[i_rank] = sub_item_numbers_to_recv_by_proc[i_rank]; const_sub_item_numbers_to_recv_by_proc[i_rank] = sub_item_numbers_to_recv_by_proc[i_rank];
} }
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
std::cout << "sub_item_nb_to_recv " << i_rank << ": " << rang::fgB::magenta << itemName(SubItemOfItemT::item_type)
<< "->" << itemName(SubItemOfItemT::sub_item_type) << ": "
<< this->_dispatchedInfo<SubItemOfItemT>().m_sub_item_numbers_to_recv_by_proc[i_rank] << rang::fg::reset
<< '\n';
}
} }
template <size_t Dimension> template <size_t Dimension>
...@@ -403,6 +423,8 @@ ConnectivityDispatcher<Dimension>::_buildItemToSubItemDescriptor() ...@@ -403,6 +423,8 @@ ConnectivityDispatcher<Dimension>::_buildItemToSubItemDescriptor()
constexpr ItemType item_type = ItemOfItemT::item_type; constexpr ItemType item_type = ItemOfItemT::item_type;
constexpr ItemType sub_item_type = ItemOfItemT::sub_item_type; constexpr ItemType sub_item_type = ItemOfItemT::sub_item_type;
constexpr const bool print = (item_type == ItemType::cell) and (sub_item_type == ItemType::node);
const auto& item_list_to_recv_size_by_proc = this->_dispatchedInfo<item_type>().m_list_to_recv_size_by_proc; const auto& item_list_to_recv_size_by_proc = this->_dispatchedInfo<item_type>().m_list_to_recv_size_by_proc;
const auto& number_of_sub_item_per_item_to_recv_by_proc = const auto& number_of_sub_item_per_item_to_recv_by_proc =
...@@ -429,12 +451,17 @@ ConnectivityDispatcher<Dimension>::_buildItemToSubItemDescriptor() ...@@ -429,12 +451,17 @@ ConnectivityDispatcher<Dimension>::_buildItemToSubItemDescriptor()
item_to_subitem_legacy.emplace_back(sub_item_vector); item_to_subitem_legacy.emplace_back(sub_item_vector);
} }
} }
if constexpr (print) {
for (size_t i_rank = 0; i_rank < parallel::size(); ++i_rank) {
std::cout << rang::fgB::magenta << "item_to_subitem_legacy[" << i_rank
<< "] = " << convert_to_array(item_to_subitem_legacy[i_rank]) << rang::fg::reset << '\n';
}
}
Array<unsigned int> item_to_subitem_row_map(item_to_subitem_legacy.size() + 1); Array<unsigned int> item_to_subitem_row_map(item_to_subitem_legacy.size() + 1);
Array<unsigned int> item_to_subitem_list(number_of_node_by_cell); Array<unsigned int> item_to_subitem_list(number_of_node_by_cell);
item_to_subitem_row_map.fill(10000000);
item_to_subitem_list.fill(10000000);
item_to_subitem_row_map[0] = 0; item_to_subitem_row_map[0] = 0;
for (size_t i = 0; i < item_to_subitem_legacy.size(); ++i) { for (size_t i = 0; i < item_to_subitem_legacy.size(); ++i) {
item_to_subitem_row_map[i + 1] = item_to_subitem_row_map[i] + item_to_subitem_legacy[i].size(); item_to_subitem_row_map[i + 1] = item_to_subitem_row_map[i] + item_to_subitem_legacy[i].size();
...@@ -478,15 +505,17 @@ ConnectivityDispatcher<Dimension>::_buildRecvItemIdCorrespondanceByProc() ...@@ -478,15 +505,17 @@ ConnectivityDispatcher<Dimension>::_buildRecvItemIdCorrespondanceByProc()
parallel::exchange(send_item_number_by_proc, recv_item_number_by_proc); parallel::exchange(send_item_number_by_proc, recv_item_number_by_proc);
const auto& item_number_to_id_map = this->_dispatchedInfo<item_type>().m_number_to_id_map; const auto& item_number_to_id_map = this->_dispatchedInfo<item_type>().m_number_to_id_map;
size_t first_new_item_id = 0;
for (size_t i_rank = 0; i_rank < item_list_to_recv_size_by_proc.size(); ++i_rank) { for (size_t i_rank = 0; i_rank < item_list_to_recv_size_by_proc.size(); ++i_rank) {
Array<ItemId> item_id_correspondance(item_list_to_recv_size_by_proc[i_rank]); Array<ItemId> item_id_correspondance(item_list_to_recv_size_by_proc[i_rank]);
for (size_t l = 0; l < item_list_to_recv_size_by_proc[i_rank]; ++l) { for (size_t l = 0; l < item_list_to_recv_size_by_proc[i_rank]; ++l) {
const int& recv_item_number = recv_item_number_by_proc[i_rank][l]; const int& recv_item_number = recv_item_number_by_proc[i_rank][l];
const auto& searched_item_id = item_number_to_id_map.find(recv_item_number); const auto& searched_item_id = item_number_to_id_map.find(recv_item_number);
Assert(searched_item_id != item_number_to_id_map.end()); Assert(searched_item_id != item_number_to_id_map.end());
item_id_correspondance[l] = searched_item_id->second; item_id_correspondance[l] = searched_item_id->second + first_new_item_id;
} }
recv_item_id_correspondance_by_proc[i_rank] = item_id_correspondance; recv_item_id_correspondance_by_proc[i_rank] = item_id_correspondance;
first_new_item_id += item_id_correspondance.size();
} }
this->_dispatchedInfo<item_type>().m_recv_id_correspondance_by_proc = recv_item_id_correspondance_by_proc; this->_dispatchedInfo<item_type>().m_recv_id_correspondance_by_proc = recv_item_id_correspondance_by_proc;
} }
...@@ -812,6 +841,9 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType ...@@ -812,6 +841,9 @@ ConnectivityDispatcher<Dimension>::ConnectivityDispatcher(const ConnectivityType
return cell_number_vector; return cell_number_vector;
}()); }());
std::cout << rang::fgB::green << "cell_number_vector = " << m_new_descriptor.cellNumberVector() << rang::fg::reset
<< "\n";
this->_buildSubItemNumberToIdMap<NodeOfCell>(); this->_buildSubItemNumberToIdMap<NodeOfCell>();
this->_buildItemToExchangeLists<ItemType::node>(); this->_buildItemToExchangeLists<ItemType::node>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment