fpmas 1.6
Public Member Functions | Protected Attributes | List of all members
fpmas::communication::MpiCommunicatorBase Class Reference

#include <communication.h>

Inheritance diagram for fpmas::communication::MpiCommunicatorBase:
Inheritance graph
[legend]
Collaboration diagram for fpmas::communication::MpiCommunicatorBase:
Collaboration graph
[legend]

Public Member Functions

MPI_Comm getMpiComm () const
 
MPI_Group getMpiGroup () const
 
int getRank () const override
 
int getSize () const override
 
void send (const void *data, int count, MPI_Datatype datatype, int destination, int tag) override
 
void send (const DataPack &data, MPI_Datatype datatype, int destination, int tag) override
 
void send (int destination, int tag) override
 
void Isend (const void *data, int count, MPI_Datatype datatype, int destination, int tag, Request &req) override
 
void Isend (const DataPack &data, MPI_Datatype datatype, int destination, int tag, Request &req) override
 
void Isend (int destination, int tag, Request &req) override
 
void Issend (const void *data, int count, MPI_Datatype datatype, int destination, int tag, Request &req) override
 
void Issend (const DataPack &data, MPI_Datatype datatype, int destination, int tag, Request &req) override
 
void Issend (int destination, int tag, Request &req) override
 
void recv (int source, int tag, Status &status=Status::IGNORE) override
 
void recv (void *buffer, int count, MPI_Datatype datatype, int source, int tag, Status &status=Status::IGNORE) override
 
void recv (DataPack &data, MPI_Datatype datatype, int source, int tag, Status &status=Status::IGNORE) override
 
void probe (MPI_Datatype type, int source, int tag, Status &) override
 
bool Iprobe (MPI_Datatype type, int source, int tag, Status &) override
 
bool test (Request &req) override
 
void wait (Request &req) override
 
void waitAll (std::vector< Request > &req) override
 
std::unordered_map< int, DataPackallToAll (std::unordered_map< int, DataPack > export_map, MPI_Datatype datatype) override
 
std::vector< DataPackgather (DataPack data, MPI_Datatype datatype, int root) override
 
std::vector< DataPackallGather (DataPack data, MPI_Datatype datatype) override
 
DataPack bcast (DataPack data, MPI_Datatype datatype, int root) override
 
void barrier () override
 
virtual int getRank () const =0
 
virtual int getSize () const =0
 
virtual void send (const void *data, int count, MPI_Datatype datatype, int destination, int tag)=0
 
virtual void send (const DataPack &data, MPI_Datatype datatype, int destination, int tag)=0
 
virtual void send (int destination, int tag)=0
 
virtual void Isend (const void *data, int count, MPI_Datatype datatype, int destination, int tag, Request &request)=0
 
virtual void Isend (const DataPack &data, MPI_Datatype datatype, int destination, int tag, Request &request)=0
 
virtual void Isend (int destination, int tag, Request &request)=0
 
virtual void Issend (const void *data, int count, MPI_Datatype datatype, int destination, int tag, Request &request)=0
 
virtual void Issend (const DataPack &data, MPI_Datatype datatype, int destination, int tag, Request &request)=0
 
virtual void Issend (int destination, int tag, Request &request)=0
 
virtual void probe (MPI_Datatype type, int source, int tag, Status &status)=0
 
virtual bool Iprobe (MPI_Datatype type, int source, int tag, Status &status)=0
 
virtual void recv (int source, int tag, Status &status=Status::IGNORE)=0
 
virtual void recv (void *buffer, int count, MPI_Datatype datatype, int source, int tag, Status &status)=0
 
virtual void recv (DataPack &data, MPI_Datatype datatype, int source, int tag, Status &status)=0
 
virtual bool test (Request &request)=0
 
virtual void wait (Request &request)=0
 
virtual void waitAll (std::vector< Request > &requests)=0
 
virtual std::unordered_map< int, DataPackallToAll (std::unordered_map< int, DataPack > export_map, MPI_Datatype datatype)=0
 
virtual std::vector< DataPackgather (DataPack data, MPI_Datatype datatype, int root)=0
 
virtual std::vector< DataPackallGather (DataPack data, MPI_Datatype datatype)=0
 
virtual DataPack bcast (DataPack data, MPI_Datatype datatype, int root)=0
 
virtual void barrier ()=0
 

Protected Attributes

int size
 
int rank
 
MPI_Group group
 
MPI_Comm comm
 

Additional Inherited Members

- Static Public Attributes inherited from fpmas::api::communication::MpiCommunicator
static MPI_Datatype IGNORE_TYPE = MPI_INT
 

Detailed Description

fpmas::api::communication::MpiCommunicator implementation, based on the system MPI library (i.e. #include <mpi.h>).

Member Function Documentation

◆ getMpiComm()

MPI_Comm fpmas::communication::MpiCommunicatorBase::getMpiComm ( ) const

Returns the built MPI communicator.

Returns
associated MPI communicator

◆ getMpiGroup()

MPI_Group fpmas::communication::MpiCommunicatorBase::getMpiGroup ( ) const

Returns the built MPI group.

Returns
associated MPI group

◆ getRank()

int fpmas::communication::MpiCommunicatorBase::getRank ( ) const
overridevirtual

Returns the MPI rank of this communicator.

Returns
MPI communicator rank

Implements fpmas::api::communication::MpiCommunicator.

◆ getSize()

int fpmas::communication::MpiCommunicatorBase::getSize ( ) const
overridevirtual

Returns the size of this communicator (i.e. the current processes count).

Returns
MPI communicator size

Implements fpmas::api::communication::MpiCommunicator.

◆ send() [1/3]

void fpmas::communication::MpiCommunicatorBase::send ( const void *  data,
int  count,
MPI_Datatype  datatype,
int  destination,
int  tag 
)
overridevirtual

Perfoms an MPI_Send operation.

Parameters
datainput buffer
countitems count in the buffer
datatypeMPI type of the data to send
destinationrank of the destination proc
tagmessage tag

Implements fpmas::api::communication::MpiCommunicator.

◆ send() [2/3]

void fpmas::communication::MpiCommunicatorBase::send ( const DataPack data,
MPI_Datatype  datatype,
int  destination,
int  tag 
)
overridevirtual

Equivalent to send(data.buffer, data.count, datatype, destination, tag)

Parameters
datainput DataPack
datatypeMPI type of the data to send
destinationrank of the destination process
tagmessage tag

Implements fpmas::api::communication::MpiCommunicator.

◆ send() [3/3]

void fpmas::communication::MpiCommunicatorBase::send ( int  destination,
int  tag 
)
overridevirtual

Performs an MPI_Send operation without data.

Parameters
destinationrank of the destination proc
tagmessage tag

Implements fpmas::api::communication::MpiCommunicator.

◆ Isend() [1/3]

void fpmas::communication::MpiCommunicatorBase::Isend ( const void *  data,
int  count,
MPI_Datatype  datatype,
int  destination,
int  tag,
Request request 
)
overridevirtual

Sends data to destination (non-blocking, asynchronous).

The FPMAS implementation always copy the input data to the input Request.

The method returns immediately, without waiting for the message to be buffered or received by the destination process.

The operation must be completed with wait() or waitAll() so that the request object is properly freed.

Parameters
datainput buffer
countitems count in the buffer
datatypeMPI type of the data to send
destinationrank of the destination process
tagmessage tag
requestoutput Request

Implements fpmas::api::communication::MpiCommunicator.

◆ Isend() [2/3]

void fpmas::communication::MpiCommunicatorBase::Isend ( const DataPack data,
MPI_Datatype  datatype,
int  destination,
int  tag,
Request request 
)
overridevirtual

Equivalent to send(data.buffer, data.count, datatype, destination, tag, request)

Parameters
datainput DataPack
datatypeMPI type of the data to send
destinationrank of the destination process
tagmessage tag
requestoutput Request

Implements fpmas::api::communication::MpiCommunicator.

◆ Isend() [3/3]

void fpmas::communication::MpiCommunicatorBase::Isend ( int  destination,
int  tag,
Request request 
)
overridevirtual

Sends a void message to destination (non-blocking, asynchronous).

This might be useful to send END message for example, when only a message tag without body might be enough.

Parameters
destinationrank of the destination process
tagmessage tag
requestoutput Request

Implements fpmas::api::communication::MpiCommunicator.

◆ Issend() [1/3]

void fpmas::communication::MpiCommunicatorBase::Issend ( const void *  data,
int  count,
MPI_Datatype  datatype,
int  destination,
int  tag,
Request req 
)
overridevirtual

Performs an MPI_Issend operation.

Parameters
datainput buffer
countitems count in the buffer
datatypeMPI type of the data to send
destinationrank of the destination proc
tagmessage tag
reqoutput MPI request

Implements fpmas::api::communication::MpiCommunicator.

◆ Issend() [2/3]

void fpmas::communication::MpiCommunicatorBase::Issend ( const DataPack data,
MPI_Datatype  datatype,
int  destination,
int  tag,
Request request 
)
overridevirtual

Equivalent to Issend(data.buffer, data.count, datatype, destination, tag, request).

Parameters
datainput DataPack
datatypeMPI type of the data to send
destinationrank of the destination process
tagmessage tag
requestoutput Request

Implements fpmas::api::communication::MpiCommunicator.

◆ Issend() [3/3]

void fpmas::communication::MpiCommunicatorBase::Issend ( int  destination,
int  tag,
Request req 
)
overridevirtual

Performs an MPI_Issend operation without data.

Parameters
destinationrank of the destination proc
tagmessage tag
reqoutput MPI request

Implements fpmas::api::communication::MpiCommunicator.

◆ recv() [1/3]

void fpmas::communication::MpiCommunicatorBase::recv ( int  source,
int  tag,
Status status = Status::IGNORE 
)
overridevirtual

Performs an MPI_Recv operation without data.

Parameters
sourcerank of the process to receive from
tagmessage tag
statusoutput MPI status

Implements fpmas::api::communication::MpiCommunicator.

◆ recv() [2/3]

void fpmas::communication::MpiCommunicatorBase::recv ( void *  buffer,
int  count,
MPI_Datatype  datatype,
int  source,
int  tag,
Status status = Status::IGNORE 
)
overridevirtual

Performs an MPI_Recv operation.

Parameters
bufferoutput buffer
countitems count to receive
datatypeMPI type of the data to receive
sourcerank of the proc to receive from
tagmessage tag
statusoutput MPI status

Implements fpmas::api::communication::MpiCommunicator.

◆ recv() [3/3]

void fpmas::communication::MpiCommunicatorBase::recv ( DataPack data,
MPI_Datatype  datatype,
int  source,
int  tag,
Status status = Status::IGNORE 
)
overridevirtual

Equivalent to recv(data.buffer, data.count, datatype, source, tag, status)

Parameters
dataoutput DataPack
datatypeMPI type of the data to receive
sourcerank of the process to receive from
tagmessage tag
statusoutput MPI status

Implements fpmas::api::communication::MpiCommunicator.

◆ probe()

void fpmas::communication::MpiCommunicatorBase::probe ( MPI_Datatype  type,
int  source,
int  tag,
Status status 
)
overridevirtual

Performs an MPI_Probe operation.

Upon return, the output status contains information about the message to receive.

Parameters
typeexpected message type
sourcesource rank
tagrecv tag
statusMPI status

Implements fpmas::api::communication::MpiCommunicator.

◆ Iprobe()

bool fpmas::communication::MpiCommunicatorBase::Iprobe ( MPI_Datatype  type,
int  source,
int  tag,
Status status 
)
overridevirtual

Performs an MPI_Iprobe operation.

Upon return, the output status contains information about the message to receive.

Parameters
typeexpected message type
sourcesource rank
tagrecv tag
statusMPI status
Returns
true iff a message is available

Implements fpmas::api::communication::MpiCommunicator.

◆ test()

bool fpmas::communication::MpiCommunicatorBase::test ( Request req)
overridevirtual

Performs an MPI_Test operation.

Parameters
reqMPI request to test
Returns
true iff the request is complete

Implements fpmas::api::communication::MpiCommunicator.

◆ wait()

void fpmas::communication::MpiCommunicatorBase::wait ( Request req)
overridevirtual

Performs an MPI_Wait operation.

Parameters
reqRequest to wait for completion

Implements fpmas::api::communication::MpiCommunicator.

◆ waitAll()

void fpmas::communication::MpiCommunicatorBase::waitAll ( std::vector< Request > &  requests)
overridevirtual

Waits for the completion of all requests.

Can be used to complete non-blocking communications. Upon return, all requests internal data buffers are freed.

Parameters
requestsRequests to wait

Implements fpmas::api::communication::MpiCommunicator.

◆ allToAll()

std::unordered_map< int, DataPack > fpmas::communication::MpiCommunicatorBase::allToAll ( std::unordered_map< int, DataPack export_map,
MPI_Datatype  datatype 
)
overridevirtual

Performs an MPI_Alltoall operation.

Parameters
export_mapdata to export to each proc
datatypeMPI datatype of the data to send / receive
Returns
data received from each proc

Implements fpmas::api::communication::MpiCommunicator.

◆ gather()

std::vector< DataPack > fpmas::communication::MpiCommunicatorBase::gather ( DataPack  data,
MPI_Datatype  datatype,
int  root 
)
overridevirtual

Performs an MPI_Gather operation.

Parameters
datadata to send to root
datatypeMPI datatype
rootrank of the root process
Returns
if rank == root, a vector containing gathered data, else an empty vector.

Implements fpmas::api::communication::MpiCommunicator.

◆ allGather()

std::vector< DataPack > fpmas::communication::MpiCommunicatorBase::allGather ( DataPack  data,
MPI_Datatype  datatype 
)
overridevirtual

Performs an MPI_Allgather operation.

Parameters
datato send to all processes
datatypeMPI datatype
Returns
data sent by all processes

Implements fpmas::api::communication::MpiCommunicator.

◆ bcast()

DataPack fpmas::communication::MpiCommunicatorBase::bcast ( DataPack  data,
MPI_Datatype  datatype,
int  root 
)
overridevirtual

Performs an MPI_Bcast operation.

Parameters
datadata to broadcast
datatypeMPI datatype
rootrank of the process from which data is sent
Returns
received data from root

Implements fpmas::api::communication::MpiCommunicator.

◆ barrier()

void fpmas::communication::MpiCommunicatorBase::barrier ( )
overridevirtual

Performs an MPI_Barrier operation.

Implements fpmas::api::communication::MpiCommunicator.

Member Data Documentation

◆ size

int fpmas::communication::MpiCommunicatorBase::size
protected

Communicator size

◆ rank

int fpmas::communication::MpiCommunicatorBase::rank
protected

Communicator rank

◆ group

MPI_Group fpmas::communication::MpiCommunicatorBase::group
protected

Internal MPI_Group

◆ comm

MPI_Comm fpmas::communication::MpiCommunicatorBase::comm
protected

Internal MPI_Comm


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