preCICE
Loading...
Searching...
No Matches
precice::com::MPIPortsCommunication Class Reference

Provides connection methods based on MPI ports (part of MPI 2.0). More...

#include <MPIPortsCommunication.hpp>

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

Public Member Functions

 MPIPortsCommunication (std::string addressDirectory=".")
 ~MPIPortsCommunication () override
size_t getRemoteCommunicatorSize () override
void acceptConnection (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int acceptorRank, int rankOffset=0) override
void acceptConnectionAsServer (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int acceptorRank, int requesterCommunicatorSize) override
void requestConnection (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, int requesterRank, int requesterCommunicatorSize) override
void requestConnectionAsClient (std::string const &acceptorName, std::string const &requesterName, std::string const &tag, std::set< int > const &acceptorRanks, int requesterRank) override
void closeConnection () override
void prepareEstablishment (std::string const &acceptorName, std::string const &requesterName) override
void cleanupEstablishment (std::string const &acceptorName, std::string const &requesterName) override
Public Member Functions inherited from precice::com::MPICommunication
 MPICommunication ()
 ~MPICommunication () override=default
 Destructor, empty.
void send (std::string const &itemToSend, Rank rankReceiver) override
 Sends a std::string to process with given rank.
void send (precice::span< const int > itemsToSend, Rank rankReceiver) override
 Sends an array of integer values.
PtrRequest aSend (precice::span< const int > itemsToSend, Rank rankReceiver) override
 Asynchronously sends an array of integer values.
void send (precice::span< const double > itemsToSend, Rank rankReceiver) override
 Sends an array of double values.
PtrRequest aSend (precice::span< const double > itemsToSend, Rank rankReceiver) override
 Asynchronously sends an array of double values.
void send (double itemToSend, Rank rankReceiver) override
 Sends a double to process with given rank.
PtrRequest aSend (const double &itemToSend, Rank rankReceiver) override
 Asynchronously sends a double to process with given rank.
void send (int itemToSend, Rank rankReceiver) override
 Sends an int to process with given rank.
PtrRequest aSend (const int &itemToSend, Rank rankReceiver) override
 Asynchronously sends an int to process with given rank.
void send (bool itemToSend, Rank rankReceiver) override
 Sends a bool to process with given rank.
PtrRequest aSend (const bool &itemToSend, Rank rankReceiver) override
 Asynchronously sends a bool to process with given rank.
void receive (std::string &itemToReceive, Rank rankSender) override
 Receives a std::string from process with given rank.
void receive (precice::span< int > itemsToReceive, Rank rankSender) override
 Receives an array of integer values.
void receive (precice::span< double > itemsToReceive, Rank rankSender) override
 Receives an array of double values.
PtrRequest aReceive (precice::span< double > itemsToReceive, int rankSender) override
 Asynchronously receives an array of double values.
void receive (double &itemToReceive, Rank rankSender) override
 Receives a double from process with given rank.
PtrRequest aReceive (double &itemToReceive, Rank rankSender) override
 Asynchronously receives a double from process with given rank.
void receive (int &itemToReceive, Rank rankSender) override
 Receives an int from process with given rank.
PtrRequest aReceive (int &itemToReceive, Rank rankSender) override
 Asynchronously receives an int from process with given rank.
void receive (bool &itemToReceive, Rank rankSender) override
 Receives a bool from process with given rank.
PtrRequest aReceive (bool &itemToReceive, Rank rankSender) override
 Asynchronously receives a bool from process with given rank.

Private Member Functions

MPI_Commcommunicator (Rank rank) override
 Returns the communicator.
Rank rank (int rank) override

Private Attributes

logging::Logger _log {"com::MPIPortsCommunication"}
std::string _addressDirectory
std::map< int, MPI_Comm_communicators
 Remote rank -> communicator map.
std::string _portName = std::string(MPI_MAX_PORT_NAME, '\0')
 Name of the port used for connection.
bool _isAcceptor = false

Detailed Description

Provides connection methods based on MPI ports (part of MPI 2.0).

The two participants to be connected can be run in two process groups started up individually, i.e. not within the same process group.

Definition at line 21 of file MPIPortsCommunication.hpp.

Constructor & Destructor Documentation

◆ MPIPortsCommunication()

precice::com::MPIPortsCommunication::MPIPortsCommunication ( std::string addressDirectory = ".")
explicit

Definition at line 18 of file MPIPortsCommunication.cpp.

◆ ~MPIPortsCommunication()

precice::com::MPIPortsCommunication::~MPIPortsCommunication ( )
override

Definition at line 26 of file MPIPortsCommunication.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ acceptConnection()

void precice::com::MPIPortsCommunication::acceptConnection ( std::string const & acceptorName,
std::string const & requesterName,
std::string const & tag,
int acceptorRank,
int rankOffset = 0 )
override

Definition at line 39 of file MPIPortsCommunication.cpp.

Here is the call graph for this function:

◆ acceptConnectionAsServer()

void precice::com::MPIPortsCommunication::acceptConnectionAsServer ( std::string const & acceptorName,
std::string const & requesterName,
std::string const & tag,
int acceptorRank,
int requesterCommunicatorSize )
override

Definition at line 105 of file MPIPortsCommunication.cpp.

Here is the call graph for this function:

◆ cleanupEstablishment()

void precice::com::MPIPortsCommunication::cleanupEstablishment ( std::string const & acceptorName,
std::string const & requesterName )
override

Definition at line 252 of file MPIPortsCommunication.cpp.

Here is the call graph for this function:

◆ closeConnection()

void precice::com::MPIPortsCommunication::closeConnection ( )
override

Definition at line 220 of file MPIPortsCommunication.cpp.

Here is the call graph for this function:

◆ communicator()

MPI_Comm & precice::com::MPIPortsCommunication::communicator ( Rank rank)
overrideprivatevirtual

Returns the communicator.

Implements precice::com::MPICommunication.

Definition at line 265 of file MPIPortsCommunication.cpp.

Here is the call graph for this function:

◆ getRemoteCommunicatorSize()

size_t precice::com::MPIPortsCommunication::getRemoteCommunicatorSize ( )
override

Definition at line 32 of file MPIPortsCommunication.cpp.

◆ prepareEstablishment()

void precice::com::MPIPortsCommunication::prepareEstablishment ( std::string const & acceptorName,
std::string const & requesterName )
override

Definition at line 239 of file MPIPortsCommunication.cpp.

Here is the call graph for this function:

◆ rank()

int precice::com::MPIPortsCommunication::rank ( int rank)
overrideprivatevirtual

Implements precice::com::MPICommunication.

Definition at line 272 of file MPIPortsCommunication.cpp.

Here is the call graph for this function:

◆ requestConnection()

void precice::com::MPIPortsCommunication::requestConnection ( std::string const & acceptorName,
std::string const & requesterName,
std::string const & tag,
int requesterRank,
int requesterCommunicatorSize )
override

Definition at line 151 of file MPIPortsCommunication.cpp.

Here is the call graph for this function:

◆ requestConnectionAsClient()

void precice::com::MPIPortsCommunication::requestConnectionAsClient ( std::string const & acceptorName,
std::string const & requesterName,
std::string const & tag,
std::set< int > const & acceptorRanks,
int requesterRank )
override

Definition at line 189 of file MPIPortsCommunication.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _addressDirectory

std::string precice::com::MPIPortsCommunication::_addressDirectory
private

Definition at line 68 of file MPIPortsCommunication.hpp.

◆ _communicators

std::map<int, MPI_Comm> precice::com::MPIPortsCommunication::_communicators
private

Remote rank -> communicator map.

Definition at line 71 of file MPIPortsCommunication.hpp.

◆ _isAcceptor

bool precice::com::MPIPortsCommunication::_isAcceptor = false
private

Definition at line 76 of file MPIPortsCommunication.hpp.

◆ _log

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

Definition at line 66 of file MPIPortsCommunication.hpp.

◆ _portName

std::string precice::com::MPIPortsCommunication::_portName = std::string(MPI_MAX_PORT_NAME, '\0')
private

Name of the port used for connection.

Definition at line 74 of file MPIPortsCommunication.hpp.


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