Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | List of all members
PLMD::Communicator Class Reference

#include <Communicator.h>

Inheritance diagram for PLMD::Communicator:
Inheritance graph
[legend]

Classes

struct  ConstData
 Const version of Communicator::Data See Communicator::Data documentation. More...
 
struct  Data
 Structure defining a buffer for MPI. More...
 
class  Request
 Wrapper class for MPI_Request. More...
 
class  Status
 Wrapper class for MPI_Status. More...
 

Public Member Functions

 Communicator ()
 Default constructor. More...
 
 Communicator (const Communicator &)
 Copy constructor. More...
 
virtual ~Communicator ()
 Destructor. More...
 
void Abort (int code)
 Wrapper to MPI_Abort. More...
 
template<class T , class S >
void Allgather (const T &sendbuf, S &recvbuf)
 Wrapper for MPI_Allgatherv (reference) More...
 
template<class T , class S >
void Allgather (const T *sendbuf, int sendcount, S *recvbuf, int recvcount)
 Wrapper for MPI_Allgatherv (pointer) More...
 
void Allgather (ConstData in, Data out)
 Wrapper for MPI_Allgather (data struct) More...
 
template<class T , class S >
void Allgatherv (const T &sendbuf, S &recvbuf, const int *recvcounts, const int *displs)
 Wrapper for MPI_Allgatherv (reference) More...
 
template<class T , class S >
void Allgatherv (const T *sendbuf, int sendcount, S *recvbuf, const int *recvcounts, const int *displs)
 Wrapper for MPI_Allgatherv (pointer) More...
 
void Allgatherv (ConstData in, Data out, const int *, const int *)
 Wrapper for MPI_Allgatherv (data struct) More...
 
void Barrier () const
 Wrapper to MPI_Barrier. More...
 
void Bcast (Data, int)
 Wrapper for MPI_Bcast (data struct) More...
 
template<class T >
void Bcast (T &buf, int root)
 Wrapper for MPI_Bcast (reference) More...
 
template<class T >
void Bcast (T *buf, int count, int root)
 Wrapper for MPI_Bcast (pointer) More...
 
MPI_CommGet_comm ()
 Reference to MPI communicator. More...
 
int Get_rank () const
 Obtain the rank of the present process. More...
 
int Get_size () const
 Obtain the number of processes. More...
 
template<class T >
Request Isend (const T &buf, int source, int tag)
 Wrapper for MPI_Isend (reference) More...
 
template<class T >
Request Isend (const T *buf, int count, int source, int tag)
 Wrapper for MPI_Isend (pointer) More...
 
Request Isend (ConstData, int, int)
 Wrapper for MPI_Isend (data struct) More...
 
void Max (Data)
 Wrapper for MPI_Allreduce with MPI_MAX (data struct) More...
 
template<class T >
void Max (T &buf)
 Wrapper for MPI_Allreduce with MPI_MAX (reference) More...
 
template<class T >
void Max (T *buf, int count)
 Wrapper for MPI_Allreduce with MPI_MAX (pointer) More...
 
void Min (Data)
 Wrapper for MPI_Allreduce with MPI_MIN (data struct) More...
 
template<class T >
void Min (T &buf)
 Wrapper for MPI_Allreduce with MPI_MIN (reference) More...
 
template<class T >
void Min (T *buf, int count)
 Wrapper for MPI_Allreduce with MPI_MIN (pointer) More...
 
Communicatoroperator= (const Communicator &)
 Assignment operator. More...
 
void Prod (Data)
 Wrapper for MPI_Allreduce with MPI_PROD (data struct) More...
 
template<class T >
void Prod (T &buf)
 Wrapper for MPI_Allreduce with MPI_PROD (reference) More...
 
template<class T >
void Prod (T *buf, int count)
 Wrapper for MPI_Allreduce with MPI_PROD (pointer) More...
 
void Recv (Data, int, int, Status &s=StatusIgnore)
 Wrapper for MPI_Recv (data struct) More...
 
template<class T >
void Recv (T &buf, int source, int tag, Status &s=StatusIgnore)
 Wrapper for MPI_Recv (reference) More...
 
template<class T >
void Recv (T *buf, int count, int source, int tag, Status &s=StatusIgnore)
 Wrapper for MPI_Recv (pointer) More...
 
void Set_comm (MPI_Comm comm)
 Set from a real MPI communicator. More...
 
void Set_comm (void *comm)
 Set from a pointer to a real MPI communicator (C). More...
 
void Set_fcomm (void *comm)
 Set from a pointer to a real MPI communicator (FORTRAN). More...
 
void Split (int, int, Communicator &) const
 Wrapper to MPI_Comm_split. More...
 
void Sum (Data)
 Wrapper for MPI_Allreduce with MPI_SUM (data struct) More...
 
template<class T >
void Sum (T &buf)
 Wrapper for MPI_Allreduce with MPI_SUM (reference) More...
 
template<class T >
void Sum (T *buf, int count)
 Wrapper for MPI_Allreduce with MPI_SUM (pointer) More...
 

Static Public Member Functions

static bool initialized ()
 Tests if MPI library is initialized. More...
 

Static Public Attributes

static Status StatusIgnore
 Special status used when status should be ignored. More...
 

Static Private Member Functions

template<class T >
static MPI_Datatype getMPIType ()
 Function returning the MPI type. More...
 
template<>
MPI_Datatype getMPIType ()
 
template<>
MPI_Datatype getMPIType ()
 
template<>
MPI_Datatype getMPIType ()
 
template<>
MPI_Datatype getMPIType ()
 
template<>
MPI_Datatype getMPIType ()
 
template<>
MPI_Datatype getMPIType ()
 
template<>
MPI_Datatype getMPIType ()
 
template<>
MPI_Datatype getMPIType ()
 

Private Attributes

MPI_Comm communicator
 Communicator. More...
 

Detailed Description

Class containing wrappers to MPI. All the MPI related stuff is relegated here.

Constructor & Destructor Documentation

◆ Communicator() [1/2]

PLMD::Communicator::Communicator ( )

Default constructor.

◆ Communicator() [2/2]

PLMD::Communicator::Communicator ( const Communicator pc)

Copy constructor.

It effectively "clones" the communicator, providing a new one acting on the same group

◆ ~Communicator()

PLMD::Communicator::~Communicator ( )
virtual

Destructor.

Member Function Documentation

◆ Abort()

void PLMD::Communicator::Abort ( int  code)

Wrapper to MPI_Abort.

Parameters
codeError code

◆ Allgather() [1/3]

template<class T , class S >
void PLMD::Communicator::Allgather ( const T &  sendbuf,
S &  recvbuf 
)
inline

Wrapper for MPI_Allgatherv (reference)

◆ Allgather() [2/3]

template<class T , class S >
void PLMD::Communicator::Allgather ( const T *  sendbuf,
int  sendcount,
S *  recvbuf,
int  recvcount 
)
inline

Wrapper for MPI_Allgatherv (pointer)

◆ Allgather() [3/3]

void PLMD::Communicator::Allgather ( ConstData  in,
Data  out 
)

Wrapper for MPI_Allgather (data struct)

◆ Allgatherv() [1/3]

template<class T , class S >
void PLMD::Communicator::Allgatherv ( const T &  sendbuf,
S &  recvbuf,
const int *  recvcounts,
const int *  displs 
)
inline

Wrapper for MPI_Allgatherv (reference)

◆ Allgatherv() [2/3]

template<class T , class S >
void PLMD::Communicator::Allgatherv ( const T *  sendbuf,
int  sendcount,
S *  recvbuf,
const int *  recvcounts,
const int *  displs 
)
inline

Wrapper for MPI_Allgatherv (pointer)

◆ Allgatherv() [3/3]

void PLMD::Communicator::Allgatherv ( ConstData  in,
Data  out,
const int *  recvcounts,
const int *  displs 
)

Wrapper for MPI_Allgatherv (data struct)

◆ Barrier()

void PLMD::Communicator::Barrier ( ) const

Wrapper to MPI_Barrier.

◆ Bcast() [1/3]

void PLMD::Communicator::Bcast ( Data  data,
int  root 
)

Wrapper for MPI_Bcast (data struct)

◆ Bcast() [2/3]

template<class T >
void PLMD::Communicator::Bcast ( T &  buf,
int  root 
)
inline

Wrapper for MPI_Bcast (reference)

◆ Bcast() [3/3]

template<class T >
void PLMD::Communicator::Bcast ( T *  buf,
int  count,
int  root 
)
inline

Wrapper for MPI_Bcast (pointer)

◆ Get_comm()

MPI_Comm & PLMD::Communicator::Get_comm ( )

Reference to MPI communicator.

◆ Get_rank()

int PLMD::Communicator::Get_rank ( ) const

Obtain the rank of the present process.

◆ Get_size()

int PLMD::Communicator::Get_size ( ) const

Obtain the number of processes.

◆ getMPIType() [1/9]

template<class T >
static MPI_Datatype PLMD::Communicator::getMPIType ( )
staticprivate

Function returning the MPI type.

You can use it to access to the MPI type of a C++ type, e.g. MPI_Datatype type=getMPIType<double>();

◆ getMPIType() [2/9]

template<>
MPI_Datatype PLMD::Communicator::getMPIType ( )
staticprivate

◆ getMPIType() [3/9]

template<>
MPI_Datatype PLMD::Communicator::getMPIType ( )
staticprivate

◆ getMPIType() [4/9]

template<>
MPI_Datatype PLMD::Communicator::getMPIType ( )
staticprivate

◆ getMPIType() [5/9]

template<>
MPI_Datatype PLMD::Communicator::getMPIType ( )
staticprivate

◆ getMPIType() [6/9]

template<>
MPI_Datatype PLMD::Communicator::getMPIType ( )
staticprivate

◆ getMPIType() [7/9]

template<>
MPI_Datatype PLMD::Communicator::getMPIType ( )
staticprivate

◆ getMPIType() [8/9]

template<>
MPI_Datatype PLMD::Communicator::getMPIType ( )
staticprivate

◆ getMPIType() [9/9]

template<>
MPI_Datatype PLMD::Communicator::getMPIType ( )
staticprivate

◆ initialized()

bool PLMD::Communicator::initialized ( )
static

Tests if MPI library is initialized.

◆ Isend() [1/3]

template<class T >
Request PLMD::Communicator::Isend ( const T &  buf,
int  source,
int  tag 
)
inline

Wrapper for MPI_Isend (reference)

◆ Isend() [2/3]

template<class T >
Request PLMD::Communicator::Isend ( const T *  buf,
int  count,
int  source,
int  tag 
)
inline

Wrapper for MPI_Isend (pointer)

◆ Isend() [3/3]

Communicator::Request PLMD::Communicator::Isend ( ConstData  data,
int  source,
int  tag 
)

Wrapper for MPI_Isend (data struct)

◆ Max() [1/3]

void PLMD::Communicator::Max ( Data  data)

Wrapper for MPI_Allreduce with MPI_MAX (data struct)

◆ Max() [2/3]

template<class T >
void PLMD::Communicator::Max ( T &  buf)
inline

Wrapper for MPI_Allreduce with MPI_MAX (reference)

◆ Max() [3/3]

template<class T >
void PLMD::Communicator::Max ( T *  buf,
int  count 
)
inline

Wrapper for MPI_Allreduce with MPI_MAX (pointer)

◆ Min() [1/3]

void PLMD::Communicator::Min ( Data  data)

Wrapper for MPI_Allreduce with MPI_MIN (data struct)

◆ Min() [2/3]

template<class T >
void PLMD::Communicator::Min ( T &  buf)
inline

Wrapper for MPI_Allreduce with MPI_MIN (reference)

◆ Min() [3/3]

template<class T >
void PLMD::Communicator::Min ( T *  buf,
int  count 
)
inline

Wrapper for MPI_Allreduce with MPI_MIN (pointer)

◆ operator=()

Communicator & PLMD::Communicator::operator= ( const Communicator pc)

Assignment operator.

It effectively "clones" the communicator, providing a new one acting on the same group

◆ Prod() [1/3]

void PLMD::Communicator::Prod ( Data  data)

Wrapper for MPI_Allreduce with MPI_PROD (data struct)

◆ Prod() [2/3]

template<class T >
void PLMD::Communicator::Prod ( T &  buf)
inline

Wrapper for MPI_Allreduce with MPI_PROD (reference)

◆ Prod() [3/3]

template<class T >
void PLMD::Communicator::Prod ( T *  buf,
int  count 
)
inline

Wrapper for MPI_Allreduce with MPI_PROD (pointer)

◆ Recv() [1/3]

void PLMD::Communicator::Recv ( Data  data,
int  source,
int  tag,
Status s = StatusIgnore 
)

Wrapper for MPI_Recv (data struct)

◆ Recv() [2/3]

template<class T >
void PLMD::Communicator::Recv ( T &  buf,
int  source,
int  tag,
Status s = StatusIgnore 
)
inline

Wrapper for MPI_Recv (reference)

◆ Recv() [3/3]

template<class T >
void PLMD::Communicator::Recv ( T *  buf,
int  count,
int  source,
int  tag,
Status s = StatusIgnore 
)
inline

Wrapper for MPI_Recv (pointer)

◆ Set_comm() [1/2]

void PLMD::Communicator::Set_comm ( MPI_Comm  comm)

Set from a real MPI communicator.

Parameters
commMPI communicator

◆ Set_comm() [2/2]

void PLMD::Communicator::Set_comm ( void *  comm)

Set from a pointer to a real MPI communicator (C).

Parameters
commPointer to a C MPI communicator

◆ Set_fcomm()

void PLMD::Communicator::Set_fcomm ( void *  comm)

Set from a pointer to a real MPI communicator (FORTRAN).

Parameters
commPointer to a FORTRAN MPI communicator (INTEGER)

◆ Split()

void PLMD::Communicator::Split ( int  color,
int  key,
Communicator pc 
) const

Wrapper to MPI_Comm_split.

◆ Sum() [1/3]

void PLMD::Communicator::Sum ( Data  data)

Wrapper for MPI_Allreduce with MPI_SUM (data struct)

◆ Sum() [2/3]

template<class T >
void PLMD::Communicator::Sum ( T &  buf)
inline

Wrapper for MPI_Allreduce with MPI_SUM (reference)

◆ Sum() [3/3]

template<class T >
void PLMD::Communicator::Sum ( T *  buf,
int  count 
)
inline

Wrapper for MPI_Allreduce with MPI_SUM (pointer)

Member Data Documentation

◆ communicator

MPI_Comm PLMD::Communicator::communicator
private

◆ StatusIgnore

Communicator::Status PLMD::Communicator::StatusIgnore
static

Special status used when status should be ignored.

E.g. Recv(a,0,1,Communicator::StatusIgnore); Notice that this is the default for Recv, so this is equivalent to Recv(a,0,1);


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