|
preCICE
|
contains the data communication abstraction layer. More...
Namespaces | |
| namespace | impl |
| namespace | serialize |
| contains serialization logic | |
Classes | |
| struct | AsVectorTag |
| class | CommunicationFactory |
| class | CommunicationConfiguration |
| Configuration for communication channels between a primary and its secondary ranks. The communication between two solvers is configured in m2n::M2NConfiguration. More... | |
| class | ConnectionInfoPublisher |
| class | ConnectionInfoReader |
| Reads the connection info for the given participant/rank information. More... | |
| class | ConnectionInfoWriter |
| Writes the connection info for the given participant/rank information. More... | |
| class | MPICommunication |
| Provides implementation for basic MPI point-to-point communication. More... | |
| class | MPIDirectCommunication |
| Provides connection methods for processes located in one communicator. More... | |
| class | MPIPortsCommunication |
| Provides connection methods based on MPI ports (part of MPI 2.0). More... | |
| class | MPIPortsCommunicationFactory |
| class | MPIRequest |
| class | MPISinglePortsCommunication |
| Provides connection methods based on MPI ports (part of MPI 2.0). More... | |
| class | MPISinglePortsCommunicationFactory |
| class | Request |
| class | SocketCommunication |
| Implements Communication by using sockets. More... | |
| class | SocketCommunicationFactory |
| class | SocketRequest |
| class | SocketSendQueue |
Typedefs | |
| using | PtrCommunication = std::shared_ptr<Communication> |
| using | PtrCommunicationFactory = std::shared_ptr<CommunicationFactory> |
| using | PtrRequest = std::shared_ptr<Request> |
Functions | |
| void | connectCircularComm (std::string const &participantName, std::string const &tag, int rank, int size, com::Communication &left, com::Communication &right) |
| void | setRankOffset (Rank rankOffset) |
| Set rank offset. | |
| virtual int | adjustRank (Rank rank) const |
| Adjusts the given rank bases on the _rankOffset. | |
| void | sendMesh (Communication &communication, int rankReceiver, const mesh::Mesh &mesh) |
| void | receiveMesh (Communication &communication, int rankSender, mesh::Mesh &mesh) |
| void | broadcastSendMesh (Communication &communication, const mesh::Mesh &mesh) |
| void | broadcastReceiveMesh (Communication &communication, mesh::Mesh &mesh) |
| void | sendConnectionMap (Communication &communication, int rankReceiver, const mesh::Mesh::ConnectionMap &cm) |
| void | receiveConnectionMap (Communication &communication, int rankSender, mesh::Mesh::ConnectionMap &cm) |
| void | broadcastSendConnectionMap (Communication &communication, const mesh::Mesh::ConnectionMap &cm) |
| void | broadcastReceiveConnectionMap (Communication &communication, mesh::Mesh::ConnectionMap &cm) |
| void | sendBoundingBox (Communication &communication, int rankReceiver, const mesh::BoundingBox &bb) |
| void | receiveBoundingBox (Communication &communication, int rankSender, mesh::BoundingBox &bb) |
| void | sendBoundingBoxMap (Communication &communication, int rankReceiver, const mesh::Mesh::BoundingBoxMap &bbm) |
| void | receiveBoundingBoxMap (Communication &communication, int rankSender, mesh::Mesh::BoundingBoxMap &bbm) |
| void | broadcastSendBoundingBoxMap (Communication &communication, const mesh::Mesh::BoundingBoxMap &bbm) |
| void | broadcastReceiveBoundingBoxMap (Communication &communication, mesh::Mesh::BoundingBoxMap &bbm) |
Connection Setup | |
Interface for all interprocess communication classes. By default, communication is done within the local communication space. In order to connect to a different communication space, i.e. coupling participant, the methods acceptConnection() and requestConnection() have to called by the two participants which intend to establish a connection. All following communication and process ranking refers to the remote communication space afterwards. Sending methods prefixed with `a' are asynchronous. It means that they return immediately, even though either the actual sending might have not been started yet or data from user buffer that is being supplied has not been safely stored away (to system buffer) yet. This implies that user buffer cannot be immediately reused (for writing) after asynchronous sending call returns. However, a special corresponding "request" object is returned by all asynchronous sending methods, which could be further used in future in order to properly wait (block execution) until either the corresponding sending request has truly finished or data from user buffer that is being supplied has been safely stored away (to system buffer) and, thus, can be reused (for writing). The main benefit from asynchronous sending methods is their deterministic behavior, i.e. the guarantee that they can never block the execution (return immediately). The two typical scenarios where this comes handy are:
public: Communication &operator=(Communication &&) = delete; / Destructor, empty. virtual ~Communication() = default; / / / Returns true, if a connection to a remote participant has been setup. virtual bool isConnected() { return _isConnected; } /** Returns the number of processes in the remote communicator.
| |
| virtual size_t | getRemoteCommunicatorSize ()=0 |
| 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. | |
Reduction | |
| 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) |
Broadcast | |
| 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) |
Send | |
| virtual void | send (std::string const &itemToSend, Rank rankReceiver)=0 |
| Sends a std::string to process with given rank. | |
| virtual void | send (precice::span< const int > itemsToSend, Rank rankReceiver)=0 |
| Sends an array of integer values. | |
| virtual PtrRequest | aSend (precice::span< const int > itemsToSend, Rank rankReceiver)=0 |
| Asynchronously sends an array of integer values. | |
| virtual void | send (precice::span< const double > itemsToSend, Rank rankReceiver)=0 |
| Sends an array of double values. | |
| virtual PtrRequest | aSend (precice::span< const double > itemsToSend, Rank rankReceiver)=0 |
| Asynchronously sends an array of double values. | |
| virtual void | send (double itemToSend, Rank rankReceiver)=0 |
| Sends a double to process with given rank. | |
| virtual PtrRequest | aSend (const double &itemToSend, Rank rankReceiver)=0 |
| Asynchronously sends a double to process with given rank. | |
| virtual void | send (int itemToSend, Rank rankReceiver)=0 |
| Sends an int to process with given rank. | |
| virtual PtrRequest | aSend (const int &itemToSend, Rank rankReceiver)=0 |
| Asynchronously sends an int to process with given rank. | |
| virtual void | send (bool itemToSend, Rank rankReceiver)=0 |
| Sends a bool to process with given rank. | |
| virtual PtrRequest | aSend (const bool &itemToSend, Rank rankReceiver)=0 |
| Asynchronously sends a bool to process with given rank. | |
Receive | |
| virtual void | receive (std::string &itemToReceive, Rank rankSender)=0 |
| Receives a std::string from process with given rank. | |
| virtual void | receive (precice::span< int > itemsToReceive, Rank rankSender)=0 |
| Receives an array of integer values. | |
| virtual void | receive (precice::span< double > itemsToReceive, Rank rankSender)=0 |
| Receives an array of double values. | |
| virtual PtrRequest | aReceive (precice::span< double > itemsToReceive, int rankSender)=0 |
| Asynchronously receives an array of double values. | |
| virtual void | receive (double &itemToReceive, Rank rankSender)=0 |
| Receives a double from process with given rank. | |
| virtual PtrRequest | aReceive (double &itemToReceive, Rank rankSender)=0 |
| Asynchronously receives a double from process with given rank. | |
| virtual void | receive (int &itemToReceive, Rank rankSender)=0 |
| Receives an int from process with given rank. | |
| virtual PtrRequest | aReceive (int &itemToReceive, Rank rankSender)=0 |
| Asynchronously receives an int from process with given rank. | |
| virtual void | receive (bool &itemToReceive, Rank rankSender)=0 |
| Receives a bool from process with given rank. | |
| virtual PtrRequest | aReceive (bool &itemToReceive, Rank rankSender)=0 |
| Asynchronously receives a bool from process with given rank. | |
Range communication | |
| 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>. | |
Variables | |
| int | _rankOffset = 0 |
| Rank offset for primaries-secondary communication, since ranks are from 0 to size-2. | |
| bool | _isConnected = false |
| logging::Logger | _log {"com::Communication"} |
| template<typename T> | |
| constexpr auto | asVector = Communication::AsVectorTag<T>{} |
| Allows to use Communication::AsVectorTag in a less verbose way. | |
contains the data communication abstraction layer.
| using precice::com::PtrCommunication = std::shared_ptr<Communication> |
Definition at line 11 of file SharedPointer.hpp.
| using precice::com::PtrCommunicationFactory = std::shared_ptr<CommunicationFactory> |
Definition at line 12 of file SharedPointer.hpp.
| using precice::com::PtrRequest = std::shared_ptr<Request> |
Definition at line 13 of file SharedPointer.hpp.
|
pure virtual |
Accepts connection from another communicator, which has to call requestConnection().
Establishes a 1-to-N communication, whereas the acceptor's side is the "1". Contrary to acceptConnectionAsServer(), the other side needs to be a proper communicator with ranks from 0 to N-1. It is not necessary to know this "N" a-priori on the acceptor's side. This communication is used for the 1:1 communication between two primary ranks and for the intra-participant communication. For the last case, setRankOffset() has to be set.
| [in] | acceptorName | Name of calling participant. |
| [in] | requesterName | Name of remote participant to connect to. |
| [in] | tag | Tag for establishing this connection |
| [in] | acceptorRank | Rank of the accepting process, usually the calling one. |
|
pure virtual |
Accepts connection from another communicator, which has to call requestConnectionAsClient().
Establishes a 1-to-N communication, whereas the acceptor's side is the "1". Contrary to acceptConnection(), the other side can have arbitrary ranks. However, we need to know its size "N" a-priori. This communication is only used in PointToPointCommunication, i.e. for the M-to-N communication between two participants.
| [in] | acceptorName | Name of calling participant. |
| [in] | requesterName | Name of remote participant to connect to. |
| [in] | tag | Tag for establishing this connection |
| [in] | acceptorRank | Rank of accepting server, usually the rank of the current process. |
| [in] | requesterCommunicatorSize | Size of the requester (N) |
|
protectedvirtual |
Adjusts the given rank bases on the _rankOffset.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
pure virtual |
Asynchronously receives a bool from process with given rank.
|
pure virtual |
Asynchronously receives a double from process with given rank.
|
pure virtual |
Asynchronously receives an int from process with given rank.
|
pure virtual |
Asynchronously receives an array of double values.
|
pure virtual |
Asynchronously sends a bool to process with given rank.
|
pure virtual |
Asynchronously sends a double to process with given rank.
|
pure virtual |
Asynchronously sends an int to process with given rank.
|
pure virtual |
Asynchronously sends an array of double values.
|
pure virtual |
Asynchronously sends an array of integer values.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
| void precice::com::broadcastReceiveBoundingBoxMap | ( | Communication & | communication, |
| mesh::Mesh::BoundingBoxMap & | bbm ) |
| void precice::com::broadcastReceiveConnectionMap | ( | Communication & | communication, |
| mesh::Mesh::ConnectionMap & | cm ) |
| void precice::com::broadcastReceiveMesh | ( | Communication & | communication, |
| mesh::Mesh & | mesh ) |
| void precice::com::broadcastSendBoundingBoxMap | ( | Communication & | communication, |
| const mesh::Mesh::BoundingBoxMap & | bbm ) |
| void precice::com::broadcastSendConnectionMap | ( | Communication & | communication, |
| const mesh::Mesh::ConnectionMap & | cm ) |
| void precice::com::broadcastSendMesh | ( | Communication & | communication, |
| const mesh::Mesh & | mesh ) |
|
virtual |
Clean-up environment used to establish the communication.
| [in] | acceptorName | Name of calling participant. |
| [in] | requesterName | Name of remote participant to connect to. |
Definition at line 204 of file Communication.hpp.
|
pure virtual |
Disconnects from communication space, i.e. participant.
This method is called on destruction.
| void precice::com::connectCircularComm | ( | std::string const & | participantName, |
| std::string const & | tag, | ||
| int | rank, | ||
| int | size, | ||
| com::Communication & | left, | ||
| com::Communication & | right ) |
Establishes a circular communication for the given participant.
rank "0" connects left to rank "size-1" rank "size" connects right to rank "0"
Definition at line 359 of file Communication.cpp.
| void precice::com::Communication::connectIntraComm | ( | std::string const & | participantName, |
| std::string const & | tag, | ||
| int | rank, | ||
| int | size ) |
Establishes the intra-participant communication connection.
| [in] | participantName | Name of the calling participant. |
| [in] | tag | Tag for establishing this connection |
| [in] | rank | The current rank in the participant |
| [in] | size | Total size of the participant |
Definition at line 14 of file Communication.cpp.
|
pure virtual |
|
virtual |
Prepare environment used to establish the communication.
| [in] | acceptorName | Name of calling participant. |
| [in] | requesterName | Name of remote participant to connect to. |
Definition at line 195 of file Communication.hpp.
|
pure virtual |
Receives a bool from process with given rank.
|
pure virtual |
Receives a double from process with given rank.
|
pure virtual |
Receives an int from process with given rank.
|
pure virtual |
Receives an array of double values.
|
pure virtual |
Receives an array of integer values.
|
pure virtual |
Receives a std::string from process with given rank.
| void precice::com::receiveBoundingBox | ( | Communication & | communication, |
| int | rankSender, | ||
| mesh::BoundingBox & | bb ) |
| void precice::com::receiveBoundingBoxMap | ( | Communication & | communication, |
| int | rankSender, | ||
| mesh::Mesh::BoundingBoxMap & | bbm ) |
| void precice::com::receiveConnectionMap | ( | Communication & | communication, |
| int | rankSender, | ||
| mesh::Mesh::ConnectionMap & | cm ) |
| void precice::com::receiveMesh | ( | Communication & | communication, |
| int | rankSender, | ||
| mesh::Mesh & | mesh ) |
| std::vector< double > precice::com::Communication::receiveRange | ( | Rank | rankSender, |
| AsVectorTag< double > | ) |
Receives a range of doubles as a vector<double>.
Definition at line 341 of file Communication.cpp.
| std::vector< int > precice::com::Communication::receiveRange | ( | Rank | rankSender, |
| AsVectorTag< int > | ) |
Receives a range of ints as a vector<int>.
Definition at line 328 of file Communication.cpp.
|
virtual |
|
virtual |
|
virtual |
Performs a reduce summation on the primary rank, every other rank has to call reduceSum.
|
virtual |
Performs a reduce summation on the rank given by primaryRank.
| auto precice::com::remoteCommunicatorRanks | ( | ) |
Returns a range over all valid remote ranks.
Definition at line 82 of file Communication.hpp.
|
pure virtual |
Connects to another communicator, which has to call acceptConnection().
Establishes a 1-to-N communication, whereas the requestor's side is the "N". Contrary to requestConnectionAsClient(), this side needs to be a proper communicator with ranks from 0 to N-1. All ranks need to call this function. This communication is used for the 1:1 communication between two primary ranks, and for the intra-participant communication.
| [in] | acceptorName | Name of remote participant to connect to. |
| [in] | requesterName | Name of calling participant. |
| [in] | tag | Tag for establishing this connection |
| [in] | requesterRank | Rank of the requester (has to go from 0 to N-1) |
| [in] | requesterCommunicatorSize | Size of the requester (N) |
|
pure virtual |
Connects to another communicator, which has to call acceptConnectionAsServer().
Establishes a 1-to-N communication, whereas the requestor's side is the "N". Contrary to requestConnection(), this side can have arbitrary ranks (e.g. 2,3,7). All ranks need to call this function. This communication is only used in PointToPointCommunication, i.e. for the M-to-N communication between two participants.
| [in] | acceptorName | Name of calling participant. |
| [in] | requesterName | Name of remote participant to connect to |
| [in] | tag | Tag for establishing this connection |
| [in] | acceptorRanks | Set of ranks that accept a connection |
| [in] | requesterRank | Rank that requests the connection, usually the caller's rank |
|
pure virtual |
Sends a bool to process with given rank.
|
pure virtual |
Sends a double to process with given rank.
|
pure virtual |
Sends an int to process with given rank.
|
pure virtual |
Sends an array of double values.
|
pure virtual |
Sends an array of integer values.
|
pure virtual |
Sends a std::string to process with given rank.
| void precice::com::sendBoundingBox | ( | Communication & | communication, |
| int | rankReceiver, | ||
| const mesh::BoundingBox & | bb ) |
| void precice::com::sendBoundingBoxMap | ( | Communication & | communication, |
| int | rankReceiver, | ||
| const mesh::Mesh::BoundingBoxMap & | bbm ) |
| void precice::com::sendConnectionMap | ( | Communication & | communication, |
| int | rankReceiver, | ||
| const mesh::Mesh::ConnectionMap & | cm ) |
| void precice::com::sendMesh | ( | Communication & | communication, |
| int | rankReceiver, | ||
| const mesh::Mesh & | mesh ) |
| void precice::com::Communication::sendRange | ( | precice::span< const double > | itemsToSend, |
| Rank | rankReceiver ) |
Sends a range of doubles (size + content).
Definition at line 310 of file Communication.cpp.
| void precice::com::Communication::sendRange | ( | precice::span< const int > | itemsToSend, |
| Rank | rankReceiver ) |
Sends a range of ints (size + content).
Definition at line 319 of file Communication.cpp.
| void precice::com::setRankOffset | ( | Rank | rankOffset | ) |
Set rank offset.
Definition at line 361 of file Communication.hpp.
|
protected |
Definition at line 370 of file Communication.hpp.
|
private |
Definition at line 376 of file Communication.hpp.
|
protected |
Rank offset for primaries-secondary communication, since ranks are from 0 to size-2.
Definition at line 368 of file Communication.hpp.
|
inlineconstexprprivate |
Allows to use Communication::AsVectorTag in a less verbose way.
Definition at line 381 of file Communication.hpp.