42#ifndef TEUCHOS_SERIAL_COMM_HPP
43#define TEUCHOS_SERIAL_COMM_HPP
57template<
class OrdinalType>
75template<
typename Ordinal>
113 const int root)
const;
138 const int tag)
const;
148 const int tag)
const;
163 const int tag)
const;
173 const int tag)
const;
183 const int tag)
const;
220template<
typename Ordinal>
234template<
typename Ordinal>
238template<
typename Ordinal>
246template<
typename Ordinal>
253template<
typename Ordinal>
260template<
typename Ordinal>
267template<
typename Ordinal>
269 const int ,
const Ordinal ,
char []
276template<
typename Ordinal>
293template<
typename Ordinal>
299 const int root)
const
313template<
typename Ordinal>
324template<
typename Ordinal>
335template<
typename Ordinal>
337 const Ordinal ,
const char [],
const int
341 true, std::logic_error
342 ,
"SerialComm<Ordinal>::send(...): Error, you can not call send(...) when you"
343 " only have one process!"
347template<
typename Ordinal>
355 true, std::logic_error
356 ,
"SerialComm<Ordinal>::send(...): Error, you can not call send(...) when you"
357 " only have one process!"
361template<
typename Ordinal>
363 const Ordinal ,
const char [],
const int
367 true, std::logic_error
368 ,
"SerialComm<Ordinal>::send(...): Error, you can not call ssend(...) when you"
369 " only have one process!"
373template<
typename Ordinal>
381 true, std::logic_error
382 ,
"SerialComm<Ordinal>::send(...): Error, you can not call ssend(...) when you"
383 " only have one process!"
387template<
typename Ordinal>
389 const int ,
const Ordinal ,
char []
393 true, std::logic_error
394 ,
"SerialComm<Ordinal>::receive(...): Error, you can not call receive(...) when you"
395 " only have one process!"
400template<
typename Ordinal>
407 true, std::logic_error
408 ,
"SerialComm<Ordinal>::readySend(...): Error, you can not call readySend(...) when you"
409 " only have one process!"
413template<
typename Ordinal>
426 true, std::logic_error
427 ,
"SerialComm<Ordinal>::readySend(...): Error, you can not call readySend(...) when you"
428 " only have one process!"
432template<
typename Ordinal>
438 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::isend: You cannot call isend when you only have one process." );
442template<
typename Ordinal>
449 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::isend: You cannot call isend when you only have one process." );
453template<
typename Ordinal>
459 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::ireceive: You cannot call isend when you only have one process." );
463template<
typename Ordinal>
470 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"SerialComm<Ordinal>::ireceive: You cannot call isend when you only have one process." );
474template<
typename Ordinal>
482template<
typename Ordinal>
489 std::invalid_argument,
"Teuchos::SerialComm::waitAll: There are not enough "
490 "entries in the statuses array to hold all the results of the communication"
491 " requests. requests.size() = " <<
requests.
size() <<
" > statuses.size() "
500template<
typename Ordinal>
506 "Teuchos::SerialComm::wait: On input, the request pointer is null.");
515template<
typename Ordinal>
522template<
typename Ordinal>
533template<
typename Ordinal>
547template<
typename Ordinal>
550 std::ostringstream
oss;
Defines basic traits for the ordinal field type.
Encapsulation of the result of a receive (blocking or nonblocking).
Abstract interface for distributed-memory communication.
int size(const Comm< Ordinal > &comm)
Get the number of processes in the communicator.
Simple wrapper class for raw pointers to single objects where no persisting relationship exists.
Smart reference counting pointer class for automatic garbage collection.
Implementation of CommStatus for a serial communicator.
OrdinalType getSourceRank()
The source rank that sent the message (must be zero).
OrdinalType getTag()
The tag of the received message.
SerialCommStatus()
Default constructor.
Concrete serial communicator subclass.
virtual void barrier() const
virtual RCP< CommRequest< Ordinal > > ireceive(const ArrayView< char > &Buffer, const int sourceRank) const
virtual RCP< CommRequest< Ordinal > > isend(const ArrayView< const char > &sendBuffer, const int destRank) const
virtual void broadcast(const int rootRank, const Ordinal bytes, char buffer[]) const
virtual RCP< Comm< Ordinal > > createSubcommunicator(const ArrayView< const int > &ranks) const
virtual void reduceAll(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal bytes, const char sendBuffer[], char globalReducts[]) 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 receive(const int sourceRank, const Ordinal bytes, char recvBuffer[]) const
int getTag() const
The current tag.
virtual void readySend(const ArrayView< const char > &sendBuffer, const int destRank) const
virtual int getSize() const
RCP< SerialComm< Ordinal > > createSerialComm()
Nonmember constructor.
virtual RCP< Comm< Ordinal > > duplicate() const
virtual void ssend(const Ordinal bytes, const char sendBuffer[], const int destRank, const int tag) const
virtual void scan(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal bytes, const char sendBuffer[], char scanReducts[]) const
virtual void send(const Ordinal bytes, const char sendBuffer[], const int destRank) const
virtual RCP< CommStatus< Ordinal > > wait(const Ptr< RCP< CommRequest< Ordinal > > > &request) const
virtual void waitAll(const ArrayView< RCP< CommRequest< Ordinal > > > &requests) const
virtual RCP< Comm< Ordinal > > split(const int color, const int key) 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
std::string description() const
virtual int getRank() const
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
This macro is designed to be a short version of TEUCHOS_TEST_FOR_EXCEPTION() that is easier to call.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
static std::string name()
Returns name of this ordinal type.