preCICE v3.1.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
precice::com::MPICommunication Class Referenceabstract

Provides implementation for basic MPI point-to-point communication. More...

#include <MPICommunication.hpp>

Inheritance diagram for precice::com::MPICommunication:
[legend]
Collaboration diagram for precice::com::MPICommunication:
[legend]

Public Member Functions

 MPICommunication ()
 
virtual ~MPICommunication ()
 Destructor, empty.
 
virtual void send (std::string const &itemToSend, Rank rankReceiver) override
 Sends a std::string to process with given rank.
 
virtual void send (precice::span< const int > itemsToSend, Rank rankReceiver) override
 Sends an array of integer values.
 
virtual PtrRequest aSend (precice::span< const int > itemsToSend, Rank rankReceiver) override
 Asynchronously sends an array of integer values.
 
virtual void send (precice::span< const double > itemsToSend, Rank rankReceiver) override
 Sends an array of double values.
 
virtual PtrRequest aSend (precice::span< const double > itemsToSend, Rank rankReceiver) override
 Asynchronously sends an array of double values.
 
virtual void send (double itemToSend, Rank rankReceiver) override
 Sends a double to process with given rank.
 
virtual PtrRequest aSend (const double &itemToSend, Rank rankReceiver) override
 Asynchronously sends a double to process with given rank.
 
virtual void send (int itemToSend, Rank rankReceiver) override
 Sends an int to process with given rank.
 
virtual PtrRequest aSend (const int &itemToSend, Rank rankReceiver) override
 Asynchronously sends an int to process with given rank.
 
virtual void send (bool itemToSend, Rank rankReceiver) override
 Sends a bool to process with given rank.
 
virtual PtrRequest aSend (const bool &itemToSend, Rank rankReceiver) override
 Asynchronously sends a bool to process with given rank.
 
virtual void receive (std::string &itemToReceive, Rank rankSender) override
 Receives a std::string from process with given rank.
 
virtual void receive (precice::span< int > itemsToReceive, Rank rankSender) override
 Receives an array of integer values.
 
virtual void receive (precice::span< double > itemsToReceive, Rank rankSender) override
 Receives an array of double values.
 
virtual PtrRequest aReceive (precice::span< double > itemsToReceive, int rankSender) override
 Asynchronously receives an array of double values.
 
virtual void receive (double &itemToReceive, Rank rankSender) override
 Receives a double from process with given rank.
 
virtual PtrRequest aReceive (double &itemToReceive, Rank rankSender) override
 Asynchronously receives a double from process with given rank.
 
virtual void receive (int &itemToReceive, Rank rankSender) override
 Receives an int from process with given rank.
 
virtual PtrRequest aReceive (int &itemToReceive, Rank rankSender) override
 Asynchronously receives an int from process with given rank.
 
virtual void receive (bool &itemToReceive, Rank rankSender) override
 Receives a bool from process with given rank.
 
virtual PtrRequest aReceive (bool &itemToReceive, Rank rankSender) override
 Asynchronously receives a bool from process with given rank.
 
- Public Member Functions inherited from precice::com::Communication
Communicationoperator= (Communication &&)=delete
 
virtual ~Communication ()
 Destructor, empty.
 
void setRankOffset (Rank rankOffset)
 Set rank offset.
 
virtual bool isConnected ()
 Returns true, if a connection to a remote participant has been setup.
 
virtual size_t getRemoteCommunicatorSize ()=0
 Returns the number of processes in the remote communicator.
 
auto remoteCommunicatorRanks ()
 Returns a range over all valid remote ranks.
 
virtual void acceptConnection (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int acceptorRank, int rankOffset=0)=0
 Accepts connection from another communicator, which has to call requestConnection().
 
virtual void acceptConnectionAsServer (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int acceptorRank, int requesterCommunicatorSize)=0
 Accepts connection from another communicator, which has to call requestConnectionAsClient().
 
virtual void requestConnection (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int requesterRank, int requesterCommunicatorSize)=0
 Connects to another communicator, which has to call acceptConnection().
 
virtual void requestConnectionAsClient (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, std::set< int > const &acceptorRanks, int requesterRank)=0
 Connects to another communicator, which has to call acceptConnectionAsServer().
 
void connectIntraComm (std::string const &participantName, std::string const &tag, int rank, int size)
 
virtual void closeConnection ()=0
 Disconnects from communication space, i.e. participant.
 
virtual void prepareEstablishment (std::string const &acceptorName, std::string const &requesterName)
 Prepare environment used to establish the communication.
 
virtual void cleanupEstablishment (std::string const &acceptorName, std::string const &requesterName)
 Clean-up environment used to establish the communication.
 
virtual void reduceSum (precice::span< double const > itemsToSend, precice::span< double > itemsToReceive, Rank primaryRank)
 Performs a reduce summation on the rank given by primaryRank.
 
virtual void reduceSum (precice::span< double const > itemsToSend, precice::span< double > itemsToReceive)
 Performs a reduce summation on the primary rank, every other rank has to call reduceSum.
 
virtual void reduceSum (int itemToSend, int &itemToReceive, Rank primaryRank)
 
virtual void reduceSum (int itemsToSend, int &itemsToReceive)
 
virtual void allreduceSum (precice::span< double const > itemsToSend, precice::span< double > itemsToReceive, Rank primaryRank)
 
virtual void allreduceSum (precice::span< double const > itemsToSend, precice::span< double > itemsToReceive)
 
virtual void allreduceSum (double itemToSend, double &itemToReceive, Rank primaryRank)
 
virtual void allreduceSum (double itemToSend, double &itemToReceive)
 
virtual void allreduceSum (int itemToSend, int &itemToReceive, Rank primaryRank)
 
virtual void allreduceSum (int itemToSend, int &itemToReceive)
 
virtual void broadcast (precice::span< const int > itemsToSend)
 
virtual void broadcast (precice::span< int > itemsToReceive, Rank rankBroadcaster)
 
virtual void broadcast (int itemToSend)
 
virtual void broadcast (int &itemToReceive, Rank rankBroadcaster)
 
virtual void broadcast (precice::span< const double > itemsToSend)
 
virtual void broadcast (precice::span< double > itemsToReceive, Rank rankBroadcaster)
 
virtual void broadcast (double itemToSend)
 
virtual void broadcast (double &itemToReceive, Rank rankBroadcaster)
 
virtual void broadcast (bool itemToSend)
 
virtual void broadcast (bool &itemToReceive, Rank rankBroadcaster)
 
virtual void broadcast (std::vector< int > const &v)
 
virtual void broadcast (std::vector< int > &v, Rank rankBroadcaster)
 
virtual void broadcast (std::vector< double > const &v)
 
virtual void broadcast (std::vector< double > &v, Rank rankBroadcaster)
 
void sendRange (precice::span< const double > itemsToSend, Rank rankReceiver)
 Sends a range of doubles (size + content)
 
void sendRange (precice::span< const int > itemsToSend, Rank rankReceiver)
 Sends a range of ints (size + content)
 
std::vector< int > receiveRange (Rank rankSender, AsVectorTag< int >)
 Receives a range of ints as a vector<int>
 
std::vector< double > receiveRange (Rank rankSender, AsVectorTag< double >)
 Receives a range of doubles as a vector<double>
 

Protected Member Functions

virtual MPI_Commcommunicator (Rank rank)=0
 Returns the communicator.
 
virtual Rank rank (int rank)=0
 
- Protected Member Functions inherited from precice::com::Communication
virtual int adjustRank (Rank rank) const
 Adjusts the given rank bases on the _rankOffset.
 

Private Attributes

logging::Logger _log {"com::MPICommunication"}
 

Additional Inherited Members

- Protected Attributes inherited from precice::com::Communication
int _rankOffset = 0
 Rank offset for primaries-secondary communication, since ranks are from 0 to size-2.
 
bool _isConnected = false
 

Detailed Description

Provides implementation for basic MPI point-to-point communication.

The methods for establishing a connection between two coupling participants are not implemented and left to subclasses.

Definition at line 21 of file MPICommunication.hpp.

Constructor & Destructor Documentation

◆ MPICommunication()

precice::com::MPICommunication::MPICommunication ( )
default

◆ ~MPICommunication()

virtual precice::com::MPICommunication::~MPICommunication ( )
inlinevirtual

Destructor, empty.

Definition at line 26 of file MPICommunication.hpp.

Member Function Documentation

◆ aReceive() [1/4]

PtrRequest precice::com::MPICommunication::aReceive ( bool & itemToReceive,
Rank rankSender )
overridevirtual

Asynchronously receives a bool from process with given rank.

Implements precice::com::Communication.

Definition at line 315 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ aReceive() [2/4]

PtrRequest precice::com::MPICommunication::aReceive ( double & itemToReceive,
Rank rankSender )
overridevirtual

Asynchronously receives a double from process with given rank.

Implements precice::com::Communication.

Definition at line 261 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ aReceive() [3/4]

PtrRequest precice::com::MPICommunication::aReceive ( int & itemToReceive,
Rank rankSender )
overridevirtual

Asynchronously receives an int from process with given rank.

Implements precice::com::Communication.

Definition at line 282 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ aReceive() [4/4]

PtrRequest precice::com::MPICommunication::aReceive ( precice::span< double > itemsToReceive,
int rankSender )
overridevirtual

Asynchronously receives an array of double values.

Implements precice::com::Communication.

Definition at line 228 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ aSend() [1/5]

PtrRequest precice::com::MPICommunication::aSend ( const bool & itemToSend,
Rank rankReceiver )
overridevirtual

Asynchronously sends a bool to process with given rank.

Implements precice::com::Communication.

Definition at line 161 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ aSend() [2/5]

PtrRequest precice::com::MPICommunication::aSend ( const double & itemToSend,
Rank rankReceiver )
overridevirtual

Asynchronously sends a double to process with given rank.

Implements precice::com::Communication.

Definition at line 127 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ aSend() [3/5]

PtrRequest precice::com::MPICommunication::aSend ( const int & itemToSend,
Rank rankReceiver )
overridevirtual

Asynchronously sends an int to process with given rank.

Implements precice::com::Communication.

Definition at line 144 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ aSend() [4/5]

PtrRequest precice::com::MPICommunication::aSend ( precice::span< const double > itemsToSend,
Rank rankReceiver )
overridevirtual

Asynchronously sends an array of double values.

Implements precice::com::Communication.

Definition at line 98 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ aSend() [5/5]

PtrRequest precice::com::MPICommunication::aSend ( precice::span< const int > itemsToSend,
Rank rankReceiver )
overridevirtual

Asynchronously sends an array of integer values.

Implements precice::com::Communication.

Definition at line 69 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ communicator()

virtual MPI_Comm & precice::com::MPICommunication::communicator ( Rank rank)
protectedpure virtual

◆ rank()

virtual Rank precice::com::MPICommunication::rank ( int rank)
protectedpure virtual

◆ receive() [1/6]

void precice::com::MPICommunication::receive ( bool & itemToReceive,
Rank rankSender )
overridevirtual

Receives a bool from process with given rank.

Default MPI point-to-point communication is used.

Implements precice::com::Communication.

Definition at line 299 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ receive() [2/6]

void precice::com::MPICommunication::receive ( double & itemToReceive,
Rank rankSender )
overridevirtual

Receives a double from process with given rank.

Default MPI point-to-point communication is used.

Implements precice::com::Communication.

Definition at line 245 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ receive() [3/6]

void precice::com::MPICommunication::receive ( int & itemToReceive,
Rank rankSender )
overridevirtual

Receives an int from process with given rank.

Default MPI point-to-point communication is used.

Implements precice::com::Communication.

Definition at line 266 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ receive() [4/6]

void precice::com::MPICommunication::receive ( precice::span< double > itemsToReceive,
Rank rankSender )
overridevirtual

Receives an array of double values.

Implements precice::com::Communication.

Definition at line 213 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ receive() [5/6]

void precice::com::MPICommunication::receive ( precice::span< int > itemsToReceive,
Rank rankSender )
overridevirtual

Receives an array of integer values.

Implements precice::com::Communication.

Definition at line 198 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ receive() [6/6]

void precice::com::MPICommunication::receive ( std::string & itemToReceive,
Rank rankSender )
overridevirtual

Receives a std::string from process with given rank.

Default MPI point-to-point communication is used.

Implements precice::com::Communication.

Definition at line 178 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ send() [1/6]

void precice::com::MPICommunication::send ( bool itemToSend,
Rank rankReceiver )
overridevirtual

Sends a bool to process with given rank.

Default MPI point-to-point communication is used.

Implements precice::com::Communication.

Definition at line 149 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ send() [2/6]

void precice::com::MPICommunication::send ( double itemToSend,
Rank rankReceiver )
overridevirtual

Sends a double to process with given rank.

Default MPI point-to-point communication is used.

Implements precice::com::Communication.

Definition at line 115 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ send() [3/6]

void precice::com::MPICommunication::send ( int itemToSend,
Rank rankReceiver )
overridevirtual

Sends an int to process with given rank.

Default MPI point-to-point communication is used.

Implements precice::com::Communication.

Definition at line 132 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ send() [4/6]

void precice::com::MPICommunication::send ( precice::span< const double > itemsToSend,
Rank rankReceiver )
overridevirtual

Sends an array of double values.

Implements precice::com::Communication.

Definition at line 86 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ send() [5/6]

void precice::com::MPICommunication::send ( precice::span< const int > itemsToSend,
Rank rankReceiver )
overridevirtual

Sends an array of integer values.

Implements precice::com::Communication.

Definition at line 57 of file MPICommunication.cpp.

Here is the call graph for this function:

◆ send() [6/6]

void precice::com::MPICommunication::send ( std::string const & itemToSend,
Rank rankReceiver )
overridevirtual

Sends a std::string to process with given rank.

Default MPI point-to-point communication is used.

Implements precice::com::Communication.

Definition at line 44 of file MPICommunication.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _log

logging::Logger precice::com::MPICommunication::_log {"com::MPICommunication"}
private

Definition at line 132 of file MPICommunication.hpp.


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