10#ifndef TEUCHOS_DEFAULTMPICOMM_DECL_HPP
11#define TEUCHOS_DEFAULTMPICOMM_DECL_HPP
13#include "Teuchos_Comm.hpp"
28template<
class OrdinalType>
31 MpiCommStatus (MPI_Status status);
56template<
class OrdinalType>
58mpiCommStatus (MPI_Status rawMpiStatus);
75template<
class OrdinalType>
116 MPI_Request rawMpiRequest_;
135template<
class OrdinalType>
168template<
class OrdinalType>
170mpiCommRequest (MPI_Request rawMpiRequest,
188template<
typename Ordinal>
250 const int defaultTag);
356 alltoAll(
const Ordinal sendBytes,
const char sendBuffer[],
357 const Ordinal recvBytes,
char recvBuffer[])
const;
361 const int rootRank,
const Ordinal bytes,
char buffer[]
366 gather (
const Ordinal sendBytes,
const char sendBuffer[],
367 const Ordinal recvBytes,
char recvBuffer[],
368 const int root)
const;
371 const Ordinal sendBytes,
const char sendBuffer[]
372 ,
const Ordinal recvBytes,
char recvBuffer[]
377 ,
const Ordinal bytes,
const char sendBuffer[],
char globalReducts[]
382 ,
const Ordinal bytes,
const char sendBuffer[],
char scanReducts[]
386 const Ordinal bytes,
const char sendBuffer[],
const int destRank
391 const char sendBuffer[],
393 const int tag)
const;
396 const Ordinal bytes,
const char sendBuffer[],
const int destRank
401 const char sendBuffer[],
403 const int tag)
const;
406 const int sourceRank,
const Ordinal bytes,
char recvBuffer[]
416 const char sendBuffer[],
418 const int tag)
const;
428 const int tag)
const;
437 const int sourceRank,
438 const int tag)
const;
469 static int const minTag_ = 26000;
470 static int const maxTag_ = 26099;
501 void setupMembersFromComm();
502 static int tagCounter_;
538 void assertRank(
const int rank,
const std::string &rankName)
const;
543#ifdef TEUCHOS_MPI_COMM_DUMP
545 static bool show_dump;
564template<
typename Ordinal>
565RCP<MpiComm<Ordinal> >
584template<
typename Ordinal>
619template<
typename Ordinal>
Ordinal size_type
Type representing the number of elements in an ArrayRCP or view thereof.
Abstract interface for distributed-memory communication.
int rank(const Comm< Ordinal > &comm)
Get the process rank.
Encapsulation of a pending nonblocking communication operation.
Encapsulation of the result of a receive (blocking or nonblocking).
virtual void reduceAll(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal bytes, const char sendBuffer[], char globalReducts[]) const
MpiComm(const RCP< const OpaqueWrapper< MPI_Comm > > &rawMpiComm, const int defaultTag)
Construct an MpiComm with a wrapped MPI_Comm and a default tag.
virtual RCP< Comm< Ordinal > > createSubcommunicator(const ArrayView< const int > &ranks) const
MpiComm(const RCP< const OpaqueWrapper< MPI_Comm > > &rawMpiComm)
Construct an MpiComm with the given wrapped MPI_Comm.
RCP< MpiComm< Ordinal > > createMpiComm(const RCP< const OpaqueWrapper< MPI_Comm > > &rawMpiComm)
Helper function that creates a dynamically allocated MpiComm object or returns Teuchos::null to corre...
virtual RCP< CommRequest< Ordinal > > isend(const ArrayView< const char > &sendBuffer, const int destRank) const
int incrementTag()
Increments the tag and then returns it.
std::string description() const
int getTag() const
The current tag.
virtual void send(const Ordinal bytes, const char sendBuffer[], const int destRank, const int tag) const
virtual void alltoAll(const Ordinal sendBytes, const char sendBuffer[], const Ordinal recvBytes, char recvBuffer[]) const
Scatter values from all processes to all processes.
virtual int getSize() const
The number of processes in the communicator.
virtual void readySend(const ArrayView< const char > &sendBuffer, const int destRank) const
virtual int receive(const int sourceRank, const Ordinal bytes, char recvBuffer[]) const
MPI_Comm getRawMpiComm(const Comm< Ordinal > &comm)
Helper function that extracts a raw MPI_Comm object out of a Teuchos::MpiComm wrapper object.
virtual void waitAll(const ArrayView< RCP< CommRequest< Ordinal > > > &requests) const
virtual RCP< CommRequest< Ordinal > > ireceive(const ArrayView< char > &Buffer, const int sourceRank) const
virtual void gatherAll(const Ordinal sendBytes, const char sendBuffer[], const Ordinal recvBytes, char recvBuffer[]) const
virtual void ssend(const Ordinal bytes, const char sendBuffer[], const int destRank, const int tag) const
Variant of ssend() that takes a message tag.
virtual RCP< Comm< Ordinal > > split(const int color, const int key) const
RCP< const OpaqueWrapper< MPI_Comm > > getRawMpiComm() const
Return the embedded wrapped opaque MPI_Comm object.
virtual RCP< Comm< Ordinal > > duplicate() const
virtual void gather(const Ordinal sendBytes, const char sendBuffer[], const Ordinal recvBytes, char recvBuffer[], const int root) const
Gather values from all processes to the root process.
virtual int getRank() const
The calling process' rank.
MpiComm(MPI_Comm rawMpiComm)
Construct an MpiComm with an MPI_Comm.
virtual void waitAll(const ArrayView< RCP< CommRequest< Ordinal > > > &requests, const ArrayView< RCP< CommStatus< Ordinal > > > &statuses) const
virtual void send(const Ordinal bytes, const char sendBuffer[], const int destRank) const
virtual RCP< CommRequest< Ordinal > > ireceive(const ArrayView< char > &Buffer, const int sourceRank, const int tag) const
MpiComm(const MpiComm< Ordinal > &other)
Construct a communicator with a new context with the same properties as the original.
RCP< MpiComm< Ordinal > > createMpiComm(const RCP< const OpaqueWrapper< MPI_Comm > > &rawMpiComm, const int defaultTag)
Helper function that creates a dynamically allocated MpiComm object or returns Teuchos::null to corre...
virtual RCP< CommStatus< Ordinal > > wait(const Ptr< RCP< CommRequest< Ordinal > > > &request) const
virtual void scan(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal bytes, const char sendBuffer[], char scanReducts[]) const
virtual void ssend(const Ordinal bytes, const char sendBuffer[], const int destRank) const
void setErrorHandler(const RCP< const OpaqueWrapper< MPI_Errhandler > > &errHandler)
Set the MPI error handler for this communicator.
virtual void barrier() const
Execute a barrier; must be called collectively.
virtual void broadcast(const int rootRank, const Ordinal bytes, char buffer[]) const
virtual RCP< CommRequest< Ordinal > > isend(const ArrayView< const char > &sendBuffer, const int destRank, const int tag) const
Variant of isend() that takes a tag.
virtual void readySend(const Ordinal bytes, const char sendBuffer[], const int destRank, const int tag) const
Variant of readySend() that accepts a message tag.
RCP< CommStatus< OrdinalType > > wait()
Wait on this communication request to complete.
bool isNull() const
Whether the raw MPI_Request is MPI_REQUEST_NULL.
RCP< CommStatus< OrdinalType > > cancel()
Cancel the communication request, and return its status.
virtual ~MpiCommRequestBase()
Destructor; cancels the request if it is still pending.
MpiCommRequestBase()
Default constructor.
MPI_Request releaseRawMpiRequest()
Return and relinquish ownership of the raw MPI_Request.
MpiCommRequestBase(MPI_Request rawMpiRequest)
Constructor (from a raw MPI_Request).
MpiCommRequest(MPI_Request rawMpiRequest, const ArrayView< char >::size_type numBytesInMessage)
Constructor (from a raw MPI_Request).
virtual ~MpiCommRequest()
Destructor; cancels the request if it is still pending.
MpiCommRequest()
Default constructor.
ArrayView< char >::size_type numBytes() const
Number of bytes in the nonblocking send or receive request.
OrdinalType getSourceRank()
The source rank that sent the message.
virtual ~MpiCommStatus()
Destructor (declared virtual for memory safety).
OrdinalType getTag()
The tag of the received message.
OrdinalType getError()
The error code of the received message.
Base class for wrapped opaque objects.
Simple wrapper class for raw pointers to single objects where no persisting relationship exists.
Smart reference counting pointer class for automatic garbage collection.
Base interface class for user-defined reduction operations for objects that use value semantics.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...