54 #ifdef HAVE_TEUCHOS_MPI
58 #ifdef HAVE_TEUCHOS_QD
59 # include <qd/dd_real.h>
65 template <
typename Packet>
66 ostream & operator<< ( ostream& os, const pair<Packet, Packet>& arg)
68 os <<
"(" << arg.first <<
"," << arg.second <<
")";
79 template<
typename Packet>
83 typedef std::pair<typename PST::magnitudeType, typename PST::magnitudeType>
magnitudeType;
88 static inline magnitudeType magnitude(std::pair<Packet,Packet> a) {
return std::pair<Packet,Packet>( PST::magnitude(a.first), PST::magnitude(a.second) ); }
89 static inline std::pair<Packet,Packet>
zero() {
return std::pair<Packet,Packet>(PST::zero(),PST::zero()); }
90 static inline std::pair<Packet,Packet>
one() {
return std::pair<Packet,Packet>(PST::one(), PST::one()); }
91 static inline std::pair<Packet,Packet>
conjugate(std::pair<Packet,Packet> x) {
return std::pair<Packet,Packet>(PST::conjugate(x.first), PST::conjugate(x.second) ); }
92 static inline std::pair<Packet,Packet>
real(std::pair<Packet,Packet> x) {
return std::pair<Packet,Packet>(PST::real(x.first), PST::real(x.second) ); }
93 static inline std::pair<Packet,Packet>
imag(std::pair<Packet,Packet> x) {
return std::pair<Packet,Packet>(PST::imag(x.first), PST::imag(x.second) ); }
94 static inline bool isnaninf(std::pair<Packet,Packet> x) {
return PST::isnaninf(x.first) || PST::isnaninf(x.second); }
95 static inline void seedrandom(
unsigned int s) { PST::seedrandom(s); }
96 static inline std::pair<Packet,Packet>
random() {
return std::pair<Packet,Packet>( PST::random(), PST::random() ); }
98 static inline std::pair<Packet,Packet>
squareroot(std::pair<Packet,Packet> x) {
return std::pair<Packet,Packet>(PST::squareroot(x.first), PST::squareroot(x.second)); }
99 static inline std::pair<Packet,Packet>
pow(std::pair<Packet,Packet> x, std::pair<Packet,Packet> y) {
return std::pair<Packet,Packet>( PST::pow(x.first,y.first), PST::pow(x.second,y.second) ); }
102 template<
class Packet,
class ConvertToPacket>
105 static std::pair<Packet,Packet>
convert(
const ConvertToPacket t )
107 return std::pair<Packet,Packet>(t,t);
109 static std::pair<Packet,Packet>
safeConvert(
const ConvertToPacket t )
111 return std::pair<Packet,Packet>(t,t);
130 using Teuchos::outArg;
136 double errorTolSlack = 1e+1;
148 "test-mpi",
"test-serial", &testMpi,
149 "Test MPI (if available) or force test of serial. In a serial build,"
150 " this option is ignored and a serial comm is always used." );
153 "error-tol-slack", &errorTolSlack,
154 "Slack off of machine epsilon used to check test results" );
159 template<
class Ordinal>
160 RCP<const Comm<Ordinal> > getDefaultComm()
163 return DefaultComm<Ordinal>::getComm();
171 RCP<const Comm<Ordinal> > comm = getDefaultComm<Ordinal>();
172 out <<
"comm = " << Teuchos::describe(*comm);
177 #ifdef HAVE_TEUCHOS_MPI
182 ECHO(MPI_Comm rawMpiComm = MPI_COMM_WORLD);
183 ECHO(
const RCP<
const Comm<int> > comm =
184 Teuchos::createMpiComm<int>(Teuchos::opaqueWrapper(rawMpiComm)));
185 out <<
"comm = " << Teuchos::describe(*comm);
186 ECHO(MPI_Comm rawMpiComm2 = Teuchos::getRawMpiComm<int>(*comm));
191 #endif // HAVE_TEUCHOS_MPI
197 using Teuchos::broadcast;
201 using Teuchos::rcpFromRef;
202 using Teuchos::outArg;
209 using Teuchos::arcpClone;
210 using Teuchos::rcp_dynamic_cast;
217 RCP<const Comm<Ordinal> > comm = getDefaultComm<Ordinal>();
218 const Ordinal numProcs =
size(*comm);
219 const Ordinal procRank =
rank(*comm);
227 out <<
"\nThis is Teuchos::SerialComm which does not support readySend!\n";
231 PT::seedrandom(as<unsigned int>(procRank));
232 Packet origSendData = PT::random();
233 Packet origRecvData = PT::random();
234 broadcast<Ordinal, Packet>( *comm, 0,
outArg(origSendData) );
236 Packet sendData = origSendData;
237 Packet recvData = origRecvData;
239 RCP<Teuchos::CommRequest<Ordinal> > recvRequest;
244 recvRequest = ireceive<Ordinal, Packet>(
246 rcp(&recvData,
false),
252 if (procRank == numProcs-1) {
255 readySend<Ordinal, Packet>(
284 int globalSuccess_int = -1;
293 using Teuchos::broadcast;
297 using Teuchos::rcpFromRef;
298 using Teuchos::outArg;
305 using Teuchos::arcpClone;
306 using Teuchos::rcp_dynamic_cast;
312 RCP<const Comm<Ordinal> > comm = getDefaultComm<Ordinal>();
313 const Ordinal numProcs =
size(*comm);
314 const Ordinal procRank =
rank(*comm);
322 out <<
"\nThis is Teuchos::SerialComm which does not support readySend!\n";
326 const int dataLen = 3;
328 const ArrayRCP<Packet> origSendData = arcp<Packet>(dataLen);
329 const ArrayRCP<Packet> origRecvData = arcp<Packet>(dataLen);
330 PT::seedrandom(as<unsigned int>(procRank));
331 for (
int j = 0; j < dataLen; ++j) {
332 origSendData[j] = PT::random();
333 origRecvData[j] = PT::random();
335 broadcast<Ordinal, Packet>( *comm, 0, origSendData() );
337 const ArrayRCP<Packet> sendData = arcpClone<Packet>(origSendData());
338 const ArrayRCP<Packet> recvData = arcpClone<Packet>(origRecvData());
340 RCP<Teuchos::CommRequest<Ordinal> > recvRequest;
352 recvRequest = ireceive<Ordinal, Packet>(
354 recvData.persistingView(0, dataLen),
358 else if (procRank == numProcs-1) {
360 recvRequest = ireceive<Ordinal, Packet>(
362 recvData.persistingView(0, dataLen),
371 readySend<Ordinal, Packet>(
377 else if (procRank == numProcs-1) {
387 else if (procRank == numProcs-1) {
390 readySend<Ordinal, Packet>(
402 if (procRank == 0 || procRank == numProcs-1) {
413 int globalSuccess_int = -1;
422 using Teuchos::rcpFromRef;
423 using Teuchos::outArg;
428 using Teuchos::rcp_dynamic_cast;
434 RCP<const Comm<Ordinal> > comm = getDefaultComm<Ordinal>();
435 const Ordinal numProcs =
size(*comm);
436 const Ordinal procRank =
rank(*comm);
444 out <<
"\nThis is Teuchos::SerialComm which does not yet support isend/ireceive!\n";
449 Packet orig_input_data = PT::random();
452 const Packet orig_output_data = as<Packet>(-1);
454 const Packet input_data = orig_input_data;
455 Packet output_data = orig_output_data;
457 RCP<Teuchos::CommRequest<Ordinal> > recvRequest;
458 RCP<Teuchos::CommRequest<Ordinal> > sendRequest;
460 out <<
"Exchanging messages" << endl;
465 sendRequest = isend<Ordinal, Packet>(
466 *comm,
Teuchos::rcp(
new Packet(input_data)), numProcs-1);
468 if (procRank == numProcs-1) {
470 recvRequest = ireceive<Ordinal, Packet>(
474 out <<
"Waiting for messages" << endl;
479 if (procRank == numProcs-1) {
486 out <<
"Testing message correctness" << endl;
488 if (procRank == numProcs-1) {
497 int globalSuccess_int = -1;
506 using Teuchos::rcpFromRef;
507 using Teuchos::outArg;
509 using Teuchos::arcpClone;
514 using Teuchos::broadcast;
516 using Teuchos::rcp_dynamic_cast;
523 RCP<const Comm<Ordinal> > comm = getDefaultComm<Ordinal>();
524 const Ordinal numProcs =
size(*comm);
525 const Ordinal procRank =
rank(*comm);
533 out <<
"\nThis is Teuchos::SerialComm which does not yet support isend/ireceive!\n";
537 const int numSendRecv = 4;
538 const int sendLen = 3;
540 cerr <<
"Creating data" << endl;
542 const ArrayRCP<Packet> origInputData = arcp<Packet>(numSendRecv*sendLen);
543 const ArrayRCP<Packet> origOutputData = arcp<Packet>(numSendRecv*sendLen);
546 for (
int i = 0; i < numSendRecv; ++i, offset += sendLen) {
547 const ArrayRCP<Packet> origInputData_i =
548 origInputData.persistingView(offset, sendLen);
549 const ArrayRCP<Packet> origOutputData_i =
550 origOutputData.persistingView(offset, sendLen);
551 for (
int j = 0; j < sendLen; ++j) {
552 origInputData_i[j] = PT::random();
553 origOutputData_i[j] = PT::random();
557 cerr <<
"Broadcasting data" << endl;
558 broadcast<Ordinal, Packet>( *comm, 0, origInputData() );
560 const ArrayRCP<Packet> inputData = arcpClone<Packet>(origInputData());
561 const ArrayRCP<Packet> outputData = arcpClone<Packet>(origOutputData());
563 Array<RCP<Teuchos::CommRequest<Ordinal> > > recvRequests;
564 Array<RCP<Teuchos::CommRequest<Ordinal> > > sendRequests;
566 cerr <<
"Exchanging data" << endl;
573 for (
int i = 0; i < numSendRecv; ++i, offset += sendLen) {
574 sendRequests.push_back(
575 isend<Ordinal, Packet>(
577 arcpClone<Packet>(inputData(offset, sendLen)),
585 if (procRank == numProcs-1) {
588 for (
int i = 0; i < numSendRecv; ++i, offset += sendLen) {
589 recvRequests.push_back(
590 ireceive<Ordinal, Packet>(
591 *comm, outputData.persistingView(offset, sendLen), 0
597 cerr <<
"Waiting on messages" << endl;
600 waitAll( *comm, sendRequests() );
602 if (procRank == numProcs-1) {
603 waitAll( *comm, recvRequests() );
606 cerr <<
"Testing received data" << endl;
608 if (!sendRequests.empty()) {
609 for (
int i = 0; i < numSendRecv; ++i) {
614 if (!recvRequests.empty()) {
615 for (
int i = 0; i < numSendRecv; ++i) {
621 if (procRank == numProcs-1) {
630 int globalSuccess_int = -1;
638 RCP< const Comm<Ordinal> > comm = getDefaultComm<Ordinal>();
639 int initialRank = comm->getRank();
640 int initialSize = comm->getSize();
642 RCP< const Comm<Ordinal> > newComm = comm->duplicate();
650 RCP< const Comm<Ordinal> > comm = getDefaultComm<Ordinal>();
651 int initialRank = comm->getRank();
652 int initialSize = comm->getSize();
657 RCP< const Comm<Ordinal> > newComm = comm->split(initialRank % 2, 0);
660 int halfSize = initialSize / 2;
661 int newSize = newComm->getSize();
662 int newRank = newComm->getRank();
663 if (initialSize % 2 == 0) {
667 TEST_EQUALITY(newSize, initialRank % 2 == 0 ? halfSize + 1 : halfSize);
672 RCP< const Comm<Ordinal> > shouldBeNull = comm->split(-1, 0);
680 template<
typename ValueType>
681 class MonotoneSequence
683 ValueType currentValue_;
685 typedef ValueType value_type;
687 MonotoneSequence(
const value_type& initialValue) : currentValue_(initialValue)
690 value_type operator()()
692 return currentValue_++;
701 RCP< const Comm<Ordinal> > comm = getDefaultComm<Ordinal>();
702 int initialRank = comm->getRank();
703 int initialSize = comm->getSize();
706 std::vector< int > ranks(initialSize);
707 std::generate(ranks.begin(), ranks.end(), MonotoneSequence<int>(0));
708 std::reverse(ranks.begin(), ranks.end());
709 RCP< const Comm<Ordinal> > newComm = comm->createSubcommunicator(ranks);
711 int expectedNewRank = initialSize - initialRank - 1;
715 std::vector<int> rank0Only(1, 0);
716 RCP< const Comm<Ordinal> > rank0Comm = comm->createSubcommunicator(rank0Only);
718 if (initialRank == 0) {
726 #ifdef HAVE_TEUCHOS_MPI
731 using Teuchos::tuple;
using Teuchos::inoutArg;
735 const int comm_size = defaultComm->getSize();
736 const int comm_rank = defaultComm->getRank();
745 defaultComm->createSubcommunicator(tuple<int>(0, 1)());
747 if (comm_rank <= 1) {
749 const int masterComm_size = masterComm->getSize();
750 (void) masterComm_size;
751 const int masterComm_rank = masterComm->getRank();
755 masterComm->createSubcommunicator(tuple<int>(0, 1)());
757 masterComm->createSubcommunicator(tuple<int>(0)());
761 masterComm->createSubcommunicator(tuple<int>(0, 1)());
764 int my_tag = Teuchos::rcp_dynamic_cast<
const Teuchos::MpiComm<int> >(
769 if (masterComm_rank == 0) { tag1 = my_tag; }
770 masterComm->barrier();
771 Teuchos::broadcast( *masterComm, 0,
inoutArg(tag1) );
774 if (masterComm_rank == 1) { tag2 = my_tag; }
775 masterComm->barrier();
776 Teuchos::broadcast( *masterComm, 1,
inoutArg(tag2) );
786 #endif // HAVE_TEUCHOS_MPI
794 #ifdef HAVE_TEUCHOS_COMPLEX
795 # define UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_FLOAT(TEST_GROUP, TEST_NAME, ORDINAL)\
796 typedef std::complex<float> ComplexFloat; \
797 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT(TEST_GROUP, TEST_NAME, ORDINAL, ComplexFloat)
798 # define UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_DOUBLE(TEST_GROUP, TEST_NAME, ORDINAL)\
799 typedef std::complex<double> ComplexDouble; \
800 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT(TEST_GROUP, TEST_NAME, ORDINAL, ComplexDouble)
802 # define UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_FLOAT(TEST_GROUP, TEST_NAME, ORDINAL)
803 # define UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_DOUBLE(TEST_GROUP, TEST_NAME, ORDINAL)
807 #define UNIT_TEST_GROUP_ORDINAL_PACKET( ORDINAL, PACKET ) \
808 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( DefaultMpiComm, NonblockingSendReceive, ORDINAL, PACKET ) \
809 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( DefaultMpiComm, NonblockingSendReceiveSet, ORDINAL, PACKET ) \
810 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( DefaultMpiComm, ReadySend1, ORDINAL, PACKET ) \
811 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( DefaultMpiComm, ReadySend, ORDINAL, PACKET )
813 #ifdef HAVE_TEUCHOS_QD
814 # define UNIT_TEST_GROUP_ORDINAL_QD(ORDINAL) \
815 UNIT_TEST_GROUP_ORDINAL_PACKET(ORDINAL, dd_real) \
816 UNIT_TEST_GROUP_ORDINAL_PACKET(ORDINAL, qd_real)
818 # define UNIT_TEST_GROUP_ORDINAL_QD(ORDINAL)
821 #define UNIT_TEST_GROUP_ORDINAL_PAIROFPACKETS( ORDINAL, PAIROFPACKETS ) \
822 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( DefaultMpiComm, NonblockingSendReceive, ORDINAL, PAIROFPACKETS ) \
823 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( DefaultMpiComm, NonblockingSendReceiveSet, ORDINAL, PAIROFPACKETS ) \
824 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( DefaultMpiComm, ReadySend1, ORDINAL, PAIROFPACKETS ) \
825 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( DefaultMpiComm, ReadySend, ORDINAL, PAIROFPACKETS )
827 #define UNIT_TEST_GROUP_ORDINAL_SUBCOMMUNICATORS( ORDINAL ) \
828 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( DefaultMpiComm, duplicate, ORDINAL ) \
829 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( DefaultMpiComm, split, ORDINAL ) \
830 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( DefaultMpiComm, createSubcommunicator, ORDINAL )
833 typedef std::pair<short, short> PairOfShorts;
834 typedef std::pair<int,int> PairOfInts;
835 typedef std::pair<float,float> PairOfFloats;
836 typedef std::pair<double,double> PairOfDoubles;
844 #ifdef FAST_DEVELOPMENT_UNIT_TEST_BUILD
846 # define UNIT_TEST_GROUP_ORDINAL( ORDINAL ) \
847 UNIT_TEST_GROUP_ORDINAL_PACKET(ORDINAL, double) \
848 UNIT_TEST_GROUP_ORDINAL_PAIROFPACKETS(ORDINAL, PairOfDoubles) \
852 #else // FAST_DEVELOPMENT_UNIT_TEST_BUILD
854 # define UNIT_TEST_GROUP_ORDINAL( ORDINAL ) \
855 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( DefaultMpiComm, basic, ORDINAL ) \
856 UNIT_TEST_GROUP_ORDINAL_PACKET(ORDINAL, short) \
857 UNIT_TEST_GROUP_ORDINAL_PACKET(ORDINAL, int) \
858 UNIT_TEST_GROUP_ORDINAL_PACKET(ORDINAL, float) \
859 UNIT_TEST_GROUP_ORDINAL_PACKET(ORDINAL, double) \
860 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_FLOAT(DefaultMpiComm, NonblockingSendReceive, ORDINAL) \
861 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_FLOAT(DefaultMpiComm, ReadySend1, ORDINAL) \
862 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_FLOAT(DefaultMpiComm, ReadySend, ORDINAL) \
863 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_DOUBLE(DefaultMpiComm, NonblockingSendReceive, ORDINAL) \
864 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_DOUBLE(DefaultMpiComm, ReadySend1, ORDINAL) \
865 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_DOUBLE(DefaultMpiComm, ReadySend, ORDINAL) \
866 UNIT_TEST_GROUP_ORDINAL_SUBCOMMUNICATORS(ORDINAL)
868 # define UNIT_TEST_GROUP_ORDINAL_WITH_PAIRS_AND_QD( ORDINAL ) \
869 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( DefaultMpiComm, basic, ORDINAL ) \
870 UNIT_TEST_GROUP_ORDINAL_PACKET(ORDINAL, short) \
871 UNIT_TEST_GROUP_ORDINAL_PACKET(ORDINAL, int) \
872 UNIT_TEST_GROUP_ORDINAL_PACKET(ORDINAL, float) \
873 UNIT_TEST_GROUP_ORDINAL_PACKET(ORDINAL, double) \
874 UNIT_TEST_GROUP_ORDINAL_QD(ORDINAL) \
875 UNIT_TEST_GROUP_ORDINAL_PAIROFPACKETS(ORDINAL, PairOfShorts) \
876 UNIT_TEST_GROUP_ORDINAL_PAIROFPACKETS(ORDINAL, PairOfInts) \
877 UNIT_TEST_GROUP_ORDINAL_PAIROFPACKETS(ORDINAL, PairOfFloats) \
878 UNIT_TEST_GROUP_ORDINAL_PAIROFPACKETS(ORDINAL, PairOfDoubles) \
879 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_FLOAT(DefaultMpiComm, NonblockingSendReceive, ORDINAL) \
880 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_FLOAT(DefaultMpiComm, ReadySend1, ORDINAL) \
881 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_FLOAT(DefaultMpiComm, ReadySend, ORDINAL) \
882 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_DOUBLE(DefaultMpiComm, NonblockingSendReceive, ORDINAL) \
883 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_DOUBLE(DefaultMpiComm, ReadySend1, ORDINAL) \
884 UNIT_TEST_TEMPLATE_2_INSTANT_COMPLEX_DOUBLE(DefaultMpiComm, ReadySend, ORDINAL)
886 typedef short int ShortInt;
889 typedef
long int LongInt;
892 typedef
long long int LongLongInt;
895 #endif // FAST_DEVELOPMENT_UNIT_TEST_BUILD
RCP< T > rcp(const boost::shared_ptr< T > &sptr)
Conversion function that takes in a boost::shared_ptr object and spits out a Teuchos::RCP object...
static std::pair< Packet, Packet > real(std::pair< Packet, Packet > x)
#define TEST_ASSERT(v1)
Assert the given statement is true.
void addOutputSetupOptions(const bool &addOutputSetupOptions)
Set if options will be automatically added to setup Teuchos::VerboseObjectBase::getDefaultOStream().
#define UNIT_TEST_GROUP_ORDINAL_WITH_PAIRS_AND_QD(ORDINAL)
Scalar defaultSmallNumber()
void broadcast(const Comm< Ordinal > &comm, const int rootRank, const Ordinal count, Packet buffer[])
Broadcast array of objects that use value semantics.
#define ECHO(statement)
Echo the given statement before it is executed.
RCP< T2 > rcp_dynamic_cast(const RCP< T1 > &p1, bool throw_on_fail=false)
Dynamic cast of underlying RCP type from T1* to T2*.
static bool isnaninf(std::pair< Packet, Packet > x)
static CommandLineProcessor & getCLP()
Return the CLP to add options to.
static magnitudeType magnitude(std::pair< Packet, Packet > a)
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
static std::pair< Packet, Packet > zero()
static const bool isComparable
Determines if scalar type supports relational operators such as <, >, <=, >=.
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(TEST_GROUP, TEST_NAME, TYPE)
Macro for defining a templated unit test with one template parameter.
int rank(const Comm< Ordinal > &comm)
Get the process rank.
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
#define TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL(TEST_GROUP, TEST_NAME, TYPE1, TYPE2)
Macro for defining a templated unit test with two template parameters.
static void seedrandom(unsigned int s)
Concrete serial communicator subclass.
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
static std::pair< Packet, Packet > squareroot(std::pair< Packet, Packet > x)
static Teuchos::RCP< const Comm< OrdinalType > > getComm()
Return the default global communicator.
Initialize, finalize, and query the global MPI session.
static const bool hasMachineParameters
Determines if scalar type have machine-specific parameters (i.e. eps(), sfmin(), base(), prec(), t(), rnd(), emin(), rmin(), emax(), rmax() are supported).
bool is_null(const ArrayRCP< T > &p)
Returns true if p.get()==NULL.
static std::pair< Packet, Packet > imag(std::pair< Packet, Packet > x)
void reduceAll(const Comm< Ordinal > &comm, const ValueTypeReductionOp< Ordinal, Packet > &reductOp, const Ordinal count, const Packet sendBuffer[], Packet globalReducts[])
Wrapper for MPI_Allreduce that takes a custom reduction operator.
static std::pair< Packet, Packet > pow(std::pair< Packet, Packet > x, std::pair< Packet, Packet > y)
This structure defines some basic traits for a scalar field type.
std::vector< std::string > split(const std::string &str, const std::string &delimiters, const size_t start)
Split the given string using the given set of delimiters.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
void setOption(const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL)
Set a boolean option.
static std::pair< Packet, Packet > convert(const ConvertToPacket t)
void waitAll(const Comm< Ordinal > &comm, const ArrayView< RCP< CommRequest< Ordinal > > > &requests)
Wait for an array of Teuchos::CommRequest objects.
static std::pair< Packet, Packet > safeConvert(const ConvertToPacket t)
#define UNIT_TEST_GROUP_ORDINAL(ORDINAL)
Implementation of Teuchos wrappers for MPI.
#define TEST_EQUALITY_CONST(v1, v2)
Assert the equality of v1 and constant v2.
void barrier(const Comm< Ordinal > &comm)
Barrier.
Ptr< T > inoutArg(T &arg)
create a non-persisting (required or optional) input/output argument for a function call...
Return a default global communicator appropriate for the build.
int size(const Comm< Ordinal > &comm)
Get the number of processes in the communicator.
Default traits class for all conversions between value types.
TypeTo as(const TypeFrom &t)
Convert from one value type to another.
RCP< CommRequest< Ordinal > > ireceive(const ArrayRCP< Packet > &recvBuffer, const int sourceRank, const int tag, const Comm< Ordinal > &comm)
Variant of ireceive that takes a tag argument (and restores the correct order of arguments).
Abstract interface for distributed-memory communication.
#define TEST_COMPARE_ARRAYS(a1, a2)
Assert that a1.size()==a2.size() and a[i]==b[i], i=0....
ScalarTraits< Packet > PST
std::pair< typename PST::magnitudeType, typename PST::magnitudeType > magnitudeType
RCP< Teuchos::CommRequest< int > > isend(const ArrayRCP< const double > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
static std::string name()
RCP< T > rcpFromRef(T &r)
Return a non-owning weak RCP object from a raw object reference for a defined type.
RCP< CommStatus< Ordinal > > wait(const Comm< Ordinal > &comm, const Ptr< RCP< CommRequest< Ordinal > > > &request)
Wait on a single communication request, and return its status.
Smart reference counting pointer class for automatic garbage collection.
static std::pair< Packet, Packet > conjugate(std::pair< Packet, Packet > x)
static std::pair< Packet, Packet > one()
static const bool isComplex
Determines if scalar type is std::complex.
static std::pair< Packet, Packet > random()
Ptr< T > outArg(T &arg)
create a non-persisting (required or optional) output argument for a function call.
Definition of Teuchos::as, for conversions between types.
void readySend(const Packet sendBuffer[], const Ordinal count, const int destRank, const int tag, const Comm< Ordinal > &comm)
Variant of readySend() that accepts a message tag.
Class that helps parse command line input arguments from (argc,argv[]) and set options.
static std::string name()
Reference-counted smart pointer for managing arrays.
Replacement for std::vector that is compatible with the Teuchos Memory Management classes...