51 MPI_Op getMpiOpForEReductionType (
const enum EReductionType reductionType) {
53 switch (reductionType) {
60 "The given EReductionType value is invalid.");
67 std::string getMpiErrorString (
const int errCode) {
70 char errString [MPI_MAX_ERROR_STRING+1];
71 int errStringLen = MPI_MAX_ERROR_STRING;
72 (void) MPI_Error_string (errCode, errString, &errStringLen);
77 if (errString[errStringLen-1] !=
'\0') {
78 errString[errStringLen] =
'\0';
80 return std::string (errString);
98 static MPI_Datatype getType (
const T&);
103 #ifdef HAVE_TEUCHOS_COMPLEX 105 class MpiTypeTraits<
std::complex<double> > {
107 static MPI_Datatype getType (
const std::complex<double>&) {
108 return MPI_C_DOUBLE_COMPLEX;
113 class MpiTypeTraits<
std::complex<float> > {
115 static MPI_Datatype getType (
const std::complex<float>&) {
116 return MPI_C_FLOAT_COMPLEX;
119 #endif // HAVE_TEUCHOS_COMPLEX 123 class MpiTypeTraits<double> {
125 static MPI_Datatype getType (
const double&) {
131 class MpiTypeTraits<float> {
133 static MPI_Datatype getType (
const float&) {
138 #ifdef HAVE_TEUCHOS_LONG_LONG_INT 140 class MpiTypeTraits<long long> {
142 static MPI_Datatype getType (
const long long&) {
143 return MPI_LONG_LONG;
148 class MpiTypeTraits<unsigned long long> {
150 static MPI_Datatype getType (
const unsigned long long&) {
151 return MPI_UNSIGNED_LONG_LONG;
154 #endif // HAVE_TEUCHOS_LONG_LONG_INT 157 class MpiTypeTraits<long> {
159 static MPI_Datatype getType (
const long&) {
165 class MpiTypeTraits<unsigned long> {
167 static MPI_Datatype getType (
const unsigned long&) {
168 return MPI_UNSIGNED_LONG;
173 class MpiTypeTraits<int> {
175 static MPI_Datatype getType (
const int&) {
181 class MpiTypeTraits<unsigned int> {
183 static MPI_Datatype getType (
const unsigned int&) {
189 class MpiTypeTraits<short> {
191 static MPI_Datatype getType (
const short&) {
197 class MpiTypeTraits<unsigned short> {
199 static MPI_Datatype getType (
const unsigned short&) {
200 return MPI_UNSIGNED_SHORT;
215 reduceAllImpl (
const Comm<int>& comm,
216 const EReductionType reductType,
218 const T sendBuffer[],
225 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
226 if (mpiComm == NULL) {
228 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
229 if (serialComm == NULL) {
232 std::auto_ptr<ValueTypeReductionOp<int, T> > reductOp (createOp<int, T> (reductType));
233 reduceAll (comm, *reductOp, count, sendBuffer, globalReducts);
236 std::copy (sendBuffer, sendBuffer + count, globalReducts);
239 MPI_Op rawMpiOp = getMpiOpForEReductionType (reductType);
240 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
242 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
243 const int err = MPI_Allreduce (const_cast<T*> (sendBuffer),
244 globalReducts, count, rawMpiType, rawMpiOp, rawMpiComm);
248 "MPI_Allreduce failed with the following error: " 249 << getMpiErrorString (err));
253 std::copy (sendBuffer, sendBuffer + count, globalReducts);
267 gatherImpl (
const T sendBuf[],
272 const Comm<int>& comm)
278 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
279 if (mpiComm == NULL) {
281 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
282 if (serialComm == NULL) {
285 gather<int, T> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
288 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
291 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
293 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
294 const int err = MPI_Gather (const_cast<T*> (sendBuf), sendCount, rawMpiType,
295 recvBuf, recvCount, rawMpiType,
300 "MPI_Gather failed with the following error: " 301 << getMpiErrorString (err));
305 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
319 scatterImpl (
const T sendBuf[],
324 const Comm<int>& comm)
330 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
331 if (mpiComm == NULL) {
333 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
334 if (serialComm == NULL) {
337 scatter<int, T> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
340 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
343 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
345 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
347 MPI_Scatter (const_cast<T*> (sendBuf), sendCount, rawMpiType,
348 recvBuf, recvCount, rawMpiType,
351 (err != MPI_SUCCESS, std::runtime_error,
352 "MPI_Scatter failed with the following error: " 353 << getMpiErrorString (err));
358 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
372 reduceImpl (
const T sendBuf[],
375 const EReductionType reductType,
377 const Comm<int>& comm)
383 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
384 if (mpiComm == NULL) {
386 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
387 if (serialComm == NULL) {
390 reduce<int, T> (sendBuf, recvBuf, count, reductType, root, comm);
393 std::copy (sendBuf, sendBuf + count, recvBuf);
396 MPI_Op rawMpiOp = getMpiOpForEReductionType (reductType);
397 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
399 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
400 const int err = MPI_Reduce (const_cast<T*> (sendBuf), recvBuf, count,
401 rawMpiType, rawMpiOp, root, rawMpiComm);
403 (err != MPI_SUCCESS, std::runtime_error,
"MPI_Reduce failed with the " 404 "following error: " << getMpiErrorString (err));
408 std::copy (sendBuf, sendBuf + count, recvBuf);
422 gathervImpl (
const T sendBuf[],
425 const int recvCounts[],
428 const Comm<int>& comm)
434 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
435 if (mpiComm == NULL) {
437 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
438 if (serialComm == NULL) {
441 gatherv<int, T> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
445 recvCounts[0] > sendCount, std::invalid_argument,
446 "Teuchos::gatherv: If the input communicator contains only one " 447 "process, then you cannot receive more entries than you send. " 448 "You aim to receive " << recvCounts[0] <<
" entries, but to send " 449 << sendCount <<
" entries.");
453 std::copy (sendBuf, sendBuf + recvCounts[0], recvBuf + displs[0]);
456 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
458 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
459 const int err = MPI_Gatherv (const_cast<T*> (sendBuf),
463 const_cast<int*> (recvCounts),
464 const_cast<int*> (displs),
471 "MPI_Gatherv failed with the following error: " 472 << getMpiErrorString (err));
477 recvCounts[0] > sendCount, std::invalid_argument,
478 "Teuchos::gatherv: If the input communicator contains only one " 479 "process, then you cannot receive more entries than you send. " 480 "You aim to receive " << recvCounts[0] <<
" entries, but to send " 481 << sendCount <<
" entries.");
485 std::copy (sendBuf, sendBuf + recvCounts[0], recvBuf + displs[0]);
494 template<
typename Packet>
495 RCP<Teuchos::CommRequest<int> >
496 ireceiveGeneral(
const Comm<int>& comm,
497 const ArrayRCP<Packet> &recvBuffer,
498 const int sourceRank)
502 <<
"> ( value type )" 504 ValueTypeSerializationBuffer<int, Packet>
505 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
506 RCP<CommRequest<int> > commRequest =
507 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank);
508 set_extra_data (recvBuffer,
"buffer", inOutArg (commRequest));
514 template<
typename Packet>
515 RCP<Teuchos::CommRequest<int> >
516 ireceiveGeneral (
const ArrayRCP<Packet> &recvBuffer,
517 const int sourceRank,
519 const Comm<int>& comm)
523 <<
"> ( value type )" 525 ValueTypeSerializationBuffer<int, Packet>
526 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
527 RCP<CommRequest<int> > commRequest =
528 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank, tag);
529 set_extra_data (recvBuffer,
"buffer", inOutArg (commRequest));
546 RCP<CommRequest<int> >
547 ireceiveImpl (
const Comm<int>& comm,
548 const ArrayRCP<T>& recvBuffer,
549 const int sourceRank)
555 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
556 if (mpiComm == NULL) {
558 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
559 if (serialComm == NULL) {
562 return ireceiveGeneral<T> (comm, recvBuffer, sourceRank);
568 "ireceiveImpl: Not implemented for a serial communicator.");
572 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
574 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
575 T* rawRecvBuf = recvBuffer.getRawPtr ();
576 const int count = as<int> (recvBuffer.size ());
577 const int tag = mpiComm->getTag ();
578 MPI_Request rawRequest = MPI_REQUEST_NULL;
579 const int err = MPI_Irecv (rawRecvBuf, count, rawType, sourceRank, tag,
580 rawComm, &rawRequest);
582 err != MPI_SUCCESS, std::runtime_error,
583 "MPI_Irecv failed with the following error: " 584 << getMpiErrorString (err));
586 ArrayRCP<const char> buf =
587 arcp_const_cast<
const char> (arcp_reinterpret_cast<
char> (recvBuffer));
588 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
589 return rcp_implicit_cast<CommRequest<int> > (req);
595 "ireceiveImpl: Not implemented for a serial communicator.");
612 RCP<CommRequest<int> >
613 ireceiveImpl (
const ArrayRCP<T>& recvBuffer,
614 const int sourceRank,
616 const Comm<int>& comm)
622 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
623 if (mpiComm == NULL) {
625 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
626 if (serialComm == NULL) {
629 return ireceiveGeneral<T> (recvBuffer, sourceRank, tag, comm);
635 "ireceiveImpl: Not implemented for a serial communicator.");
639 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
641 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
642 T* rawRecvBuf = recvBuffer.getRawPtr ();
643 const int count = as<int> (recvBuffer.size ());
644 MPI_Request rawRequest = MPI_REQUEST_NULL;
645 const int err = MPI_Irecv (rawRecvBuf, count, rawType, sourceRank, tag,
646 rawComm, &rawRequest);
648 err != MPI_SUCCESS, std::runtime_error,
649 "MPI_Irecv failed with the following error: " 650 << getMpiErrorString (err));
652 ArrayRCP<const char> buf =
653 arcp_const_cast<
const char> (arcp_reinterpret_cast<
char> (recvBuffer));
654 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
655 return rcp_implicit_cast<CommRequest<int> > (req);
661 "ireceiveImpl: Not implemented for a serial communicator.");
674 sendGeneral (
const Comm<int>& comm,
676 const T sendBuffer[],
681 ConstValueTypeSerializationBuffer<int,T> charSendBuffer (count, sendBuffer);
682 comm.send (charSendBuffer.getBytes (),
683 charSendBuffer.getCharBuffer (),
691 sendGeneral (
const T sendBuffer[],
695 const Comm<int>& comm)
699 ConstValueTypeSerializationBuffer<int,T> charSendBuffer (count, sendBuffer);
700 comm.send (charSendBuffer.getBytes (),
701 charSendBuffer.getCharBuffer (),
719 sendImpl (
const Comm<int>& comm,
721 const T sendBuffer[],
728 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
729 if (mpiComm == NULL) {
731 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
732 if (serialComm == NULL) {
735 sendGeneral<T> (comm, count, sendBuffer, destRank);
741 "sendImpl: Not implemented for a serial communicator.");
745 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
747 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
748 T* rawBuf =
const_cast<T*
> (sendBuffer);
749 const int tag = mpiComm->getTag ();
750 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
754 "MPI_Send failed with the following error: " 755 << getMpiErrorString (err));
761 "sendImpl: Not implemented for a serial communicator.");
769 sendImpl (
const T sendBuffer[],
773 const Comm<int>& comm)
779 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
780 if (mpiComm == NULL) {
782 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
783 if (serialComm == NULL) {
786 sendGeneral<T> (sendBuffer, count, destRank, tag, comm);
792 "sendImpl: Not implemented for a serial communicator.");
796 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
798 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
799 T* rawBuf =
const_cast<T*
> (sendBuffer);
800 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
804 "MPI_Send failed with the following error: " 805 << getMpiErrorString (err));
811 "sendImpl: Not implemented for a serial communicator.");
821 RCP<CommRequest<int> >
822 isendGeneral (
const Comm<int>& comm,
823 const ArrayRCP<const T>& sendBuffer,
828 ConstValueTypeSerializationBuffer<int, T>
829 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
830 RCP<CommRequest<int> > commRequest =
831 comm.isend (charSendBuffer.getCharBufferView (), destRank);
832 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
843 RCP<CommRequest<int> >
844 isendGeneral (
const ArrayRCP<const T>& sendBuffer,
847 const Comm<int>& comm)
851 ConstValueTypeSerializationBuffer<int, T>
852 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
853 RCP<CommRequest<int> > commRequest =
854 comm.isend (charSendBuffer.getCharBufferView (), destRank, tag);
855 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
862 RCP<Teuchos::CommRequest<int> >
863 isendImpl (
const ArrayRCP<const T>& sendBuffer,
866 const Comm<int>& comm)
872 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
873 if (mpiComm == NULL) {
875 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
876 if (serialComm == NULL) {
879 return isendGeneral<T> (sendBuffer, destRank, tag, comm);
883 true, std::logic_error,
884 "isendImpl: Not implemented for a serial communicator.");
888 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
890 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
894 T* rawSendBuf =
const_cast<T*
> (sendBuffer.getRawPtr ());
895 const int count = as<int> (sendBuffer.size ());
896 MPI_Request rawRequest = MPI_REQUEST_NULL;
897 const int err = MPI_Isend (rawSendBuf, count, rawType, destRank, tag,
898 rawComm, &rawRequest);
902 "MPI_Isend failed with the following error: " 903 << getMpiErrorString (err));
905 ArrayRCP<const char> buf = arcp_reinterpret_cast<
const char> (sendBuffer);
906 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
907 return rcp_implicit_cast<CommRequest<int> > (req);
913 "isendImpl: Not implemented for a serial communicator.");
923 switch (reductType) {
930 true, std::invalid_argument,
"Teuchos::toString(EReductionType): " 931 "Invalid EReductionType value " << reductType <<
". Valid values " 949 #ifdef HAVE_TEUCHOS_COMPLEX 953 reduceAll<int, std::complex<double> > (
const Comm<int>& comm,
954 const EReductionType reductType,
956 const std::complex<double> sendBuffer[],
957 std::complex<double> globalReducts[])
960 "Teuchos::reduceAll<int, std::complex<double> > (" << count <<
", " 963 reduceAllImpl<std::complex<double> > (comm, reductType, count, sendBuffer, globalReducts);
967 RCP<Teuchos::CommRequest<int> >
968 ireceive<int, std::complex<double> > (
const Comm<int>& comm,
969 const ArrayRCP<std::complex<double> >& recvBuffer,
970 const int sourceRank)
973 return ireceiveImpl<std::complex<double> > (comm, recvBuffer, sourceRank);
977 RCP<Teuchos::CommRequest<int> >
978 ireceive<int, std::complex<double> > (
const ArrayRCP<std::complex<double> >& recvBuffer,
979 const int sourceRank,
981 const Comm<int>& comm)
984 return ireceiveImpl<std::complex<double> > (recvBuffer, sourceRank, tag, comm);
989 send<int, std::complex<double> > (
const Comm<int>& comm,
991 const std::complex<double> sendBuffer[],
994 sendImpl<std::complex<double> > (comm, count, sendBuffer, destRank);
999 send<int, std::complex<double> > (
const std::complex<double> sendBuffer[],
1003 const Comm<int>& comm)
1005 sendImpl<std::complex<double> > (sendBuffer, count, destRank, tag, comm);
1009 RCP<Teuchos::CommRequest<int> >
1010 isend (
const ArrayRCP<
const std::complex<double> >& sendBuffer,
1013 const Comm<int>& comm)
1015 return isendImpl<std::complex<double> > (sendBuffer, destRank, tag, comm);
1021 reduceAll<int, std::complex<float> > (
const Comm<int>& comm,
1022 const EReductionType reductType,
1024 const std::complex<float> sendBuffer[],
1025 std::complex<float> globalReducts[])
1028 "Teuchos::reduceAll<int, std::complex<float> > (" << count <<
", " 1031 reduceAllImpl<std::complex<float> > (comm, reductType, count, sendBuffer, globalReducts);
1035 RCP<Teuchos::CommRequest<int> >
1036 ireceive<int, std::complex<float> > (
const Comm<int>& comm,
1037 const ArrayRCP<std::complex<float> >& recvBuffer,
1038 const int sourceRank)
1041 return ireceiveImpl<std::complex<float> > (comm, recvBuffer, sourceRank);
1045 RCP<Teuchos::CommRequest<int> >
1046 ireceive<int, std::complex<float> > (
const ArrayRCP<std::complex<float> >& recvBuffer,
1047 const int sourceRank,
1049 const Comm<int>& comm)
1052 return ireceiveImpl<std::complex<float> > (recvBuffer, sourceRank, tag, comm);
1057 send<int, std::complex<float> > (
const Comm<int>& comm,
1059 const std::complex<float> sendBuffer[],
1062 return sendImpl<std::complex<float> > (comm, count, sendBuffer, destRank);
1067 send<int, std::complex<float> > (
const std::complex<float> sendBuffer[],
1071 const Comm<int>& comm)
1073 return sendImpl<std::complex<float> > (sendBuffer, count, destRank, tag, comm);
1077 RCP<Teuchos::CommRequest<int> >
1078 isend (
const ArrayRCP<
const std::complex<float> >& sendBuffer,
1081 const Comm<int>& comm)
1083 return isendImpl<std::complex<float> > (sendBuffer, destRank, tag, comm);
1085 #endif // HAVE_TEUCHOS_COMPLEX 1093 const EReductionType reductType,
1095 const double sendBuffer[],
1096 double globalReducts[])
1099 "Teuchos::reduceAll<int, double> (" << count <<
", " 1102 reduceAllImpl<double> (comm, reductType, count, sendBuffer, globalReducts);
1106 RCP<Teuchos::CommRequest<int> >
1109 const int sourceRank)
1112 return ireceiveImpl<double> (comm, recvBuffer, sourceRank);
1116 RCP<Teuchos::CommRequest<int> >
1118 const int sourceRank,
1123 return ireceiveImpl<double> (recvBuffer, sourceRank, tag, comm);
1130 const double sendBuffer[],
1133 return sendImpl<double> (comm, count, sendBuffer, destRank);
1144 return sendImpl<double> (sendBuffer, count, destRank, tag, comm);
1148 RCP<Teuchos::CommRequest<int> >
1154 return isendImpl<double> (sendBuffer, destRank, tag, comm);
1161 const EReductionType reductType,
1163 const float sendBuffer[],
1164 float globalReducts[])
1167 "Teuchos::reduceAll<int, float> (" << count <<
", " 1170 reduceAllImpl<float> (comm, reductType, count, sendBuffer, globalReducts);
1174 RCP<Teuchos::CommRequest<int> >
1177 const int sourceRank)
1180 return ireceiveImpl<float> (comm, recvBuffer, sourceRank);
1184 RCP<Teuchos::CommRequest<int> >
1186 const int sourceRank,
1191 return ireceiveImpl<float> (recvBuffer, sourceRank, tag, comm);
1198 const float sendBuffer[],
1201 return sendImpl<float> (comm, count, sendBuffer, destRank);
1212 return sendImpl<float> (sendBuffer, count, destRank, tag, comm);
1216 RCP<Teuchos::CommRequest<int> >
1222 return isendImpl<float> (sendBuffer, destRank, tag, comm);
1226 #ifdef HAVE_TEUCHOS_LONG_LONG_INT 1230 gather<int, long long> (
const long long sendBuf[],
1231 const int sendCount,
1232 long long recvBuf[],
1233 const int recvCount,
1235 const Comm<int>& comm)
1237 gatherImpl<long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1242 gatherv<int, long long> (
const long long sendBuf[],
1243 const int sendCount,
1244 long long recvBuf[],
1245 const int recvCounts[],
1248 const Comm<int>& comm)
1250 gathervImpl<long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1255 reduceAll<int, long long> (
const Comm<int>& comm,
1256 const EReductionType reductType,
1258 const long long sendBuffer[],
1259 long long globalReducts[])
1262 "Teuchos::reduceAll<int, long long> (" << count <<
", " 1265 reduceAllImpl<long long> (comm, reductType, count, sendBuffer, globalReducts);
1269 RCP<Teuchos::CommRequest<int> >
1270 ireceive<int, long long> (
const Comm<int>& comm,
1271 const ArrayRCP<long long>& recvBuffer,
1272 const int sourceRank)
1275 return ireceiveImpl<long long> (comm, recvBuffer, sourceRank);
1279 RCP<Teuchos::CommRequest<int> >
1280 ireceive<int, long long> (
const ArrayRCP<long long>& recvBuffer,
1281 const int sourceRank,
1283 const Comm<int>& comm)
1286 return ireceiveImpl<long long> (recvBuffer, sourceRank, tag, comm);
1291 send<int, long long> (
const Comm<int>& comm,
1293 const long long sendBuffer[],
1296 return sendImpl<long long> (comm, count, sendBuffer, destRank);
1301 send<int, long long> (
const long long sendBuffer[],
1305 const Comm<int>& comm)
1307 return sendImpl<long long> (sendBuffer, count, destRank, tag, comm);
1311 RCP<Teuchos::CommRequest<int> >
1312 isend (
const ArrayRCP<const long long>& sendBuffer,
1315 const Comm<int>& comm)
1317 return isendImpl<long long> (sendBuffer, destRank, tag, comm);
1323 gather<int, unsigned long long> (
const unsigned long long sendBuf[],
1324 const int sendCount,
1325 unsigned long long recvBuf[],
1326 const int recvCount,
1328 const Comm<int>& comm)
1330 gatherImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1335 gatherv<int, unsigned long long> (
const unsigned long long sendBuf[],
1336 const int sendCount,
1337 unsigned long long recvBuf[],
1338 const int recvCounts[],
1341 const Comm<int>& comm)
1343 gathervImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1348 reduceAll<int, unsigned long long> (
const Comm<int>& comm,
1349 const EReductionType reductType,
1351 const unsigned long long sendBuffer[],
1352 unsigned long long globalReducts[])
1355 "Teuchos::reduceAll<int, unsigned long long> (" << count <<
", " 1358 reduceAllImpl<unsigned long long> (comm, reductType, count, sendBuffer, globalReducts);
1362 RCP<Teuchos::CommRequest<int> >
1363 ireceive<int, unsigned long long> (
const Comm<int>& comm,
1364 const ArrayRCP<unsigned long long>& recvBuffer,
1365 const int sourceRank)
1368 return ireceiveImpl<unsigned long long> (comm, recvBuffer, sourceRank);
1372 RCP<Teuchos::CommRequest<int> >
1373 ireceive<int, unsigned long long> (
const ArrayRCP<unsigned long long>& recvBuffer,
1374 const int sourceRank,
1376 const Comm<int>& comm)
1379 return ireceiveImpl<unsigned long long> (recvBuffer, sourceRank, tag, comm);
1384 send<int, unsigned long long> (
const Comm<int>& comm,
1386 const unsigned long long sendBuffer[],
1389 return sendImpl<unsigned long long> (comm, count, sendBuffer, destRank);
1394 send<int, unsigned long long> (
const unsigned long long sendBuffer[],
1398 const Comm<int>& comm)
1400 return sendImpl<unsigned long long> (sendBuffer, count, destRank, tag, comm);
1404 RCP<Teuchos::CommRequest<int> >
1405 isend (
const ArrayRCP<const unsigned long long>& sendBuffer,
1408 const Comm<int>& comm)
1410 return isendImpl<unsigned long long> (sendBuffer, destRank, tag, comm);
1413 #endif // HAVE_TEUCHOS_LONG_LONG_INT 1420 const int sendCount,
1422 const int recvCount,
1426 gatherImpl<long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1432 const int sendCount,
1434 const int recvCounts[],
1439 gathervImpl<long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1445 const EReductionType reductType,
1447 const long sendBuffer[],
1448 long globalReducts[])
1451 "Teuchos::reduceAll<int, long> (" << count <<
", " 1454 reduceAllImpl<long> (comm, reductType, count, sendBuffer, globalReducts);
1458 RCP<Teuchos::CommRequest<int> >
1461 const int sourceRank)
1464 return ireceiveImpl<long> (comm, recvBuffer, sourceRank);
1468 RCP<Teuchos::CommRequest<int> >
1470 const int sourceRank,
1475 return ireceiveImpl<long> (recvBuffer, sourceRank, tag, comm);
1482 const long sendBuffer[],
1485 return sendImpl<long> (comm, count, sendBuffer, destRank);
1496 return sendImpl<long> (sendBuffer, count, destRank, tag, comm);
1500 RCP<Teuchos::CommRequest<int> >
1506 return isendImpl<long> (sendBuffer, destRank, tag, comm);
1514 const int sendCount,
1515 unsigned long recvBuf[],
1516 const int recvCount,
1520 gatherImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1526 const int sendCount,
1527 unsigned long recvBuf[],
1528 const int recvCounts[],
1533 gathervImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1539 const EReductionType reductType,
1541 const unsigned long sendBuffer[],
1542 unsigned long globalReducts[])
1545 "Teuchos::reduceAll<int, unsigned long> (" << count <<
", " 1548 reduceAllImpl<unsigned long> (comm, reductType, count, sendBuffer, globalReducts);
1552 RCP<Teuchos::CommRequest<int> >
1555 const int sourceRank)
1558 return ireceiveImpl<unsigned long> (comm, recvBuffer, sourceRank);
1562 RCP<Teuchos::CommRequest<int> >
1564 const int sourceRank,
1569 return ireceiveImpl<unsigned long> (recvBuffer, sourceRank, tag, comm);
1576 const unsigned long sendBuffer[],
1579 return sendImpl<unsigned long> (comm, count, sendBuffer, destRank);
1590 return sendImpl<unsigned long> (sendBuffer, count, destRank, tag, comm);
1594 RCP<Teuchos::CommRequest<int> >
1600 return isendImpl<unsigned long> (sendBuffer, destRank, tag, comm);
1607 const int sendCount,
1609 const int recvCount,
1613 gatherImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1619 const int sendCount,
1621 const int recvCounts[],
1626 gathervImpl<int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1632 const int sendCount,
1634 const int recvCount,
1638 scatterImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1646 const EReductionType reductType,
1651 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1653 reduceImpl<int> (sendBuf, recvBuf, count, reductType, root, comm);
1659 const EReductionType reductType,
1661 const int sendBuffer[],
1662 int globalReducts[])
1665 "Teuchos::reduceAll<int, int> (" << count <<
", " 1668 reduceAllImpl<int> (comm, reductType, count, sendBuffer, globalReducts);
1672 RCP<Teuchos::CommRequest<int> >
1675 const int sourceRank)
1678 return ireceiveImpl<int> (comm, recvBuffer, sourceRank);
1682 RCP<Teuchos::CommRequest<int> >
1684 const int sourceRank,
1689 return ireceiveImpl<int> (recvBuffer, sourceRank, tag, comm);
1696 const int sendBuffer[],
1699 return sendImpl<int> (comm, count, sendBuffer, destRank);
1710 return sendImpl<int> (sendBuffer, count, destRank, tag, comm);
1714 RCP<Teuchos::CommRequest<int> >
1720 return isendImpl<int> (sendBuffer, destRank, tag, comm);
1727 const int sendCount,
1728 unsigned int recvBuf[],
1729 const int recvCount,
1733 gatherImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1739 const int sendCount,
1740 unsigned int recvBuf[],
1741 const int recvCounts[],
1746 gathervImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1752 const EReductionType reductType,
1754 const unsigned int sendBuffer[],
1755 unsigned int globalReducts[])
1758 "Teuchos::reduceAll<int, unsigned int> (" << count <<
", " 1761 reduceAllImpl<unsigned int> (comm, reductType, count, sendBuffer, globalReducts);
1765 RCP<Teuchos::CommRequest<int> >
1768 const int sourceRank)
1771 return ireceiveImpl<unsigned int> (comm, recvBuffer, sourceRank);
1775 RCP<Teuchos::CommRequest<int> >
1777 const int sourceRank,
1782 return ireceiveImpl<unsigned int> (recvBuffer, sourceRank, tag, comm);
1789 const unsigned int sendBuffer[],
1792 return sendImpl<unsigned int> (comm, count, sendBuffer, destRank);
1803 return sendImpl<unsigned int> (sendBuffer, count, destRank, tag, comm);
1807 RCP<Teuchos::CommRequest<int> >
1813 return isendImpl<unsigned int> (sendBuffer, destRank, tag, comm);
1821 const int sendCount,
1823 const int recvCount,
1827 gatherImpl<short> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1833 const int sendCount,
1835 const int recvCounts[],
1840 gathervImpl<short> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1846 const EReductionType reductType,
1848 const short sendBuffer[],
1849 short globalReducts[])
1852 "Teuchos::reduceAll<int, short> (" << count <<
", " 1855 reduceAllImpl<short> (comm, reductType, count, sendBuffer, globalReducts);
1859 RCP<Teuchos::CommRequest<int> >
1862 const int sourceRank)
1865 return ireceiveImpl<short> (comm, recvBuffer, sourceRank);
1869 RCP<Teuchos::CommRequest<int> >
1871 const int sourceRank,
1876 return ireceiveImpl<short> (recvBuffer, sourceRank, tag, comm);
1883 const short sendBuffer[],
1886 return sendImpl<short> (comm, count, sendBuffer, destRank);
1897 return sendImpl<short> (sendBuffer, count, destRank, tag, comm);
1901 RCP<Teuchos::CommRequest<int> >
1907 return isendImpl<short> (sendBuffer, destRank, tag, comm);
1922 reduceAll<int, char> (
const Comm<int>& comm,
1923 const EReductionType reductType,
1925 const char sendBuffer[],
1926 char globalReducts[])
1929 "Teuchos::reduceAll<int, char> (" << count <<
", " 1932 reduceAllImpl<char> (comm, reductType, count, sendBuffer, globalReducts);
void send< int, float >(const Comm< int > &comm, const int count, const float sendBuffer[], const int destRank)
RCP< Teuchos::CommRequest< int > > ireceive< int, float >(const Comm< int > &comm, const ArrayRCP< float > &recvBuffer, const int sourceRank)
void gatherv< int, short >(const short sendBuf[], const int sendCount, short recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
void reduceAll< int, long >(const Comm< int > &comm, const EReductionType reductType, const int count, const long sendBuffer[], long globalReducts[])
RCP< Teuchos::CommRequest< int > > ireceive< int, double >(const Comm< int > &comm, const ArrayRCP< double > &recvBuffer, const int sourceRank)
RCP< Teuchos::CommRequest< int > > ireceive< int, short >(const Comm< int > &comm, const ArrayRCP< short > &recvBuffer, const int sourceRank)
void send< int, long >(const Comm< int > &comm, const int count, const long sendBuffer[], const int destRank)
void gather< int, unsigned int >(const unsigned int sendBuf[], const int sendCount, unsigned int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
void scatter< int, int >(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void gatherv< int, int >(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
void gather< int, long >(const long sendBuf[], const int sendCount, long recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void send< int, int >(const Comm< int > &comm, const int count, const int sendBuffer[], const int destRank)
void send< int, double >(const Comm< int > &comm, const int count, const double sendBuffer[], const int destRank)
void gather< int, int >(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
#define TEUCHOS_COMM_TIME_MONITOR(FUNCNAME)
void gatherv< int, unsigned long >(const unsigned long sendBuf[], const int sendCount, unsigned long recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
void reduceAll< int, unsigned int >(const Comm< int > &comm, const EReductionType reductType, const int count, const unsigned int sendBuffer[], unsigned int globalReducts[])
void reduceAll< int, short >(const Comm< int > &comm, const EReductionType reductType, const int count, const short sendBuffer[], short globalReducts[])
void reduce< int, int >(const int sendBuf[], int recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
void reduceAll< int, double >(const Comm< int > &comm, const EReductionType reductType, const int count, const double sendBuffer[], double globalReducts[])
std::string toString(const HashSet< Key > &h)
void gatherv< int, long >(const long sendBuf[], const int sendCount, long recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
TEUCHOS_DEPRECATED void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *globalReduct)
Deprecated .
void reduceAll< int, int >(const Comm< int > &comm, const EReductionType reductType, const int count, const int sendBuffer[], int globalReducts[])
void gatherv< int, unsigned int >(const unsigned int sendBuf[], const int sendCount, unsigned int recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
RCP< Teuchos::CommRequest< int > > ireceive< int, unsigned int >(const Comm< int > &comm, const ArrayRCP< unsigned int > &recvBuffer, const int sourceRank)
void reduceAll< int, unsigned long >(const Comm< int > &comm, const EReductionType reductType, const int count, const unsigned long sendBuffer[], unsigned long globalReducts[])
RCP< Teuchos::CommRequest< int > > ireceive< int, int >(const Comm< int > &comm, const ArrayRCP< int > &recvBuffer, const int sourceRank)
RCP< Teuchos::CommRequest< int > > ireceive< int, unsigned long >(const Comm< int > &comm, const ArrayRCP< unsigned long > &recvBuffer, const int sourceRank)
Abstract interface for distributed-memory communication.
RCP< Teuchos::CommRequest< int > > isend(const ArrayRCP< const double > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
void reduceAll< int, float >(const Comm< int > &comm, const EReductionType reductType, const int count, const float sendBuffer[], float globalReducts[])
RCP< Teuchos::CommRequest< int > > ireceive< int, long >(const Comm< int > &comm, const ArrayRCP< long > &recvBuffer, const int sourceRank)
void gather< int, short >(const short sendBuf[], const int sendCount, short recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void send< int, short >(const Comm< int > &comm, const int count, const short sendBuffer[], const int destRank)
void gather< int, unsigned long >(const unsigned long sendBuf[], const int sendCount, unsigned long recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
static std::string name()
void send< int, unsigned long >(const Comm< int > &comm, const int count, const unsigned long sendBuffer[], const int destRank)
Reference-counted smart pointer for managing arrays.
void send< int, unsigned int >(const Comm< int > &comm, const int count, const unsigned int sendBuffer[], const int destRank)