ug4
|
#include <parallel_nodes.h>
Classes | |
struct | NewSlaveNotification |
struct | OverlapType |
Public Member Functions | |
void | add_new_layouts_to (IndexLayout &newMasterLayout, IndexLayout &newSlaveLayout) |
void | append_nodes_without_comm (size_t n) |
Appending masters (without comm skills) More... | |
pcl::InterfaceCommunicator< IndexLayout > & | comm () const |
void | create_node (const AlgebraID &globalID, int pid) |
void | create_node (const AlgebraID &globalID, size_t localIndex, int pid) |
void | create_node (size_t localIndex, int pid) |
size_t | create_slave_node (const AlgebraID &globalID, int distanceToMasterOrInner) |
size_t | distance_to_master_or_inner (size_t i) const |
size_t | get_local_index_if_available (const AlgebraID &globalIndex, bool &bHasIndex) const |
returns a local index by returning a old local one or a saved created one More... | |
size_t | get_local_index_or_create_new (const AlgebraID &globalIndex, int distanceToMasterOrInner) |
size_t | get_local_index_or_create_new (const AlgebraID &globalIndex, int distanceToMasterOrInner, bool &bCreated) |
get_index_or_create_new: returns a local index by creating and saving a new one or returning an old More... | |
size_t | get_original_size () |
IndexLayout & | get_total_master_layout () |
IndexLayout & | get_total_slave_layout () |
size_t | global_to_local (const AlgebraID &globalIndex) const |
void | insert_into_interface_sorted (std::vector< size_t > &v, IndexLayout::Interface &interface) |
void | insert_into_layout_sorted (std::map< int, std::set< size_t > > &m, IndexLayout &layout) |
void | insert_into_layout_sorted (std::map< int, std::vector< size_t > > &m, IndexLayout &layout) |
bool | is_inner (size_t i) const |
bool | is_master (size_t i) const |
bool | is_master_or_inner (size_t i) const |
bool | is_slave (size_t i) const |
void | issue (pcl::InterfaceCommunicator< IndexLayout > &communicator) |
size_t | local_size () const |
const AlgebraID & | local_to_global (size_t i) const |
const IndexLayout & | master_layout () const |
size_t | operator[] (const AlgebraID &globalIndex) const |
const AlgebraID & | operator[] (size_t i) const |
const OverlapType & | overlap_type (size_t i) |
returns the overlap type (inner, master, slave or distanceToMasterOrInner=X) More... | |
ParallelNodes () | |
ParallelNodes (const ParallelNodes &) | |
ParallelNodes (ConstSmartPtr< AlgebraLayouts > layout, size_t s) | |
void | print () const |
const pcl::ProcessCommunicator & | proc_comm () const |
void | process () |
const IndexLayout & | slave_layout () const |
void | sort_by_global_id (std::vector< size_t > &v) |
void | sort_interface (IndexLayout::Interface &interface) |
void | sort_layout (IndexLayout &layout) |
Private Types | |
typedef std::map< int, BinaryBuffer > | BufferMap |
typedef std::map< AlgebraID, size_t >::const_iterator | const_iterator |
typedef std::map< AlgebraID, size_t >::iterator | iterator |
Private Member Functions | |
void | create_mark_map (const IndexLayout &masterLayout) |
Private Attributes | |
std::map< AlgebraID, size_t > | m_globalToLocal |
ConstSmartPtr< AlgebraLayouts > | m_layout |
std::vector< AlgebraID > | m_localToGlobal |
std::vector< OverlapType > | m_OLtype |
size_t | m_originalSize |
std::set< int > | masterPIDs |
std::map< int, std::set< size_t > > | newMasters |
std::map< int, std::vector< NewSlaveNotification > > | newSlaveNotifications |
std::map< int, std::set< size_t > > | newSlaves |
BufferMap | notificationBufferMap |
std::map< int, std::set< size_t > > | notified |
map for marking nodes More... | |
std::set< int > | slavePIDs |
IndexLayout | totalMasterLayout |
IndexLayout | totalSlaveLayout |
ParallelNodes is a class to provide functions when adding nodes on other processes. Especially it is used in the construction of matrix overlaps, where it can be that process A sends a matrix row to process B containing connections to process C. We need to make sure everyone has the right parallel connections afterwards without the need to have an all-to-all communication
|
private |
|
private |
|
private |
ug::ParallelNodes::ParallelNodes | ( | ) |
ug::ParallelNodes::ParallelNodes | ( | const ParallelNodes & | ) |
ug::ParallelNodes::ParallelNodes | ( | ConstSmartPtr< AlgebraLayouts > | layout, |
size_t | s | ||
) |
References pcl::AddLayout(), ug::GenerateGlobalAlgebraIDs(), pcl::ProcRank(), s, and UG_ASSERT.
void ug::ParallelNodes::add_new_layouts_to | ( | IndexLayout & | newMasterLayout, |
IndexLayout & | newSlaveLayout | ||
) |
PN created some new master and slave nodes. now we add them to another layout (we communicate the changes to the outside world)
newMasterLayout | |
newSlaveLayout |
Referenced by ug::GenerateOverlapClass< matrix_type >::communicate().
void ug::ParallelNodes::append_nodes_without_comm | ( | size_t | n | ) |
Appending masters (without comm skills)
References pcl::ProcRank(), and UG_ASSERT.
|
inline |
References m_layout.
|
private |
|
inline |
void ug::ParallelNodes::create_node | ( | const AlgebraID & | globalID, |
size_t | localIndex, | ||
int | pid | ||
) |
create a new node in this ParallelNode structure on processor pid. note that the node referred to by globalID has a processor where it is master on. that is globalID.master(). Now if we create a node on a processor which is no globalID.master(), we need to inform the process globalID.master() that he's getting a new node. The process pid will notice by himself that he needs to add globalID into the slave layout to globalID.master(). This is especially necessary when we are sending matrix rows since a processor A can send a row to processor B with connections to master nodes on processor C.
globalID | |
localIndex | |
pid | where the node is created |
References ug::find(), ug::LIB_ALG_MATRIX, ug::AlgebraID::master_proc(), pcl::ProcRank(), and UG_DLOG.
Referenced by create_node(), and ug::RowSendingScheme< matrix_type >::issue_send().
|
inline |
size_t ug::ParallelNodes::create_slave_node | ( | const AlgebraID & | globalID, |
int | distanceToMasterOrInner | ||
) |
when receiving nodes which get slaves, we call this function to make sure there is a slave interface to master process.
globalID | global ID of possibly new slave |
distanceToMasterOrInner | distance to nearest master node |
References ug::LIB_ALG_MATRIX, ug::AlgebraID::master_proc(), and UG_DLOG.
Referenced by ug::RowSendingScheme< matrix_type >::process().
|
inline |
References m_OLtype.
Referenced by ug::RowSendingScheme< matrix_type >::process().
size_t ug::ParallelNodes::get_local_index_if_available | ( | const AlgebraID & | globalIndex, |
bool & | bHasIndex | ||
) | const |
returns a local index by returning a old local one or a saved created one
References pcl::ProcRank().
Referenced by ug::RowSendingScheme< matrix_type >::process().
size_t ug::ParallelNodes::get_local_index_or_create_new | ( | const AlgebraID & | globalIndex, |
int | distanceToMasterOrInner | ||
) |
size_t ug::ParallelNodes::get_local_index_or_create_new | ( | const AlgebraID & | globalIndex, |
int | distanceToMasterOrInner, | ||
bool & | bCreated | ||
) |
get_index_or_create_new: returns a local index by creating and saving a new one or returning an old
References ug::LIB_ALG_MATRIX, pcl::ProcRank(), and UG_DLOG.
Referenced by ug::NewLayoutCreator::create_slave_node(), and ug::ReceiveMatrix().
|
inline |
References m_originalSize.
|
inline |
References totalMasterLayout.
|
inline |
References totalSlaveLayout.
size_t ug::ParallelNodes::global_to_local | ( | const AlgebraID & | globalIndex | ) | const |
References UG_ASSERT.
Referenced by ug::NewLayoutCreator::create_node(), create_node(), ug::DeserializeRow(), and operator[]().
void ug::ParallelNodes::insert_into_interface_sorted | ( | std::vector< size_t > & | v, |
IndexLayout::Interface & | interface | ||
) |
void ug::ParallelNodes::insert_into_layout_sorted | ( | std::map< int, std::set< size_t > > & | m, |
IndexLayout & | layout | ||
) |
Referenced by ug::NewLayoutCreator::add_new_layouts_to().
void ug::ParallelNodes::insert_into_layout_sorted | ( | std::map< int, std::vector< size_t > > & | m, |
IndexLayout & | layout | ||
) |
|
inline |
References m_OLtype.
|
inline |
References m_OLtype.
|
inline |
References m_OLtype.
|
inline |
References m_OLtype.
void ug::ParallelNodes::issue | ( | pcl::InterfaceCommunicator< IndexLayout > & | communicator | ) |
write all 'i have a new slave to your process' notification into send buffers issue
communicator |
References ug::BinaryBuffer::buffer(), ug::LIB_ALG_MATRIX, pcl::InterfaceCommunicator< TLayout >::receive_raw(), pcl::InterfaceCommunicator< TLayout >::send_raw(), ug::Serialize(), UG_DLOG, and ug::BinaryBuffer::write_pos().
Referenced by ug::RowSendingScheme< matrix_type >::issue_send().
|
inline |
|
inline |
|
inline |
References m_layout.
|
inline |
References global_to_local().
|
inline |
References local_to_global().
|
inline |
returns the overlap type (inner, master, slave or distanceToMasterOrInner=X)
References m_OLtype.
|
inline |
References local_size(), local_to_global(), m_OLtype, and UG_LOG.
|
inline |
References m_layout.
void ug::ParallelNodes::process | ( | ) |
call this when communication has been made. this function processes the received data: here it is the notification about that another processor has a slave to our process, so we need to add a node to masterLayout
References ug::Deserialize(), ug::BinaryBuffer::eof(), ug::ParallelNodes::NewSlaveNotification::id, ug::AlgebraID::index_on_master(), ug::LIB_ALG_MATRIX, ug::AlgebraID::master_proc(), ug::ParallelNodes::NewSlaveNotification::newSlaveOnPID, pcl::ProcRank(), UG_ASSERT, UG_DLOG, and ug::BinaryBuffer::write_pos().
Referenced by ug::RowSendingScheme< matrix_type >::process().
|
inline |
References m_layout.
|
inline |
References CompareIndicesBy(), and m_localToGlobal.
void ug::ParallelNodes::sort_interface | ( | IndexLayout::Interface & | interface | ) |
void ug::ParallelNodes::sort_layout | ( | IndexLayout & | layout | ) |
|
private |
|
private |
Referenced by comm(), master_layout(), proc_comm(), and slave_layout().
|
private |
Referenced by local_size(), local_to_global(), and sort_by_global_id().
|
private |
Referenced by distance_to_master_or_inner(), is_inner(), is_master(), is_master_or_inner(), is_slave(), overlap_type(), and print().
|
private |
Referenced by get_original_size().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
map for marking nodes
for each processor we need to have a list which of our master nodes exist on their processor this is important because we sometimes will need to add them to interfaces
the map serves two functions:
|
private |
|
private |
Referenced by get_total_master_layout().
|
private |
Referenced by get_total_slave_layout().