![]() |
MFEM
v4.2.0
Finite element discretization library
|
Communicator performing operations within groups defined by a GroupTopology with arbitrary-size data associated with each group. More...
#include <communication.hpp>
Classes | |
struct | OpData |
Data structure on which we define reduce operations. The data is associated with (and the operation is performed on) one group at a time. More... | |
Public Types | |
enum | Mode { byGroup, byNeighbor } |
Communication mode. More... | |
Public Member Functions | |
GroupCommunicator (GroupTopology >, Mode m=byNeighbor) | |
Construct a GroupCommunicator object. More... | |
void | Create (const Array< int > &ldof_group) |
Initialize the communicator from a local-dof to group map. Finalize() is called internally. More... | |
Table & | GroupLDofTable () |
Fill-in the returned Table reference to initialize the GroupCommunicator then call Finalize(). More... | |
const Table & | GroupLDofTable () const |
Read-only access to group-ldof Table. More... | |
void | Finalize () |
Allocate internal buffers after the GroupLDofTable is defined. More... | |
void | SetLTDofTable (const Array< int > &ldof_ltdof) |
Initialize the internal group_ltdof Table. More... | |
GroupTopology & | GetGroupTopology () |
Get a reference to the associated GroupTopology object. More... | |
const GroupTopology & | GetGroupTopology () const |
Get a const reference to the associated GroupTopology object. More... | |
void | GetNeighborLTDofTable (Table &nbr_ltdof) const |
Dofs to be sent to communication neighbors. More... | |
void | GetNeighborLDofTable (Table &nbr_ldof) const |
Dofs to be received from communication neighbors. More... | |
template<class T > | |
T * | CopyGroupToBuffer (const T *ldata, T *buf, int group, int layout) const |
Copy the entries corresponding to the group group from the local array ldata to the buffer buf. More... | |
template<class T > | |
const T * | CopyGroupFromBuffer (const T *buf, T *ldata, int group, int layout) const |
Copy the entries corresponding to the group group from the buffer buf to the local array ldata. More... | |
template<class T > | |
const T * | ReduceGroupFromBuffer (const T *buf, T *ldata, int group, int layout, void(*Op)(OpData< T >)) const |
Perform the reduction operation Op to the entries of group group using the values from the buffer buf and the values from the local array ldata, saving the result in the latter. More... | |
template<class T > | |
void | BcastBegin (T *ldata, int layout) const |
Begin a broadcast within each group where the master is the root. More... | |
template<class T > | |
void | BcastEnd (T *ldata, int layout) const |
Finalize a broadcast started with BcastBegin(). More... | |
template<class T > | |
void | Bcast (T *ldata, int layout) const |
Broadcast within each group where the master is the root. More... | |
template<class T > | |
void | Bcast (T *ldata) const |
Broadcast within each group where the master is the root. More... | |
template<class T > | |
void | Bcast (Array< T > &ldata) const |
Broadcast within each group where the master is the root. More... | |
template<class T > | |
void | ReduceBegin (const T *ldata) const |
Begin reduction operation within each group where the master is the root. More... | |
template<class T > | |
void | ReduceEnd (T *ldata, int layout, void(*Op)(OpData< T >)) const |
Finalize reduction operation started with ReduceBegin(). More... | |
template<class T > | |
void | Reduce (T *ldata, void(*Op)(OpData< T >)) const |
Reduce within each group where the master is the root. More... | |
template<class T > | |
void | Reduce (Array< T > &ldata, void(*Op)(OpData< T >)) const |
Reduce within each group where the master is the root. More... | |
void | PrintInfo (std::ostream &out=mfem::out) const |
Print information about the GroupCommunicator from all MPI ranks. More... | |
~GroupCommunicator () | |
Destroy a GroupCommunicator object, deallocating internal data structures and buffers. More... | |
Static Public Member Functions | |
template<class T > | |
static void | Sum (OpData< T >) |
Reduce operation Sum, instantiated for int and double. More... | |
template<class T > | |
static void | Min (OpData< T >) |
Reduce operation Min, instantiated for int and double. More... | |
template<class T > | |
static void | Max (OpData< T >) |
Reduce operation Max, instantiated for int and double. More... | |
template<class T > | |
static void | BitOR (OpData< T >) |
Reduce operation bitwise OR, instantiated for int only. More... | |
Protected Attributes | |
GroupTopology & | gtopo |
Mode | mode |
Table | group_ldof |
Table | group_ltdof |
int | group_buf_size |
Array< char > | group_buf |
MPI_Request * | requests |
int | comm_lock |
int | num_requests |
int * | request_marker |
int * | buf_offsets |
Table | nbr_send_groups |
Table | nbr_recv_groups |
Communicator performing operations within groups defined by a GroupTopology with arbitrary-size data associated with each group.
Definition at line 142 of file communication.hpp.
Communication mode.
Enumerator | |
---|---|
byGroup |
Communications are performed one group at a time. |
byNeighbor |
Communications are performed one neighbor at a time, aggregating over groups. |
Definition at line 146 of file communication.hpp.
mfem::GroupCommunicator::GroupCommunicator | ( | GroupTopology & | gt, |
Mode | m = byNeighbor |
||
) |
Construct a GroupCommunicator object.
The object must be initialized before it can be used to perform any operations. To initialize the object, either
Definition at line 341 of file communication.cpp.
mfem::GroupCommunicator::~GroupCommunicator | ( | ) |
Destroy a GroupCommunicator object, deallocating internal data structures and buffers.
Definition at line 1278 of file communication.cpp.
|
inline |
Broadcast within each group where the master is the root.
The data layout can be either 0 or 1.
For a description of layout, see CopyGroupToBuffer().
Definition at line 270 of file communication.hpp.
|
inline |
Broadcast within each group where the master is the root.
Definition at line 277 of file communication.hpp.
|
inline |
Broadcast within each group where the master is the root.
Definition at line 279 of file communication.hpp.
void mfem::GroupCommunicator::BcastBegin | ( | T * | ldata, |
int | layout | ||
) | const |
Begin a broadcast within each group where the master is the root.
For a description of layout, see CopyGroupToBuffer().
Definition at line 697 of file communication.cpp.
void mfem::GroupCommunicator::BcastEnd | ( | T * | ldata, |
int | layout | ||
) | const |
Finalize a broadcast started with BcastBegin().
The output data layout can be:
For more details about layout, see CopyGroupToBuffer().
Definition at line 834 of file communication.cpp.
|
static |
Reduce operation bitwise OR, instantiated for int only.
Definition at line 1145 of file communication.cpp.
const T * mfem::GroupCommunicator::CopyGroupFromBuffer | ( | const T * | buf, |
T * | ldata, | ||
int | group, | ||
int | layout | ||
) | const |
Copy the entries corresponding to the group group from the buffer buf to the local array ldata.
For a description of layout, see CopyGroupToBuffer().
Definition at line 624 of file communication.cpp.
T * mfem::GroupCommunicator::CopyGroupToBuffer | ( | const T * | ldata, |
T * | buf, | ||
int | group, | ||
int | layout | ||
) | const |
Copy the entries corresponding to the group group from the local array ldata to the buffer buf.
The layout of the local array can be:
{ J[j] : I[group] <= j < I[group+1] }
where I,J=group_ldof.{I,J}
{ j : I[group] <= j < I[group+1] }
where I,J=group_ldof.{I,J}
{ J[j] : I[group] <= j < I[group+1] }
where I,J=group_ltdof.{I,J}
. Definition at line 589 of file communication.cpp.
void mfem::GroupCommunicator::Create | ( | const Array< int > & | ldof_group | ) |
Initialize the communicator from a local-dof to group map. Finalize() is called internally.
Definition at line 353 of file communication.cpp.
void mfem::GroupCommunicator::Finalize | ( | ) |
Allocate internal buffers after the GroupLDofTable is defined.
Definition at line 379 of file communication.cpp.
|
inline |
Get a reference to the associated GroupTopology object.
Definition at line 199 of file communication.hpp.
|
inline |
Get a const reference to the associated GroupTopology object.
Definition at line 202 of file communication.hpp.
void mfem::GroupCommunicator::GetNeighborLDofTable | ( | Table & | nbr_ldof | ) | const |
Dofs to be received from communication neighbors.
Definition at line 552 of file communication.cpp.
void mfem::GroupCommunicator::GetNeighborLTDofTable | ( | Table & | nbr_ltdof | ) | const |
Dofs to be sent to communication neighbors.
Definition at line 516 of file communication.cpp.
|
inline |
Fill-in the returned Table reference to initialize the GroupCommunicator then call Finalize().
Definition at line 185 of file communication.hpp.
|
inline |
Read-only access to group-ldof Table.
Definition at line 188 of file communication.hpp.
|
static |
Reduce operation Max, instantiated for int and double.
Definition at line 1127 of file communication.cpp.
|
static |
Reduce operation Min, instantiated for int and double.
Definition at line 1109 of file communication.cpp.
void mfem::GroupCommunicator::PrintInfo | ( | std::ostream & | out = mfem::out | ) | const |
Print information about the GroupCommunicator from all MPI ranks.
Definition at line 1158 of file communication.cpp.
|
inline |
Reduce within each group where the master is the root.
The reduce operation is given by the second argument (see below for list of the supported operations.)
Definition at line 311 of file communication.hpp.
|
inline |
Reduce within each group where the master is the root.
Definition at line 318 of file communication.hpp.
void mfem::GroupCommunicator::ReduceBegin | ( | const T * | ldata | ) | const |
Begin reduction operation within each group where the master is the root.
The input data layout is an array on all ldofs, i.e. layout 0, see CopyGroupToBuffer().
The reduce operation will be specified when calling ReduceEnd(). This method is instantiated for int and double.
Definition at line 896 of file communication.cpp.
void mfem::GroupCommunicator::ReduceEnd | ( | T * | ldata, |
int | layout, | ||
void(*)(OpData< T >) | Op | ||
) | const |
Finalize reduction operation started with ReduceBegin().
The output data layout can be either 0 or 2, see CopyGroupToBuffer().
The reduce operation is given by the third argument (see below for list of the supported operations.) This method is instantiated for int and double.
Definition at line 1015 of file communication.cpp.
const T * mfem::GroupCommunicator::ReduceGroupFromBuffer | ( | const T * | buf, |
T * | ldata, | ||
int | group, | ||
int | layout, | ||
void(*)(OpData< T >) | Op | ||
) | const |
Perform the reduction operation Op to the entries of group group using the values from the buffer buf and the values from the local array ldata, saving the result in the latter.
For a description of layout, see CopyGroupToBuffer().
Definition at line 658 of file communication.cpp.
void mfem::GroupCommunicator::SetLTDofTable | ( | const Array< int > & | ldof_ltdof | ) |
Initialize the internal group_ltdof Table.
This method must be called before performing operations that use local data layout 2, see CopyGroupToBuffer() for layout descriptions.
Definition at line 488 of file communication.cpp.
|
static |
Reduce operation Sum, instantiated for int and double.
Definition at line 1085 of file communication.cpp.
|
protected |
Definition at line 166 of file communication.hpp.
|
mutableprotected |
Definition at line 163 of file communication.hpp.
|
mutableprotected |
Definition at line 159 of file communication.hpp.
|
protected |
Definition at line 158 of file communication.hpp.
|
protected |
Definition at line 156 of file communication.hpp.
|
protected |
Definition at line 157 of file communication.hpp.
|
protected |
Definition at line 154 of file communication.hpp.
|
protected |
Definition at line 155 of file communication.hpp.
|
protected |
Definition at line 167 of file communication.hpp.
|
protected |
Definition at line 167 of file communication.hpp.
|
mutableprotected |
Definition at line 164 of file communication.hpp.
|
protected |
Definition at line 165 of file communication.hpp.
|
protected |
Definition at line 160 of file communication.hpp.