PanNDE
All Classes Namespaces Functions Pages
Public Member Functions | List of all members
NetMPI::MPICommunicator Class Reference

#include "modules/NetMPI/include/MPICommunicator.hpp"

Inheritance diagram for NetMPI::MPICommunicator:
PanNDE::Communicator

Public Member Functions

 MPICommunicator (MPI_Comm comm=MPI_COMM_WORLD)
 
 MPICommunicator (std::shared_ptr< PanNDE::Mesh > mesh, MPI_Comm comm=MPI_COMM_WORLD)
 
 ~MPICommunicator ()
 
void Init (int &argc, char **&argv) override
 
void Init (int &argc, char **&argv, std::shared_ptr< PanNDE::Mesh > mesh) override
 
int getProcessId () override
 
int getGlobalId () override
 
int getNumberOfProcesses () override
 
int getNumberOfAllProcesses () override
 
void Finalize () override
 
void determineExchangePattern (std::shared_ptr< PanNDE::Mesh > mesh) override
 
void setupDataLinks (std::string keyname, std::shared_ptr< PanNDE::Field > field) override
 
void setupDataLinks (std::shared_ptr< PanNDE::FieldBundle > fields) override
 
void startHaloExchange (std::string keyname) override
 
void waitUntilDone (std::string keyname) override
 
void sendArray (std::shared_ptr< PanNDE::Array< double >> array, int receiver) override
 
void sendArray (double *array, int N, int receiver) override
 
std::shared_ptr< PanNDE::Array< double > > recvArray (std::shared_ptr< PanNDE::ArrayFactory< double >> maker, int sender) override
 
void broadcastArray (std::shared_ptr< PanNDE::Array< double >> &array, int sender=0) override
 
void sendArray (std::shared_ptr< PanNDE::Array< int32_t >> array, int receiver) override
 
void sendArray (int32_t *array, int N, int receiver) override
 
std::shared_ptr< PanNDE::Array< int32_t > > recvArray (std::shared_ptr< PanNDE::ArrayFactory< int32_t >> maker, int sender) override
 
void broadcastArray (std::shared_ptr< PanNDE::Array< int32_t >> &array, int sender=0) override
 
void sendArray (std::shared_ptr< PanNDE::Array< int64_t >> array, int receiver) override
 
void sendArray (int64_t *array, int N, int receiver) override
 
std::shared_ptr< PanNDE::Array< int64_t > > recvArray (std::shared_ptr< PanNDE::ArrayFactory< int64_t >> maker, int sender) override
 
void broadcastArray (std::shared_ptr< PanNDE::Array< int64_t >> &array, int sender=0) override
 
void sendValue (double value, int receiver) override
 
void recvValue (double *value, int sender) override
 
void broadcastValue (double *value, int sender=0) override
 
std::shared_ptr< PanNDE::Array< double > > allGatherValue (double value, std::shared_ptr< PanNDE::ArrayFactory< double >> maker) override
 
void sendValue (int32_t value, int receiver) override
 
void recvValue (int32_t *value, int sender) override
 
void broadcastValue (int32_t *value, int sender=0) override
 
std::shared_ptr< PanNDE::Array< int32_t > > allGatherValue (int32_t value, std::shared_ptr< PanNDE::ArrayFactory< int32_t >> maker) override
 
void sendValue (int64_t value, int receiver) override
 
void recvValue (int64_t *value, int sender) override
 
void broadcastValue (int64_t *value, int sender=0) override
 
std::shared_ptr< PanNDE::Array< int64_t > > allGatherValue (int64_t value, std::shared_ptr< PanNDE::ArrayFactory< int64_t >> maker) override
 
void waitall () override
 
void barrier () override
 
- Public Member Functions inherited from PanNDE::Communicator
virtual void Init (int &argc, char **&argv, std::shared_ptr< PanNDE::Mesh > mesh)=0
 
virtual void determineExchangePattern (std::shared_ptr< PanNDE::Mesh > mesh)=0
 
virtual void setupDataLinks (std::string keyname, std::shared_ptr< PanNDE::Field > field)=0
 
virtual void setupDataLinks (std::shared_ptr< PanNDE::FieldBundle > fields)=0
 
virtual void sendArray (std::shared_ptr< PanNDE::Array< double >> array, int receiver)=0
 
virtual std::shared_ptr< PanNDE::Array< double > > recvArray (std::shared_ptr< PanNDE::ArrayFactory< double >> maker, int sender)=0
 
virtual void broadcastArray (std::shared_ptr< PanNDE::Array< double >> &array, int sender=0)=0
 
virtual void sendArray (std::shared_ptr< PanNDE::Array< int32_t >> array, int receiver)=0
 
virtual std::shared_ptr< PanNDE::Array< int32_t > > recvArray (std::shared_ptr< PanNDE::ArrayFactory< int32_t >> maker, int sender)=0
 
virtual void broadcastArray (std::shared_ptr< PanNDE::Array< int32_t >> &array, int sender=0)=0
 
virtual void sendArray (std::shared_ptr< PanNDE::Array< int64_t >> array, int receiver)=0
 
virtual std::shared_ptr< PanNDE::Array< int64_t > > recvArray (std::shared_ptr< PanNDE::ArrayFactory< int64_t >> maker, int sender)=0
 
virtual void broadcastArray (std::shared_ptr< PanNDE::Array< int64_t >> &array, int sender=0)=0
 
virtual std::shared_ptr< PanNDE::Array< double > > allGatherValue (double value, std::shared_ptr< PanNDE::ArrayFactory< double >> maker)=0
 
virtual std::shared_ptr< PanNDE::Array< int32_t > > allGatherValue (int32_t value, std::shared_ptr< PanNDE::ArrayFactory< int32_t >> maker)=0
 
virtual std::shared_ptr< PanNDE::Array< int64_t > > allGatherValue (int64_t value, std::shared_ptr< PanNDE::ArrayFactory< int64_t >> maker)=0
 

Detailed Description

"MPICommunicator.hpp" implements the data communication among processes. This wraps MPI

Constructor & Destructor Documentation

◆ MPICommunicator() [1/2]

NetMPI::MPICommunicator::MPICommunicator ( MPI_Comm  comm = MPI_COMM_WORLD)
inline

constructor

Parameters
commMPI communicator to setup

◆ MPICommunicator() [2/2]

NetMPI::MPICommunicator::MPICommunicator ( std::shared_ptr< PanNDE::Mesh mesh,
MPI_Comm  comm = MPI_COMM_WORLD 
)
inline

constructor

Parameters
meshmesh for comms patterns for halo exchange
commMPI communicator to setup

◆ ~MPICommunicator()

NetMPI::MPICommunicator::~MPICommunicator ( )
inline

destructor

Member Function Documentation

◆ allGatherValue() [1/3]

std::shared_ptr<PanNDE::Array<double> > NetMPI::MPICommunicator::allGatherValue ( double  value,
std::shared_ptr< PanNDE::ArrayFactory< double >>  maker 
)
inlineoverride

all broadcast value for placement in array by process index

Parameters
valuethe value to send
makerthe array factory to build the synthesized array

◆ allGatherValue() [2/3]

std::shared_ptr<PanNDE::Array<int32_t> > NetMPI::MPICommunicator::allGatherValue ( int32_t  value,
std::shared_ptr< PanNDE::ArrayFactory< int32_t >>  maker 
)
inlineoverride

all broadcast value for placement in array by process index

Parameters
valuethe value to send
makerthe array factory to build the synthesized array

◆ allGatherValue() [3/3]

std::shared_ptr<PanNDE::Array<int64_t> > NetMPI::MPICommunicator::allGatherValue ( int64_t  value,
std::shared_ptr< PanNDE::ArrayFactory< int64_t >>  maker 
)
inlineoverride

all broadcast value for placement in array by process index

Parameters
valuethe value to send
makerthe array factory to build the synthesized array

◆ barrier()

void NetMPI::MPICommunicator::barrier ( )
inlineoverridevirtual

wait for all processes to arrive

Implements PanNDE::Communicator.

◆ broadcastArray() [1/3]

void NetMPI::MPICommunicator::broadcastArray ( std::shared_ptr< PanNDE::Array< double >> &  array,
int  sender = 0 
)
inlineoverride

broadcast array by process

Parameters
arraythe array to be either populated or sent
senderprocess which broadcasts the array

◆ broadcastArray() [2/3]

void NetMPI::MPICommunicator::broadcastArray ( std::shared_ptr< PanNDE::Array< int32_t >> &  array,
int  sender = 0 
)
inlineoverride

broadcast array by process

Parameters
arraythe array to be either populated or sent
senderprocess which broadcasts the array

◆ broadcastArray() [3/3]

void NetMPI::MPICommunicator::broadcastArray ( std::shared_ptr< PanNDE::Array< int64_t >> &  array,
int  sender = 0 
)
inlineoverride

broadcast array by process

Parameters
arraythe array to be either populated or sent
senderprocess which broadcasts the array

◆ broadcastValue() [1/3]

void NetMPI::MPICommunicator::broadcastValue ( double *  value,
int  sender = 0 
)
inlineoverridevirtual

broadcast value to all processes

Parameters
valuethe address to which to write (if receiving) or send (if broadcasting)
senderprocess which sent the value

Implements PanNDE::Communicator.

◆ broadcastValue() [2/3]

void NetMPI::MPICommunicator::broadcastValue ( int32_t *  value,
int  sender = 0 
)
inlineoverridevirtual

broadcast value to all processes

Parameters
valuethe address to which to write (if receiving) or send (if broadcasting)
senderprocess which sent the value

Implements PanNDE::Communicator.

◆ broadcastValue() [3/3]

void NetMPI::MPICommunicator::broadcastValue ( int64_t *  value,
int  sender = 0 
)
inlineoverridevirtual

broadcast value to all processes

Parameters
valuethe address to which to write (if receiving) or send (if broadcasting)
senderprocess which sent the value

Implements PanNDE::Communicator.

◆ determineExchangePattern()

void NetMPI::MPICommunicator::determineExchangePattern ( std::shared_ptr< PanNDE::Mesh mesh)
inlineoverride

use the local mesh to determine the halo exchange pattern. Not recommended approach, but retained for backwards compatibility

Parameters
meshthe local mesh from which the communication pattern can be determined

◆ Finalize()

void NetMPI::MPICommunicator::Finalize ( )
inlineoverridevirtual

release commmunicator assets

Implements PanNDE::Communicator.

◆ getGlobalId()

int NetMPI::MPICommunicator::getGlobalId ( )
inlineoverridevirtual

get the id number of the process in the global communicator

Implements PanNDE::Communicator.

◆ getNumberOfAllProcesses()

int NetMPI::MPICommunicator::getNumberOfAllProcesses ( )
inlineoverridevirtual

get the number of processes on the global communicator

Implements PanNDE::Communicator.

◆ getNumberOfProcesses()

int NetMPI::MPICommunicator::getNumberOfProcesses ( )
inlineoverridevirtual

get the number of processes on the local communicator

Implements PanNDE::Communicator.

◆ getProcessId()

int NetMPI::MPICommunicator::getProcessId ( )
inlineoverridevirtual

get the id number of the process in the local communicator

Implements PanNDE::Communicator.

◆ Init() [1/2]

void NetMPI::MPICommunicator::Init ( int &  argc,
char **&  argv 
)
inlineoverridevirtual

Initialize a communicator object. As many initializers (e.g. MPI, VTK, etc.) require the arguments to ‘int main()’, they are passed through here.

Parameters
argcnumber of arguments in argv
argvthe command line arguments provided to int main()

Implements PanNDE::Communicator.

◆ Init() [2/2]

void NetMPI::MPICommunicator::Init ( int &  argc,
char **&  argv,
std::shared_ptr< PanNDE::Mesh mesh 
)
inlineoverride

Initialize a communicator object. As many initializers (e.g. MPI, VTK, etc.) require the arguments to ‘int main()’, they are passed through here. The data exchange pattern can be determined for final configuration if the mesh is passed in

Parameters
argcnumber of arguments in argv
argvthe command line arguments provided to int main()
meshthe local mesh for simulation

◆ recvArray() [1/3]

std::shared_ptr<PanNDE::Array<double> > NetMPI::MPICommunicator::recvArray ( std::shared_ptr< PanNDE::ArrayFactory< double >>  maker,
int  sender 
)
inlineoverride

Receive array from process

Parameters
makerthe array factory method required to build the array
senderprocess which sent the array

◆ recvArray() [2/3]

std::shared_ptr<PanNDE::Array<int32_t> > NetMPI::MPICommunicator::recvArray ( std::shared_ptr< PanNDE::ArrayFactory< int32_t >>  maker,
int  sender 
)
inlineoverride

Receive array from process

Parameters
makerthe array factory method required to build the array
senderprocess which sent the array

◆ recvArray() [3/3]

std::shared_ptr<PanNDE::Array<int64_t> > NetMPI::MPICommunicator::recvArray ( std::shared_ptr< PanNDE::ArrayFactory< int64_t >>  maker,
int  sender 
)
inlineoverride

Receive array from process

Parameters
makerthe array factory method required to build the array
senderprocess which sent the array

◆ recvValue() [1/3]

void NetMPI::MPICommunicator::recvValue ( double *  value,
int  sender 
)
inlineoverridevirtual

receive value from process

Parameters
valuethe address to which to write
senderprocess which sent the value

Implements PanNDE::Communicator.

◆ recvValue() [2/3]

void NetMPI::MPICommunicator::recvValue ( int32_t *  value,
int  sender 
)
inlineoverridevirtual

receive value from process

Parameters
valuethe address to which to write
senderprocess which sent the value

Implements PanNDE::Communicator.

◆ recvValue() [3/3]

void NetMPI::MPICommunicator::recvValue ( int64_t *  value,
int  sender 
)
inlineoverridevirtual

receive value from process

Parameters
valuethe address to which to write
senderprocess which sent the value

Implements PanNDE::Communicator.

◆ sendArray() [1/6]

void NetMPI::MPICommunicator::sendArray ( double *  array,
int  N,
int  receiver 
)
inlineoverridevirtual

Send array to process

Parameters
arraythe array to send
Nthe length of the array
receiverprocess to receive the array

Implements PanNDE::Communicator.

◆ sendArray() [2/6]

void NetMPI::MPICommunicator::sendArray ( int32_t *  array,
int  N,
int  receiver 
)
inlineoverridevirtual

Send array to process

Parameters
arraythe array to send
Nthe length of the array
receiverprocess to receive the array

Implements PanNDE::Communicator.

◆ sendArray() [3/6]

void NetMPI::MPICommunicator::sendArray ( int64_t *  array,
int  N,
int  receiver 
)
inlineoverridevirtual

Send array to process

Parameters
arraythe array to send
Nthe length of the array
receiverprocess to receive the array

Implements PanNDE::Communicator.

◆ sendArray() [4/6]

void NetMPI::MPICommunicator::sendArray ( std::shared_ptr< PanNDE::Array< double >>  array,
int  receiver 
)
inlineoverride

Send array to process

Parameters
arraythe array to send
receiverprocess to receive the array

◆ sendArray() [5/6]

void NetMPI::MPICommunicator::sendArray ( std::shared_ptr< PanNDE::Array< int32_t >>  array,
int  receiver 
)
inlineoverride

Send array to process

Parameters
arraythe array to send
receiverprocess to receive the array

◆ sendArray() [6/6]

void NetMPI::MPICommunicator::sendArray ( std::shared_ptr< PanNDE::Array< int64_t >>  array,
int  receiver 
)
inlineoverride

Send array to process

Parameters
arraythe array to send
receiverprocess to receive the array

◆ sendValue() [1/3]

void NetMPI::MPICommunicator::sendValue ( double  value,
int  receiver 
)
inlineoverridevirtual

send value to process

Parameters
valuethe value to send
receiverprocess to send value

Implements PanNDE::Communicator.

◆ sendValue() [2/3]

void NetMPI::MPICommunicator::sendValue ( int32_t  value,
int  receiver 
)
inlineoverridevirtual

send value to process

Parameters
valuethe value to send
receiverprocess to send value

Implements PanNDE::Communicator.

◆ sendValue() [3/3]

void NetMPI::MPICommunicator::sendValue ( int64_t  value,
int  receiver 
)
inlineoverridevirtual

send value to process

Parameters
valuethe value to send
receiverprocess to send value

Implements PanNDE::Communicator.

◆ setupDataLinks() [1/2]

void NetMPI::MPICommunicator::setupDataLinks ( std::shared_ptr< PanNDE::FieldBundle fields)
inlineoverride

Use the field bundle to determine the exchange pattern and register all fields contained for data exchange.

Parameters
fieldsthe field bundle to set up for halo exchange

◆ setupDataLinks() [2/2]

void NetMPI::MPICommunicator::setupDataLinks ( std::string  keyname,
std::shared_ptr< PanNDE::Field field 
)
inlineoverride

after having determined the exchange pattern, use that pattern to configure the halo exchange for the specific field. Not recommended approach, but retained for backwards compatibility

Parameters
keynamefield name
fieldthe field data to be registered for halo exchange

◆ startHaloExchange()

void NetMPI::MPICommunicator::startHaloExchange ( std::string  keyname)
inlineoverridevirtual

Start asynchronous halo exchange on field by name

Parameters
keynamefield name

Implements PanNDE::Communicator.

◆ waitall()

void NetMPI::MPICommunicator::waitall ( )
inlineoverridevirtual

wait for all transmissions/receptions to complete

Implements PanNDE::Communicator.

◆ waitUntilDone()

void NetMPI::MPICommunicator::waitUntilDone ( std::string  keyname)
inlineoverridevirtual

Wait for completion of halo exchange on field by name

Parameters
keynamefield name

Implements PanNDE::Communicator.


The documentation for this class was generated from the following file: