#include <ParCommGraph.hpp>
Public Types | |
enum | TypeGraph { INITIAL_MIGRATE , COVERAGE , DOF_BASED } |
Public Member Functions | |
virtual | ~ParCommGraph () |
ParCommGraph (MPI_Comm joincomm, MPI_Group group1, MPI_Group group2, int coid1, int coid2) | |
collective constructor, will be called on all sender tasks and receiver tasks More... | |
ParCommGraph (const ParCommGraph &) | |
copy constructor will copy only the senders, receivers, compid1, etc More... | |
ErrorCode | compute_trivial_partition (std::vector< int > &numElemsPerTaskInGroup1) |
Based on the number of elements on each task in group 1, partition for group 2, trivially. More... | |
ErrorCode | pack_receivers_graph (std::vector< int > &packed_recv_array) |
pack information about receivers view of the graph, for future sending to receiver root More... | |
bool | is_root_sender () |
bool | is_root_receiver () |
int | sender (int index) |
int | receiver (int index) |
int | get_component_id1 () |
int | get_component_id2 () |
int | get_context_id () |
void | set_context_id (int other_id) |
EntityHandle | get_cover_set () |
void | set_cover_set (EntityHandle cover) |
ErrorCode | split_owned_range (int sender_rank, Range &owned) |
ErrorCode | split_owned_range (Range &owned) |
ErrorCode | send_graph (MPI_Comm jcomm) |
ErrorCode | send_graph_partition (ParallelComm *pco, MPI_Comm jcomm) |
ErrorCode | send_mesh_parts (MPI_Comm jcomm, ParallelComm *pco, Range &owned) |
ErrorCode | receive_comm_graph (MPI_Comm jcomm, ParallelComm *pco, std::vector< int > &pack_array) |
ErrorCode | receive_mesh (MPI_Comm jcomm, ParallelComm *pco, EntityHandle local_set, std::vector< int > &senders_local) |
ErrorCode | release_send_buffers () |
ErrorCode | send_tag_values (MPI_Comm jcomm, ParallelComm *pco, Range &owned, std::vector< Tag > &tag_handles) |
ErrorCode | receive_tag_values (MPI_Comm jcomm, ParallelComm *pco, Range &owned, std::vector< Tag > &tag_handles) |
const std::vector< int > & | senders () |
const std::vector< int > & | receivers () |
ErrorCode | settle_send_graph (TupleList &TLcovIDs) |
void | SetReceivingAfterCoverage (std::map< int, std::set< int > > &idsFromProcs) |
void | settle_comm_by_ids (int comp, TupleList &TLBackToComp, std::vector< int > &valuesComp) |
ErrorCode | set_split_ranges (int comp, TupleList &TLBackToComp1, std::vector< int > &valuesComp1, int lenTag, Range &ents_of_interest, int type) |
ErrorCode | form_tuples_to_migrate_mesh (Interface *mb, TupleList &TLv, TupleList &TLc, int type, int lenTagType1) |
ErrorCode | form_mesh_from_tuples (Interface *mb, TupleList &TLv, TupleList &TLc, int type, int lenTagType1, EntityHandle fset, Range &primary_ents, std::vector< int > &values_entities) |
ErrorCode | compute_partition (ParallelComm *pco, Range &owned, int met) |
ErrorCode | dump_comm_information (std::string prefix, int is_send) |
Private Member Functions | |
void | find_group_ranks (MPI_Group group, MPI_Comm join, std::vector< int > &ranks) |
find ranks of a group with respect to an encompassing communicator More... | |
Private Attributes | |
MPI_Comm | comm |
std::vector< int > | senderTasks |
std::vector< int > | receiverTasks |
bool | rootSender |
bool | rootReceiver |
int | rankInGroup1 |
int | rankInGroup2 |
int | rankInJoin |
int | joinSize |
int | compid1 |
int | compid2 |
int | context_id |
EntityHandle | cover_set |
std::map< int, std::vector< int > > | recv_graph |
std::map< int, std::vector< int > > | recv_sizes |
std::map< int, std::vector< int > > | sender_graph |
std::map< int, std::vector< int > > | sender_sizes |
std::vector< ParallelComm::Buffer * > | localSendBuffs |
int * | comm_graph |
std::map< int, Range > | split_ranges |
std::vector< MPI_Request > | sendReqs |
std::vector< int > | corr_tasks |
std::vector< int > | corr_sizes |
TypeGraph | graph_type |
std::map< int, std::vector< int > > | involved_IDs_map |
std::map< int, std::vector< int > > | map_index |
std::map< int, std::vector< int > > | map_ptr |
Definition at line 55 of file ParCommGraph.hpp.
Enumerator | |
---|---|
INITIAL_MIGRATE | |
COVERAGE | |
DOF_BASED |
Definition at line 58 of file ParCommGraph.hpp.
|
virtual |
Definition at line 73 of file ParCommGraph.cpp.
moab::ParCommGraph::ParCommGraph | ( | MPI_Comm | joincomm, |
MPI_Group | group1, | ||
MPI_Group | group2, | ||
int | coid1, | ||
int | coid2 | ||
) |
collective constructor, will be called on all sender tasks and receiver tasks
[in] | joincomm | joint MPI communicator that covers both sender and receiver MPI groups |
[in] | group1 | MPI group formed with sender tasks; (sender usually loads the mesh in a migrate scenario) |
[in] | group2 | MPI group formed with receiver tasks; (receiver usually receives the mesh in a migrate scenario) |
[in] | coid1 | sender component unique identifier in a coupled application (in climate simulations could be the Atmosphere Comp id = 5 or Ocean Comp ID , 17) |
[in] | coid2 | receiver component unique identifier in a coupled application (it is usually the coupler, 2, in E3SM) |
this graph will be formed on sender and receiver tasks, and, in principle, will hold info about how the local entities are distributed on the other side
Its major role is to help in migration of data, from component to the coupler and vice-versa; Each local entity has a corresponding task (or tasks) on the other side, to where the data needs to be sent
important data stored in ParCommGraph, immediately it is created
Definition at line 20 of file ParCommGraph.cpp.
References comm, comm_graph, context_id, cover_set, find_group_ranks(), graph_type, INITIAL_MIGRATE, joinSize, rankInGroup1, rankInGroup2, rankInJoin, receiverTasks, rootReceiver, rootSender, and senderTasks.
moab::ParCommGraph::ParCommGraph | ( | const ParCommGraph & | src | ) |
copy constructor will copy only the senders, receivers, compid1, etc
Definition at line 53 of file ParCommGraph.cpp.
References comm, comm_graph, compid1, compid2, context_id, cover_set, graph_type, joinSize, rankInGroup1, rankInGroup2, rankInJoin, receiverTasks, rootReceiver, rootSender, and senderTasks.
ErrorCode moab::ParCommGraph::compute_partition | ( | ParallelComm * | pco, |
Range & | owned, | ||
int | met | ||
) |
Definition at line 1129 of file ParCommGraph.cpp.
References moab::Range::begin(), moab::ProcConfig::crystal_router(), moab::Range::empty(), moab::TupleList::enableWriteAccess(), moab::Range::end(), ErrorCode, moab::ParallelComm::get_moab(), moab::TupleList::get_n(), moab::ParallelComm::get_shared_entities(), moab::ParallelComm::get_sharing_data(), moab::TupleList::inc_n(), moab::TupleList::initialize(), MAX_SHARING_PROCS, mb, MB_CHK_ERR, MB_SUCCESS, ZoltanPartitioner::partition_owned_cells(), moab::TupleList::print_to_file(), moab::ParallelComm::proc_config(), moab::ParallelComm::rank(), moab::Range::rbegin(), receiverTasks, rootSender, moab::Range::size(), split_ranges, moab::Range::subset_by_dimension(), moab::TupleList::vi_rd, moab::TupleList::vi_wr, moab::TupleList::vul_rd, and moab::TupleList::vul_wr.
ErrorCode moab::ParCommGraph::compute_trivial_partition | ( | std::vector< int > & | numElemsPerTaskInGroup1 | ) |
Based on the number of elements on each task in group 1, partition for group 2, trivially.
Operations: it is called on every receiver task; decides how are all elements distributed
Note: establish how many elements are sent from each task in group 1 to tasks in group 2 This call is usually made on a root / master process, and will construct local maps that are member data, which contain the communication graph, in both directions Also, number of elements migrated/exchanged between each sender/receiver
[in] | numElemsPerTaskInGroup1 | (std::vector<int> &) number of elements on each sender task |
Definition at line 100 of file ParCommGraph.cpp.
References MB_SUCCESS, receiverTasks, recv_graph, recv_sizes, sender_graph, sender_sizes, and senderTasks.
ErrorCode moab::ParCommGraph::dump_comm_information | ( | std::string | prefix, |
int | is_send | ||
) |
Definition at line 1601 of file ParCommGraph.cpp.
References COVERAGE, DOF_BASED, graph_type, INITIAL_MIGRATE, involved_IDs_map, MB_SUCCESS, rankInGroup1, rankInGroup2, rankInJoin, moab::Range::size(), and split_ranges.
|
private |
find ranks of a group with respect to an encompassing communicator
Operations: Local, usually called on root process of the group
[in] | joincomm | (MPI_Comm) |
[in] | group | (MPI_Group) |
[out] | ranks | ( std::vector<int>) ranks with respect to the joint communicator |
Definition at line 81 of file ParCommGraph.cpp.
Referenced by ParCommGraph().
ErrorCode moab::ParCommGraph::form_mesh_from_tuples | ( | Interface * | mb, |
TupleList & | TLv, | ||
TupleList & | TLc, | ||
int | type, | ||
int | lenTagType1, | ||
EntityHandle | fset, | ||
Range & | primary_ents, | ||
std::vector< int > & | values_entities | ||
) |
Definition at line 1391 of file ParCommGraph.cpp.
References ErrorCode, moab::TupleList::get_n(), moab::Range::insert(), mb, MB_CHK_ERR, MB_CHK_SET_ERR, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_INTEGER, MBPOLYGON, MBQUAD, MBTRI, moab::Range::size(), split_ranges, moab::TupleList::vi_rd, and moab::TupleList::vr_rd.
ErrorCode moab::ParCommGraph::form_tuples_to_migrate_mesh | ( | Interface * | mb, |
TupleList & | TLv, | ||
TupleList & | TLc, | ||
int | type, | ||
int | lenTagType1 | ||
) |
Definition at line 1304 of file ParCommGraph.cpp.
References moab::Range::begin(), moab::TupleList::enableWriteAccess(), moab::Range::end(), ErrorCode, moab::TupleList::get_n(), moab::TupleList::inc_n(), moab::TupleList::initialize(), mb, MB_CHK_ERR, MB_SUCCESS, moab::Range::size(), split_ranges, moab::TupleList::vi_wr, and moab::TupleList::vr_wr.
|
inline |
Definition at line 153 of file ParCommGraph.hpp.
References compid1.
|
inline |
Definition at line 157 of file ParCommGraph.hpp.
References compid2.
|
inline |
Definition at line 162 of file ParCommGraph.hpp.
References context_id.
|
inline |
Definition at line 171 of file ParCommGraph.hpp.
References cover_set.
|
inline |
Definition at line 138 of file ParCommGraph.hpp.
References rootReceiver.
|
inline |
Definition at line 133 of file ParCommGraph.hpp.
References rootSender.
Referenced by send_graph(), send_graph_partition(), and send_mesh_parts().
ErrorCode moab::ParCommGraph::pack_receivers_graph | ( | std::vector< int > & | packed_recv_array | ) |
pack information about receivers view of the graph, for future sending to receiver root
Operations: Local, called on root process of the senders group
[out] | packed_recv_array | packed data will be sent to the root of receivers, and distributed from there, and will have this information, for each receiver, concatenated receiver 1 task, number of senders for receiver 1, then sender tasks for receiver 1, receiver 2 task, number of senders for receiver 2, sender tasks for receiver 2, etc Note: only the root of senders will compute this, and send it over to the receiver root, which will distribute it over each receiver; We do not pack the sizes of data to be sent, only the senders for each of the receivers (could be of size O(n^2) , where n is the number of tasks ; but in general, it should be more like O(n) ). Each sender sends to a "finite" number of receivers, and each receiver receives from a finite number of senders). We need this info to decide how to set up the send/receive waiting game for non-blocking communication ) |
Definition at line 189 of file ParCommGraph.cpp.
References MB_SUCCESS, receiverTasks, recv_graph, and senders().
Referenced by send_graph().
ErrorCode moab::ParCommGraph::receive_comm_graph | ( | MPI_Comm | jcomm, |
ParallelComm * | pco, | ||
std::vector< int > & | pack_array | ||
) |
Definition at line 357 of file ParCommGraph.cpp.
References moab::ParallelComm::comm(), MB_SUCCESS, rootReceiver, and sender().
ErrorCode moab::ParCommGraph::receive_mesh | ( | MPI_Comm | jcomm, |
ParallelComm * | pco, | ||
EntityHandle | local_set, | ||
std::vector< int > & | senders_local | ||
) |
Definition at line 410 of file ParCommGraph.cpp.
References moab::Interface::add_entities(), moab::Range::begin(), buffer, corr_sizes, corr_tasks, moab::AEntityFactory::create_vert_elem_adjacencies(), moab::Range::empty(), moab::Range::end(), entities, ErrorCode, moab::ParallelComm::get_moab(), mb, MB_CHK_ERR, MB_CHK_SET_ERR, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_INTEGER, MBVERTEX, moab::Range::merge(), moab::AEntityFactory::notify_create_entity(), rankInJoin, moab::Range::size(), split_ranges, moab::Range::subset_by_type(), moab::subtract(), moab::Interface::tag_get_handle(), moab::Interface::tag_set_data(), moab::ParallelComm::unpack_buffer(), moab::AEntityFactory::vert_elem_adjacencies(), and moab::Interface::write_file().
ErrorCode moab::ParCommGraph::receive_tag_values | ( | MPI_Comm | jcomm, |
ParallelComm * | pco, | ||
Range & | owned, | ||
std::vector< Tag > & | tag_handles | ||
) |
Get the size of the specified tag in bytes
Definition at line 782 of file ParCommGraph.cpp.
References moab::Range::begin(), buffer, COVERAGE, DOF_BASED, moab::Range::end(), ErrorCode, moab::ParallelComm::get_moab(), graph_type, INITIAL_MIGRATE, involved_IDs_map, map_index, map_ptr, mb, MB_CHK_ERR, MB_SUCCESS, rankInJoin, sendReqs, moab::Range::size(), and split_ranges.
|
inline |
Definition at line 148 of file ParCommGraph.hpp.
References receiverTasks.
Referenced by send_graph().
|
inline |
Definition at line 210 of file ParCommGraph.hpp.
References receiverTasks.
Referenced by split_owned_range().
ErrorCode moab::ParCommGraph::release_send_buffers | ( | ) |
Definition at line 557 of file ParCommGraph.cpp.
References comm_graph, localSendBuffs, MB_SUCCESS, and sendReqs.
ErrorCode moab::ParCommGraph::send_graph | ( | MPI_Comm | jcomm | ) |
use tag 10 to send size and tag 20 to send the packed array
Definition at line 265 of file ParCommGraph.cpp.
References comm_graph, ErrorCode, is_root_sender(), MB_SUCCESS, pack_receivers_graph(), receiver(), and sendReqs.
Referenced by send_graph_partition().
ErrorCode moab::ParCommGraph::send_graph_partition | ( | ParallelComm * | pco, |
MPI_Comm | jcomm | ||
) |
Definition at line 1500 of file ParCommGraph.cpp.
References buffer, moab::ParallelComm::comm(), compid1, compid2, ErrorCode, is_root_sender(), MB_CHK_ERR, MB_SUCCESS, recv_graph, send_graph(), senders(), senderTasks, and split_ranges.
ErrorCode moab::ParCommGraph::send_mesh_parts | ( | MPI_Comm | jcomm, |
ParallelComm * | pco, | ||
Range & | owned | ||
) |
not anymore !
Definition at line 299 of file ParCommGraph.cpp.
References buffer, corr_sizes, corr_tasks, ErrorCode, moab::Interface::get_adjacencies(), moab::ParallelComm::get_moab(), moab::ParallelComm::INITIAL_BUFF_SIZE, is_root_sender(), localSendBuffs, MB_SUCCESS, moab::Range::merge(), moab::ParallelComm::pack_buffer(), rankInGroup1, sender_graph, sender_sizes, senderTasks, sendReqs, split_owned_range(), split_ranges, and moab::Interface::UNION.
ErrorCode moab::ParCommGraph::send_tag_values | ( | MPI_Comm | jcomm, |
ParallelComm * | pco, | ||
Range & | owned, | ||
std::vector< Tag > & | tag_handles | ||
) |
Get the size of the specified tag in bytes
Definition at line 577 of file ParCommGraph.cpp.
References moab::Range::begin(), buffer, COVERAGE, DOF_BASED, moab::Range::end(), ErrorCode, moab::ParallelComm::get_moab(), graph_type, INITIAL_MIGRATE, involved_IDs_map, localSendBuffs, map_index, map_ptr, mb, MB_CHK_ERR, MB_SET_ERR, MB_SUCCESS, rankInJoin, sendReqs, moab::Range::size(), and split_ranges.
|
inline |
Definition at line 143 of file ParCommGraph.hpp.
References senderTasks.
Referenced by receive_comm_graph().
|
inline |
Definition at line 206 of file ParCommGraph.hpp.
References senderTasks.
Referenced by pack_receivers_graph(), and send_graph_partition().
|
inline |
Definition at line 166 of file ParCommGraph.hpp.
References context_id.
|
inline |
Definition at line 175 of file ParCommGraph.hpp.
References cover_set.
ErrorCode moab::ParCommGraph::set_split_ranges | ( | int | comp, |
TupleList & | TLBackToComp1, | ||
std::vector< int > & | valuesComp1, | ||
int | lenTag, | ||
Range & | ents_of_interest, | ||
int | type | ||
) |
Definition at line 1259 of file ParCommGraph.cpp.
References moab::TupleList::get_n(), MB_SUCCESS, rootSender, moab::Range::size(), split_ranges, and moab::TupleList::vi_wr.
void moab::ParCommGraph::SetReceivingAfterCoverage | ( | std::map< int, std::set< int > > & | idsFromProcs | ) |
Definition at line 1017 of file ParCommGraph.cpp.
References COVERAGE, graph_type, and involved_IDs_map.
void moab::ParCommGraph::settle_comm_by_ids | ( | int | comp, |
TupleList & | TLBackToComp, | ||
std::vector< int > & | valuesComp | ||
) |
Definition at line 1037 of file ParCommGraph.cpp.
References DOF_BASED, moab::GeomUtil::first(), moab::TupleList::get_n(), graph_type, involved_IDs_map, map_index, map_ptr, rankInJoin, rootReceiver, rootSender, and moab::TupleList::vi_wr.
Definition at line 989 of file ParCommGraph.cpp.
References COVERAGE, moab::TupleList::get_n(), graph_type, involved_IDs_map, MB_SUCCESS, and moab::TupleList::vi_wr.
Definition at line 217 of file ParCommGraph.cpp.
References moab::Range::begin(), moab::Range::insert(), MB_SUCCESS, receivers(), sender_graph, sender_sizes, senderTasks, split_ranges, and moab::subtract().
Referenced by send_mesh_parts().
Definition at line 243 of file ParCommGraph.cpp.
References moab::Range::begin(), corr_sizes, corr_tasks, moab::Range::insert(), MB_SUCCESS, split_ranges, and moab::subtract().
|
private |
Definition at line 263 of file ParCommGraph.hpp.
Referenced by ParCommGraph().
|
private |
Definition at line 288 of file ParCommGraph.hpp.
Referenced by ParCommGraph(), release_send_buffers(), and send_graph().
|
private |
Definition at line 270 of file ParCommGraph.hpp.
Referenced by get_component_id1(), ParCommGraph(), and send_graph_partition().
|
private |
Definition at line 270 of file ParCommGraph.hpp.
Referenced by get_component_id2(), ParCommGraph(), and send_graph_partition().
|
private |
Definition at line 271 of file ParCommGraph.hpp.
Referenced by get_context_id(), ParCommGraph(), and set_context_id().
|
private |
Definition at line 302 of file ParCommGraph.hpp.
Referenced by receive_mesh(), send_mesh_parts(), and split_owned_range().
|
private |
Definition at line 300 of file ParCommGraph.hpp.
Referenced by receive_mesh(), send_mesh_parts(), and split_owned_range().
|
private |
Definition at line 272 of file ParCommGraph.hpp.
Referenced by get_cover_set(), ParCommGraph(), and set_cover_set().
|
private |
Definition at line 308 of file ParCommGraph.hpp.
Referenced by dump_comm_information(), ParCommGraph(), receive_tag_values(), send_tag_values(), SetReceivingAfterCoverage(), settle_comm_by_ids(), and settle_send_graph().
|
private |
Definition at line 309 of file ParCommGraph.hpp.
Referenced by dump_comm_information(), receive_tag_values(), send_tag_values(), SetReceivingAfterCoverage(), settle_comm_by_ids(), and settle_send_graph().
|
private |
Definition at line 269 of file ParCommGraph.hpp.
Referenced by ParCommGraph().
|
private |
Definition at line 285 of file ParCommGraph.hpp.
Referenced by release_send_buffers(), send_mesh_parts(), and send_tag_values().
|
private |
Definition at line 312 of file ParCommGraph.hpp.
Referenced by receive_tag_values(), send_tag_values(), and settle_comm_by_ids().
|
private |
Definition at line 313 of file ParCommGraph.hpp.
Referenced by receive_tag_values(), send_tag_values(), and settle_comm_by_ids().
|
private |
Definition at line 268 of file ParCommGraph.hpp.
Referenced by dump_comm_information(), ParCommGraph(), and send_mesh_parts().
|
private |
Definition at line 268 of file ParCommGraph.hpp.
Referenced by dump_comm_information(), and ParCommGraph().
|
private |
Definition at line 269 of file ParCommGraph.hpp.
Referenced by dump_comm_information(), ParCommGraph(), receive_mesh(), receive_tag_values(), send_tag_values(), and settle_comm_by_ids().
|
private |
Definition at line 265 of file ParCommGraph.hpp.
Referenced by compute_partition(), compute_trivial_partition(), pack_receivers_graph(), ParCommGraph(), receiver(), and receivers().
|
private |
Definition at line 277 of file ParCommGraph.hpp.
Referenced by compute_trivial_partition(), pack_receivers_graph(), and send_graph_partition().
|
private |
Definition at line 279 of file ParCommGraph.hpp.
Referenced by compute_trivial_partition().
|
private |
Definition at line 267 of file ParCommGraph.hpp.
Referenced by is_root_receiver(), ParCommGraph(), receive_comm_graph(), and settle_comm_by_ids().
|
private |
Definition at line 266 of file ParCommGraph.hpp.
Referenced by compute_partition(), is_root_sender(), ParCommGraph(), set_split_ranges(), and settle_comm_by_ids().
|
private |
Definition at line 281 of file ParCommGraph.hpp.
Referenced by compute_trivial_partition(), send_mesh_parts(), and split_owned_range().
|
private |
Definition at line 283 of file ParCommGraph.hpp.
Referenced by compute_trivial_partition(), send_mesh_parts(), and split_owned_range().
|
private |
Definition at line 264 of file ParCommGraph.hpp.
Referenced by compute_trivial_partition(), ParCommGraph(), send_graph_partition(), send_mesh_parts(), sender(), senders(), and split_owned_range().
|
private |
Definition at line 296 of file ParCommGraph.hpp.
Referenced by receive_tag_values(), release_send_buffers(), send_graph(), send_mesh_parts(), and send_tag_values().
|
private |
Definition at line 294 of file ParCommGraph.hpp.
Referenced by compute_partition(), dump_comm_information(), form_mesh_from_tuples(), form_tuples_to_migrate_mesh(), receive_mesh(), receive_tag_values(), send_graph_partition(), send_mesh_parts(), send_tag_values(), set_split_ranges(), and split_owned_range().