Version: 9.12.0
MEDCoupling::CommInterface Class Reference

Public Member Functions

int allGather (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) const
 
int allGatherArrays (MPI_Comm comm, const DataArrayIdType *array, std::unique_ptr< mcIdType[]> &result, std::unique_ptr< mcIdType[]> &resultIndex) const
 
void allGatherArrays (MPI_Comm comm, const DataArrayIdType *array, std::vector< MCAuto< DataArrayIdType > > &arraysOut) const
 
template<class T >
int allGatherArraysT (MPI_Comm comm, const typename Traits< T >::ArrayType *array, std::unique_ptr< T[]> &result, std::unique_ptr< mcIdType[]> &resultIndex) const
 
template<class T >
void allGatherArraysT2 (MPI_Comm comm, const typename Traits< T >::ArrayType *array, std::vector< MCAuto< typename Traits< T >::ArrayType > > &arraysOut) const
 
int allGatherV (const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, const int recvcounts[], const int displs[], MPI_Datatype recvtype, MPI_Comm comm) const
 
int allReduce (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) const
 
int allToAll (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) const
 
void allToAllArrays (MPI_Comm comm, const std::vector< MCAuto< DataArrayDouble > > &arrays, MCAuto< DataArrayDouble > &arraysOut) const
 
void allToAllArrays (MPI_Comm comm, const std::vector< MCAuto< DataArrayDouble > > &arrays, std::vector< MCAuto< DataArrayDouble > > &arraysOut) const
 
void allToAllArrays (MPI_Comm comm, const std::vector< MCAuto< DataArrayIdType > > &arrays, std::vector< MCAuto< DataArrayIdType > > &arraysOut) const
 
template<class T >
void allToAllArraysT (MPI_Comm comm, const std::vector< MCAuto< typename Traits< T >::ArrayType > > &arrays, std::vector< MCAuto< typename Traits< T >::ArrayType > > &arraysOut) const
 
template<class T >
int allToAllArraysT2 (MPI_Comm comm, const std::vector< MCAuto< typename Traits< T >::ArrayType > > &arrays, MCAuto< typename Traits< T >::ArrayType > &arrayOut, std::unique_ptr< mcIdType[]> &nbOfElems2, mcIdType &nbOfComponents) const
 
int allToAllV (const void *sendbuf, int *sendcounts, int *senddispls, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *recvdispls, MPI_Datatype recvtype, MPI_Comm comm) const
 
int barrier (MPI_Comm comm) const
 
int broadcast (void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm) const
 
int cancel (MPI_Request *request) const
 
int commCreate (MPI_Comm comm, MPI_Group group, MPI_Comm *comm_output) const
 
int commFree (MPI_Comm *comm) const
 
int commGroup (MPI_Comm comm, MPI_Group *group) const
 
 CommInterface ()
 
int commRank (MPI_Comm comm, int *rank) const
 
int commSize (MPI_Comm comm, int *size) const
 
int errorString (int errorcode, char *string, int *resultlen) const
 
int gather (const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) const
 
void gatherArrays (MPI_Comm comm, int root, const DataArrayIdType *array, std::vector< MCAuto< DataArrayIdType > > &arraysOut) const
 
template<class T >
int gatherArraysT (MPI_Comm comm, int root, const typename Traits< T >::ArrayType *array, std::unique_ptr< T[]> &result, std::unique_ptr< mcIdType[]> &resultIndex, int &rank) const
 
template<class T >
void gatherArraysT2 (MPI_Comm comm, int root, const typename Traits< T >::ArrayType *array, std::vector< MCAuto< typename Traits< T >::ArrayType > > &arraysOut) const
 
int gatherV (const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, const int recvcounts[], const int displs[], MPI_Datatype recvtype, int root, MPI_Comm comm) const
 
int getCount (MPI_Status *status, MPI_Datatype datatype, int *count) const
 
int groupFree (MPI_Group *group) const
 
int groupIncl (MPI_Group group, int size, int *ranks, MPI_Group *group_output) const
 
int Iprobe (int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status) const
 
int Irecv (void *buffer, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request) const
 
int Isend (void *buffer, int count, MPI_Datatype datatype, int target, int tag, MPI_Comm comm, MPI_Request *request) const
 
int probe (int source, int tag, MPI_Comm comm, MPI_Status *status) const
 
int recv (void *buffer, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status) const
 
int reduce (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm) const
 
int requestFree (MPI_Request *request) const
 
int send (void *buffer, int count, MPI_Datatype datatype, int target, int tag, MPI_Comm comm) const
 
int sendRecv (void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status)
 
int test (MPI_Request *request, int *flag, MPI_Status *status) const
 
int testall (int count, MPI_Request *array_of_requests, int *flag, MPI_Status *array_of_status) const
 
int testany (int count, MPI_Request *array_of_requests, int *index, int *flag, MPI_Status *status) const
 
int testCancelled (MPI_Status *status, int *flag) const
 
int testsome (int incount, MPI_Request *array_of_requests, int *outcount, int *array_of_indices, MPI_Status *array_of_status) const
 
int wait (MPI_Request *request, MPI_Status *status) const
 
int waitall (int count, MPI_Request *array_of_requests, MPI_Status *array_of_status) const
 
int waitany (int count, MPI_Request *array_of_requests, int *index, MPI_Status *status) const
 
int waitsome (int incount, MPI_Request *array_of_requests, int *outcount, int *array_of_indices, MPI_Status *array_of_status) const
 
int worldSize () const
 
virtual ~CommInterface ()
 

Static Public Member Functions

template<class T >
static std::unique_ptr< T[]> ComputeOffset (const std::unique_ptr< T[]> &counts, std::size_t sizeOfCounts)
 
template<class T >
static std::unique_ptr< T[]> ComputeOffsetFull (const std::unique_ptr< T[]> &counts, std::size_t sizeOfCounts)
 
static std::unique_ptr< mcIdType[]> SplitArrayOfLength (const std::unique_ptr< mcIdType[]> &counts, std::size_t countsSz, int rk, int size)
 
template<class T >
static std::unique_ptr< int[]> ToIntArray (const std::unique_ptr< T[]> &arr, std::size_t size)
 

Detailed Description

The class CommInterface is the gateway to the MPI library. It is a wrapper around all MPI calls, thus trying to abstract the rest of the code from using the direct MPI API (but this is not strictly respected overall in practice ...). It is used in all the DEC related classes.

It is typically instantiated after the MPI_Init() call in a program and is afterwards passed as a parameter to the constructors of various parallel objects so that they access the MPI library via this common interface.

As an example, the following code excerpt initializes a processor group made of the zero processor.

#include "CommInterface.hxx"
#include "ProcessorGroup.hxx"

int main(int argc, char** argv)
{
//initialization
MPI_Init(&argc, &argv);
MEDCoupling::CommInterface comm_interface;

//setting up a processor group with proc 0
set<int> procs;
procs.insert(0);
MEDCoupling::ProcessorGroup group(procs, comm_interface);

//cleanup
MPI_Finalize();
}

Constructor & Destructor Documentation

◆ CommInterface()

MEDCoupling::CommInterface::CommInterface ( )

◆ ~CommInterface()

virtual MEDCoupling::CommInterface::~CommInterface ( )
virtual

Member Function Documentation

◆ worldSize()

◆ commSize()

int MEDCoupling::CommInterface::commSize ( MPI_Comm  comm,
int *  size 
) const

◆ commRank()

int MEDCoupling::CommInterface::commRank ( MPI_Comm  comm,
int *  rank 
) const

◆ commGroup()

int MEDCoupling::CommInterface::commGroup ( MPI_Comm  comm,
MPI_Group *  group 
) const

◆ groupIncl()

int MEDCoupling::CommInterface::groupIncl ( MPI_Group  group,
int  size,
int *  ranks,
MPI_Group *  group_output 
) const

◆ commCreate()

int MEDCoupling::CommInterface::commCreate ( MPI_Comm  comm,
MPI_Group  group,
MPI_Comm *  comm_output 
) const

◆ groupFree()

◆ commFree()

int MEDCoupling::CommInterface::commFree ( MPI_Comm *  comm) const

◆ send()

int MEDCoupling::CommInterface::send ( void *  buffer,
int  count,
MPI_Datatype  datatype,
int  target,
int  tag,
MPI_Comm  comm 
) const

◆ recv()

int MEDCoupling::CommInterface::recv ( void *  buffer,
int  count,
MPI_Datatype  datatype,
int  source,
int  tag,
MPI_Comm  comm,
MPI_Status *  status 
) const

◆ sendRecv()

int MEDCoupling::CommInterface::sendRecv ( void *  sendbuf,
int  sendcount,
MPI_Datatype  sendtype,
int  dest,
int  sendtag,
void *  recvbuf,
int  recvcount,
MPI_Datatype  recvtype,
int  source,
int  recvtag,
MPI_Comm  comm,
MPI_Status *  status 
)

◆ Isend()

int MEDCoupling::CommInterface::Isend ( void *  buffer,
int  count,
MPI_Datatype  datatype,
int  target,
int  tag,
MPI_Comm  comm,
MPI_Request *  request 
) const

◆ Irecv()

int MEDCoupling::CommInterface::Irecv ( void *  buffer,
int  count,
MPI_Datatype  datatype,
int  source,
int  tag,
MPI_Comm  comm,
MPI_Request *  request 
) const

◆ wait()

int MEDCoupling::CommInterface::wait ( MPI_Request *  request,
MPI_Status *  status 
) const

◆ test()

int MEDCoupling::CommInterface::test ( MPI_Request *  request,
int *  flag,
MPI_Status *  status 
) const

◆ requestFree()

int MEDCoupling::CommInterface::requestFree ( MPI_Request *  request) const

◆ waitany()

int MEDCoupling::CommInterface::waitany ( int  count,
MPI_Request *  array_of_requests,
int *  index,
MPI_Status *  status 
) const

◆ testany()

int MEDCoupling::CommInterface::testany ( int  count,
MPI_Request *  array_of_requests,
int *  index,
int *  flag,
MPI_Status *  status 
) const

◆ waitall()

int MEDCoupling::CommInterface::waitall ( int  count,
MPI_Request *  array_of_requests,
MPI_Status *  array_of_status 
) const

◆ testall()

int MEDCoupling::CommInterface::testall ( int  count,
MPI_Request *  array_of_requests,
int *  flag,
MPI_Status *  array_of_status 
) const

◆ waitsome()

int MEDCoupling::CommInterface::waitsome ( int  incount,
MPI_Request *  array_of_requests,
int *  outcount,
int *  array_of_indices,
MPI_Status *  array_of_status 
) const

◆ testsome()

int MEDCoupling::CommInterface::testsome ( int  incount,
MPI_Request *  array_of_requests,
int *  outcount,
int *  array_of_indices,
MPI_Status *  array_of_status 
) const

◆ probe()

int MEDCoupling::CommInterface::probe ( int  source,
int  tag,
MPI_Comm  comm,
MPI_Status *  status 
) const

◆ Iprobe()

int MEDCoupling::CommInterface::Iprobe ( int  source,
int  tag,
MPI_Comm  comm,
int *  flag,
MPI_Status *  status 
) const

◆ cancel()

int MEDCoupling::CommInterface::cancel ( MPI_Request *  request) const

◆ testCancelled()

int MEDCoupling::CommInterface::testCancelled ( MPI_Status *  status,
int *  flag 
) const

◆ barrier()

int MEDCoupling::CommInterface::barrier ( MPI_Comm  comm) const

◆ errorString()

int MEDCoupling::CommInterface::errorString ( int  errorcode,
char *  string,
int *  resultlen 
) const

◆ getCount()

int MEDCoupling::CommInterface::getCount ( MPI_Status *  status,
MPI_Datatype  datatype,
int *  count 
) const

◆ broadcast()

int MEDCoupling::CommInterface::broadcast ( void *  buffer,
int  count,
MPI_Datatype  datatype,
int  root,
MPI_Comm  comm 
) const

◆ gather()

int MEDCoupling::CommInterface::gather ( const void *  sendbuf,
int  sendcount,
MPI_Datatype  sendtype,
void *  recvbuf,
int  recvcount,
MPI_Datatype  recvtype,
int  root,
MPI_Comm  comm 
) const

Referenced by gatherArraysT().

◆ gatherV()

int MEDCoupling::CommInterface::gatherV ( const void *  sendbuf,
int  sendcount,
MPI_Datatype  sendtype,
void *  recvbuf,
const int  recvcounts[],
const int  displs[],
MPI_Datatype  recvtype,
int  root,
MPI_Comm  comm 
) const

Referenced by gatherArraysT().

◆ allGather()

int MEDCoupling::CommInterface::allGather ( void *  sendbuf,
int  sendcount,
MPI_Datatype  sendtype,
void *  recvbuf,
int  recvcount,
MPI_Datatype  recvtype,
MPI_Comm  comm 
) const

◆ allGatherV()

int MEDCoupling::CommInterface::allGatherV ( const void *  sendbuf,
int  sendcount,
MPI_Datatype  sendtype,
void *  recvbuf,
const int  recvcounts[],
const int  displs[],
MPI_Datatype  recvtype,
MPI_Comm  comm 
) const

Referenced by allGatherArraysT().

◆ allToAll()

int MEDCoupling::CommInterface::allToAll ( void *  sendbuf,
int  sendcount,
MPI_Datatype  sendtype,
void *  recvbuf,
int  recvcount,
MPI_Datatype  recvtype,
MPI_Comm  comm 
) const

◆ allToAllV()

int MEDCoupling::CommInterface::allToAllV ( const void *  sendbuf,
int *  sendcounts,
int *  senddispls,
MPI_Datatype  sendtype,
void *  recvbuf,
int *  recvcounts,
int *  recvdispls,
MPI_Datatype  recvtype,
MPI_Comm  comm 
) const

◆ reduce()

int MEDCoupling::CommInterface::reduce ( void *  sendbuf,
void *  recvbuf,
int  count,
MPI_Datatype  datatype,
MPI_Op  op,
int  root,
MPI_Comm  comm 
) const

◆ allReduce()

int MEDCoupling::CommInterface::allReduce ( void *  sendbuf,
void *  recvbuf,
int  count,
MPI_Datatype  datatype,
MPI_Op  op,
MPI_Comm  comm 
) const

◆ gatherArrays()

void MEDCoupling::CommInterface::gatherArrays ( MPI_Comm  comm,
int  root,
const DataArrayIdType *  array,
std::vector< MCAuto< DataArrayIdType > > &  arraysOut 
) const

◆ allGatherArrays() [1/2]

void MEDCoupling::CommInterface::allGatherArrays ( MPI_Comm  comm,
const DataArrayIdType *  array,
std::vector< MCAuto< DataArrayIdType > > &  arraysOut 
) const

Generalized AllGather collective communication. This method send input array to all procs.

◆ allGatherArrays() [2/2]

int MEDCoupling::CommInterface::allGatherArrays ( MPI_Comm  comm,
const DataArrayIdType *  array,
std::unique_ptr< mcIdType[]> &  result,
std::unique_ptr< mcIdType[]> &  resultIndex 
) const

Generalized AllGather collective communication. This method send input array to all procs.

◆ allToAllArrays() [1/3]

void MEDCoupling::CommInterface::allToAllArrays ( MPI_Comm  comm,
const std::vector< MCAuto< DataArrayIdType > > &  arrays,
std::vector< MCAuto< DataArrayIdType > > &  arraysOut 
) const

Generalized AllToAll collective communication.

◆ allToAllArrays() [2/3]

void MEDCoupling::CommInterface::allToAllArrays ( MPI_Comm  comm,
const std::vector< MCAuto< DataArrayDouble > > &  arrays,
std::vector< MCAuto< DataArrayDouble > > &  arraysOut 
) const

◆ allToAllArrays() [3/3]

void MEDCoupling::CommInterface::allToAllArrays ( MPI_Comm  comm,
const std::vector< MCAuto< DataArrayDouble > > &  arrays,
MCAuto< DataArrayDouble > &  arraysOut 
) const

◆ gatherArraysT()

template<class T >
int MEDCoupling::CommInterface::gatherArraysT ( MPI_Comm  comm,
int  root,
const typename Traits< T >::ArrayType *  array,
std::unique_ptr< T[]> &  result,
std::unique_ptr< mcIdType[]> &  resultIndex,
int &  rank 
) const

◆ gatherArraysT2()

template<class T >
void MEDCoupling::CommInterface::gatherArraysT2 ( MPI_Comm  comm,
int  root,
const typename Traits< T >::ArrayType *  array,
std::vector< MCAuto< typename Traits< T >::ArrayType > > &  arraysOut 
) const

◆ allGatherArraysT()

template<class T >
int MEDCoupling::CommInterface::allGatherArraysT ( MPI_Comm  comm,
const typename Traits< T >::ArrayType *  array,
std::unique_ptr< T[]> &  result,
std::unique_ptr< mcIdType[]> &  resultIndex 
) const

◆ allGatherArraysT2()

template<class T >
void MEDCoupling::CommInterface::allGatherArraysT2 ( MPI_Comm  comm,
const typename Traits< T >::ArrayType *  array,
std::vector< MCAuto< typename Traits< T >::ArrayType > > &  arraysOut 
) const

◆ allToAllArraysT2()

template<class T >
int MEDCoupling::CommInterface::allToAllArraysT2 ( MPI_Comm  comm,
const std::vector< MCAuto< typename Traits< T >::ArrayType > > &  arrays,
MCAuto< typename Traits< T >::ArrayType > &  arrayOut,
std::unique_ptr< mcIdType[]> &  nbOfElems2,
mcIdType &  nbOfComponents 
) const

◆ allToAllArraysT()

template<class T >
void MEDCoupling::CommInterface::allToAllArraysT ( MPI_Comm  comm,
const std::vector< MCAuto< typename Traits< T >::ArrayType > > &  arrays,
std::vector< MCAuto< typename Traits< T >::ArrayType > > &  arraysOut 
) const

References ComputeOffset().

◆ SplitArrayOfLength()

static std::unique_ptr<mcIdType[]> MEDCoupling::CommInterface::SplitArrayOfLength ( const std::unique_ptr< mcIdType[]> &  counts,
std::size_t  countsSz,
int  rk,
int  size 
)
static

counts is expected to be an array of array length. This method returns an array of split array.

References MEDCoupling::DataArray::GetSlice().

◆ ToIntArray()

template<class T >
static std::unique_ptr<int []> MEDCoupling::CommInterface::ToIntArray ( const std::unique_ptr< T[]> &  arr,
std::size_t  size 
)
static

Helper of alltoallv and allgatherv

◆ ComputeOffset()

template<class T >
static std::unique_ptr<T []> MEDCoupling::CommInterface::ComputeOffset ( const std::unique_ptr< T[]> &  counts,
std::size_t  sizeOfCounts 
)
static

Helper of alltoallv and allgatherv

Referenced by allGatherArraysT(), allToAllArraysT(), allToAllArraysT2(), and gatherArraysT().

◆ ComputeOffsetFull()

template<class T >
static std::unique_ptr<T []> MEDCoupling::CommInterface::ComputeOffsetFull ( const std::unique_ptr< T[]> &  counts,
std::size_t  sizeOfCounts 
)
static

Helper of alltoallv and allgatherv