preCICE v3.1.2
|
Provides implementation for basic MPI point-to-point communication. More...
#include <MPICommunication.hpp>
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 | |
Communication & | operator= (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_Comm & | communicator (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 |
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.
|
default |
|
inlinevirtual |
Destructor, empty.
Definition at line 26 of file MPICommunication.hpp.
|
overridevirtual |
Asynchronously receives a bool from process with given rank.
Implements precice::com::Communication.
Definition at line 315 of file MPICommunication.cpp.
|
overridevirtual |
Asynchronously receives a double from process with given rank.
Implements precice::com::Communication.
Definition at line 261 of file MPICommunication.cpp.
|
overridevirtual |
Asynchronously receives an int from process with given rank.
Implements precice::com::Communication.
Definition at line 282 of file MPICommunication.cpp.
|
overridevirtual |
Asynchronously receives an array of double values.
Implements precice::com::Communication.
Definition at line 228 of file MPICommunication.cpp.
|
overridevirtual |
Asynchronously sends a bool to process with given rank.
Implements precice::com::Communication.
Definition at line 161 of file MPICommunication.cpp.
|
overridevirtual |
Asynchronously sends a double to process with given rank.
Implements precice::com::Communication.
Definition at line 127 of file MPICommunication.cpp.
|
overridevirtual |
Asynchronously sends an int to process with given rank.
Implements precice::com::Communication.
Definition at line 144 of file MPICommunication.cpp.
|
overridevirtual |
Asynchronously sends an array of double values.
Implements precice::com::Communication.
Definition at line 98 of file MPICommunication.cpp.
|
overridevirtual |
Asynchronously sends an array of integer values.
Implements precice::com::Communication.
Definition at line 69 of file MPICommunication.cpp.
Returns the communicator.
Implemented in precice::com::MPIPortsCommunication, precice::com::MPISinglePortsCommunication, and precice::com::MPIDirectCommunication.
|
protectedpure virtual |
|
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.
|
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.
|
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.
|
overridevirtual |
Receives an array of double values.
Implements precice::com::Communication.
Definition at line 213 of file MPICommunication.cpp.
|
overridevirtual |
Receives an array of integer values.
Implements precice::com::Communication.
Definition at line 198 of file MPICommunication.cpp.
|
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.
|
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.
|
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.
|
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.
|
overridevirtual |
Sends an array of double values.
Implements precice::com::Communication.
Definition at line 86 of file MPICommunication.cpp.
|
overridevirtual |
Sends an array of integer values.
Implements precice::com::Communication.
Definition at line 57 of file MPICommunication.cpp.
|
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.
|
private |
Definition at line 132 of file MPICommunication.hpp.