11 #ifdef HAVE_TEUCHOS_MPI
14 #endif // HAVE_TEUCHOS_MPI
15 #ifdef HAVE_TEUCHOSCORE_CXX11
21 #ifdef HAVE_TEUCHOS_MPI
24 std::string getMpiErrorString (
const int errCode) {
27 char errString [MPI_MAX_ERROR_STRING+1];
28 int errStringLen = MPI_MAX_ERROR_STRING;
29 (void) MPI_Error_string (errCode, errString, &errStringLen);
34 if (errString[errStringLen-1] !=
'\0') {
35 errString[errStringLen] =
'\0';
37 return std::string (errString);
41 #endif // HAVE_TEUCHOS_MPI
54 reduceAllImpl (
const Comm<int>& comm,
55 const EReductionType reductType,
60 #ifdef HAVE_TEUCHOS_MPI
61 using Teuchos::Details::MpiTypeTraits;
66 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
67 if (mpiComm == NULL) {
69 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
70 if (serialComm == NULL) {
73 #ifdef HAVE_TEUCHOSCORE_CXX11
74 std::unique_ptr<ValueTypeReductionOp<int, T> >
76 std::auto_ptr<ValueTypeReductionOp<int, T> >
78 reductOp (createOp<int, T> (reductType));
79 reduceAll (comm, *reductOp, count, sendBuffer, globalReducts);
82 std::copy (sendBuffer, sendBuffer + count, globalReducts);
85 MPI_Op rawMpiOp = ::Teuchos::Details::getMpiOpForEReductionType (reductType);
86 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
88 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
90 int err = MPI_SUCCESS;
91 if (sendBuffer == globalReducts) {
95 err = MPI_Allreduce (MPI_IN_PLACE, globalReducts,
96 count, rawMpiType, rawMpiOp, rawMpiComm);
99 err = MPI_Allreduce (const_cast<T*> (sendBuffer), globalReducts,
100 count, rawMpiType, rawMpiOp, rawMpiComm);
105 "MPI_Allreduce failed with the following error: "
106 << ::Teuchos::Details::getMpiErrorString (err));
110 std::copy (sendBuffer, sendBuffer + count, globalReducts);
111 #endif // HAVE_TEUCHOS_MPI
124 gatherImpl (
const T sendBuf[],
129 const Comm<int>& comm)
131 #ifdef HAVE_TEUCHOS_MPI
132 using Teuchos::Details::MpiTypeTraits;
137 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
138 if (mpiComm == NULL) {
140 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
141 if (serialComm == NULL) {
144 gather<int, T> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
147 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
150 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
152 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
153 const int err = MPI_Gather (const_cast<T*> (sendBuf), sendCount, rawMpiType,
154 recvBuf, recvCount, rawMpiType,
159 "MPI_Gather failed with the following error: "
160 << ::Teuchos::Details::getMpiErrorString (err));
164 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
165 #endif // HAVE_TEUCHOS_MPI
178 scatterImpl (
const T sendBuf[],
183 const Comm<int>& comm)
185 #ifdef HAVE_TEUCHOS_MPI
186 using Teuchos::Details::MpiTypeTraits;
191 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
192 if (mpiComm == NULL) {
194 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
195 if (serialComm == NULL) {
198 scatter<int, T> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
201 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
204 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
206 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
208 MPI_Scatter (const_cast<T*> (sendBuf), sendCount, rawMpiType,
209 recvBuf, recvCount, rawMpiType,
212 (err != MPI_SUCCESS, std::runtime_error,
213 "MPI_Scatter failed with the following error: "
214 << ::Teuchos::Details::getMpiErrorString (err));
219 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
220 #endif // HAVE_TEUCHOS_MPI
233 reduceImpl (
const T sendBuf[],
236 const EReductionType reductType,
238 const Comm<int>& comm)
240 #ifdef HAVE_TEUCHOS_MPI
241 using Teuchos::Details::MpiTypeTraits;
246 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
247 if (mpiComm == NULL) {
249 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
250 if (serialComm == NULL) {
253 reduce<int, T> (sendBuf, recvBuf, count, reductType, root, comm);
256 std::copy (sendBuf, sendBuf + count, recvBuf);
259 MPI_Op rawMpiOp = ::Teuchos::Details::getMpiOpForEReductionType (reductType);
260 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
262 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
263 const int err = MPI_Reduce (const_cast<T*> (sendBuf), recvBuf, count,
264 rawMpiType, rawMpiOp, root, rawMpiComm);
266 (err != MPI_SUCCESS, std::runtime_error,
"MPI_Reduce failed with the "
267 "following error: " << ::Teuchos::Details::getMpiErrorString (err));
271 std::copy (sendBuf, sendBuf + count, recvBuf);
272 #endif // HAVE_TEUCHOS_MPI
285 gathervImpl (
const T sendBuf[],
288 const int recvCounts[],
291 const Comm<int>& comm)
293 #ifdef HAVE_TEUCHOS_MPI
294 using Teuchos::Details::MpiTypeTraits;
299 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
300 if (mpiComm == NULL) {
302 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
303 if (serialComm == NULL) {
306 gatherv<int, T> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
310 recvCounts[0] > sendCount, std::invalid_argument,
311 "Teuchos::gatherv: If the input communicator contains only one "
312 "process, then you cannot receive more entries than you send. "
313 "You aim to receive " << recvCounts[0] <<
" entries, but to send "
314 << sendCount <<
" entries.");
318 std::copy (sendBuf, sendBuf + recvCounts[0], recvBuf + displs[0]);
321 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
323 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
324 const int err = MPI_Gatherv (const_cast<T*> (sendBuf),
328 const_cast<int*> (recvCounts),
329 const_cast<int*> (displs),
336 "MPI_Gatherv failed with the following error: "
337 << ::Teuchos::Details::getMpiErrorString (err));
342 recvCounts[0] > sendCount, std::invalid_argument,
343 "Teuchos::gatherv: If the input communicator contains only one "
344 "process, then you cannot receive more entries than you send. "
345 "You aim to receive " << recvCounts[0] <<
" entries, but to send "
346 << sendCount <<
" entries.");
350 std::copy (sendBuf, sendBuf + recvCounts[0], recvBuf + displs[0]);
351 #endif // HAVE_TEUCHOS_MPI
359 template<
typename Packet>
360 RCP<Teuchos::CommRequest<int> >
361 ireceiveGeneral(
const Comm<int>& comm,
362 const ArrayRCP<Packet> &recvBuffer,
363 const int sourceRank)
366 "Teuchos::ireceive<int, " <<
"," << TypeNameTraits<Packet>::name ()
367 <<
"> ( value type )"
369 ValueTypeSerializationBuffer<int, Packet>
370 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
371 RCP<CommRequest<int> > commRequest =
372 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank);
373 set_extra_data (recvBuffer,
"buffer", inOutArg (commRequest));
379 template<
typename Packet>
380 RCP<Teuchos::CommRequest<int> >
381 ireceiveGeneral (
const ArrayRCP<Packet> &recvBuffer,
382 const int sourceRank,
384 const Comm<int>& comm)
387 "Teuchos::ireceive<int, " <<
"," << TypeNameTraits<Packet>::name ()
388 <<
"> ( value type )"
390 ValueTypeSerializationBuffer<int, Packet>
391 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
392 RCP<CommRequest<int> > commRequest =
393 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank, tag);
394 set_extra_data (recvBuffer,
"buffer", inOutArg (commRequest));
411 RCP<CommRequest<int> >
412 ireceiveImpl (
const Comm<int>& comm,
413 const ArrayRCP<T>& recvBuffer,
414 const int sourceRank)
416 #ifdef HAVE_TEUCHOS_MPI
417 using Teuchos::Details::MpiTypeTraits;
422 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
423 if (mpiComm == NULL) {
425 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
426 if (serialComm == NULL) {
429 return ireceiveGeneral<T> (comm, recvBuffer, sourceRank);
435 "ireceiveImpl: Not implemented for a serial communicator.");
439 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
441 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
442 T* rawRecvBuf = recvBuffer.getRawPtr ();
443 const int count = as<int> (recvBuffer.size ());
444 const int tag = mpiComm->getTag ();
445 MPI_Request rawRequest = MPI_REQUEST_NULL;
446 const int err = MPI_Irecv (rawRecvBuf, count, rawType, sourceRank, tag,
447 rawComm, &rawRequest);
449 err != MPI_SUCCESS, std::runtime_error,
450 "MPI_Irecv failed with the following error: "
451 << ::Teuchos::Details::getMpiErrorString (err));
453 ArrayRCP<const char> buf =
454 arcp_const_cast<
const char> (arcp_reinterpret_cast<
char> (recvBuffer));
455 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
456 return rcp_implicit_cast<CommRequest<int> > (req);
462 "ireceiveImpl: Not implemented for a serial communicator.");
473 #endif // HAVE_TEUCHOS_MPI
479 RCP<CommRequest<int> >
480 ireceiveImpl (
const ArrayRCP<T>& recvBuffer,
481 const int sourceRank,
483 const Comm<int>& comm)
485 #ifdef HAVE_TEUCHOS_MPI
486 using Teuchos::Details::MpiTypeTraits;
491 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
492 if (mpiComm == NULL) {
494 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
495 if (serialComm == NULL) {
498 return ireceiveGeneral<T> (recvBuffer, sourceRank, tag, comm);
504 "ireceiveImpl: Not implemented for a serial communicator.");
508 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
510 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
511 T* rawRecvBuf = recvBuffer.getRawPtr ();
512 const int count = as<int> (recvBuffer.size ());
513 MPI_Request rawRequest = MPI_REQUEST_NULL;
514 const int err = MPI_Irecv (rawRecvBuf, count, rawType, sourceRank, tag,
515 rawComm, &rawRequest);
517 err != MPI_SUCCESS, std::runtime_error,
518 "MPI_Irecv failed with the following error: "
519 << ::Teuchos::Details::getMpiErrorString (err));
521 ArrayRCP<const char> buf =
522 arcp_const_cast<
const char> (arcp_reinterpret_cast<
char> (recvBuffer));
523 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
524 return rcp_implicit_cast<CommRequest<int> > (req);
530 "ireceiveImpl: Not implemented for a serial communicator.");
533 #endif // HAVE_TEUCHOS_MPI
543 sendGeneral (
const Comm<int>& comm,
545 const T sendBuffer[],
549 "Teuchos::send<int, " << TypeNameTraits<T>::name () <<
">");
550 ConstValueTypeSerializationBuffer<int,T> charSendBuffer (count, sendBuffer);
551 comm.send (charSendBuffer.getBytes (),
552 charSendBuffer.getCharBuffer (),
560 sendGeneral (
const T sendBuffer[],
564 const Comm<int>& comm)
567 "Teuchos::send<int, " << TypeNameTraits<T>::name () <<
">");
568 ConstValueTypeSerializationBuffer<int,T> charSendBuffer (count, sendBuffer);
569 comm.send (charSendBuffer.getBytes (),
570 charSendBuffer.getCharBuffer (),
588 sendImpl (
const Comm<int>& comm,
590 const T sendBuffer[],
593 #ifdef HAVE_TEUCHOS_MPI
594 using Teuchos::Details::MpiTypeTraits;
599 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
600 if (mpiComm == NULL) {
602 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
603 if (serialComm == NULL) {
606 sendGeneral<T> (comm, count, sendBuffer, destRank);
612 "sendImpl: Not implemented for a serial communicator.");
616 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
618 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
619 T* rawBuf =
const_cast<T*
> (sendBuffer);
620 const int tag = mpiComm->getTag ();
621 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
625 "MPI_Send failed with the following error: "
626 << ::Teuchos::Details::getMpiErrorString (err));
632 "sendImpl: Not implemented for a serial communicator.");
633 #endif // HAVE_TEUCHOS_MPI
640 sendImpl (
const T sendBuffer[],
644 const Comm<int>& comm)
646 #ifdef HAVE_TEUCHOS_MPI
647 using Teuchos::Details::MpiTypeTraits;
652 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
653 if (mpiComm == NULL) {
655 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
656 if (serialComm == NULL) {
659 sendGeneral<T> (sendBuffer, count, destRank, tag, comm);
665 "sendImpl: Not implemented for a serial communicator.");
669 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
671 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
672 T* rawBuf =
const_cast<T*
> (sendBuffer);
673 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
677 "MPI_Send failed with the following error: "
678 << ::Teuchos::Details::getMpiErrorString (err));
684 "sendImpl: Not implemented for a serial communicator.");
685 #endif // HAVE_TEUCHOS_MPI
694 RCP<CommRequest<int> >
695 isendGeneral (
const Comm<int>& comm,
696 const ArrayRCP<const T>& sendBuffer,
700 "Teuchos::isend<int," << TypeNameTraits<T>::name () <<
">");
701 ConstValueTypeSerializationBuffer<int, T>
702 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
703 RCP<CommRequest<int> > commRequest =
704 comm.isend (charSendBuffer.getCharBufferView (), destRank);
705 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
716 RCP<CommRequest<int> >
717 isendGeneral (
const ArrayRCP<const T>& sendBuffer,
720 const Comm<int>& comm)
723 "Teuchos::isend<int," << TypeNameTraits<T>::name () <<
">");
724 ConstValueTypeSerializationBuffer<int, T>
725 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
726 RCP<CommRequest<int> > commRequest =
727 comm.isend (charSendBuffer.getCharBufferView (), destRank, tag);
728 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
735 RCP<Teuchos::CommRequest<int> >
736 isendImpl (
const ArrayRCP<const T>& sendBuffer,
739 const Comm<int>& comm)
741 #ifdef HAVE_TEUCHOS_MPI
742 using Teuchos::Details::MpiTypeTraits;
747 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
748 if (mpiComm == NULL) {
750 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
751 if (serialComm == NULL) {
754 return isendGeneral<T> (sendBuffer, destRank, tag, comm);
758 true, std::logic_error,
759 "isendImpl: Not implemented for a serial communicator.");
763 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
765 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
769 T* rawSendBuf =
const_cast<T*
> (sendBuffer.getRawPtr ());
770 const int count = as<int> (sendBuffer.size ());
771 MPI_Request rawRequest = MPI_REQUEST_NULL;
772 const int err = MPI_Isend (rawSendBuf, count, rawType, destRank, tag,
773 rawComm, &rawRequest);
777 "MPI_Isend failed with the following error: "
778 << ::Teuchos::Details::getMpiErrorString (err));
780 ArrayRCP<const char> buf = arcp_reinterpret_cast<
const char> (sendBuffer);
781 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
782 return rcp_implicit_cast<CommRequest<int> > (req);
788 "isendImpl: Not implemented for a serial communicator.");
789 #endif // HAVE_TEUCHOS_MPI
805 #ifdef HAVE_TEUCHOS_COMPLEX
809 reduceAll<int, std::complex<double> > (
const Comm<int>& comm,
810 const EReductionType reductType,
812 const std::complex<double> sendBuffer[],
813 std::complex<double> globalReducts[])
816 "Teuchos::reduceAll<int, std::complex<double> > (" << count <<
", "
819 reduceAllImpl<std::complex<double> > (comm, reductType, count, sendBuffer, globalReducts);
823 RCP<Teuchos::CommRequest<int> >
824 ireceive<int, std::complex<double> > (
const Comm<int>& comm,
825 const ArrayRCP<std::complex<double> >& recvBuffer,
826 const int sourceRank)
829 return ireceiveImpl<std::complex<double> > (comm, recvBuffer, sourceRank);
833 RCP<Teuchos::CommRequest<int> >
834 ireceive<int, std::complex<double> > (
const ArrayRCP<std::complex<double> >& recvBuffer,
835 const int sourceRank,
837 const Comm<int>& comm)
840 return ireceiveImpl<std::complex<double> > (recvBuffer, sourceRank, tag, comm);
845 send<int, std::complex<double> > (
const Comm<int>& comm,
847 const std::complex<double> sendBuffer[],
850 sendImpl<std::complex<double> > (comm, count, sendBuffer, destRank);
855 send<int, std::complex<double> > (
const std::complex<double> sendBuffer[],
859 const Comm<int>& comm)
861 sendImpl<std::complex<double> > (sendBuffer, count, destRank, tag, comm);
865 RCP<Teuchos::CommRequest<int> >
866 isend (
const ArrayRCP<
const std::complex<double> >& sendBuffer,
869 const Comm<int>& comm)
871 return isendImpl<std::complex<double> > (sendBuffer, destRank, tag, comm);
877 reduceAll<int, std::complex<float> > (
const Comm<int>& comm,
878 const EReductionType reductType,
880 const std::complex<float> sendBuffer[],
881 std::complex<float> globalReducts[])
884 "Teuchos::reduceAll<int, std::complex<float> > (" << count <<
", "
887 reduceAllImpl<std::complex<float> > (comm, reductType, count, sendBuffer, globalReducts);
891 RCP<Teuchos::CommRequest<int> >
892 ireceive<int, std::complex<float> > (
const Comm<int>& comm,
893 const ArrayRCP<std::complex<float> >& recvBuffer,
894 const int sourceRank)
897 return ireceiveImpl<std::complex<float> > (comm, recvBuffer, sourceRank);
901 RCP<Teuchos::CommRequest<int> >
902 ireceive<int, std::complex<float> > (
const ArrayRCP<std::complex<float> >& recvBuffer,
903 const int sourceRank,
905 const Comm<int>& comm)
908 return ireceiveImpl<std::complex<float> > (recvBuffer, sourceRank, tag, comm);
913 send<int, std::complex<float> > (
const Comm<int>& comm,
915 const std::complex<float> sendBuffer[],
918 return sendImpl<std::complex<float> > (comm, count, sendBuffer, destRank);
923 send<int, std::complex<float> > (
const std::complex<float> sendBuffer[],
927 const Comm<int>& comm)
929 return sendImpl<std::complex<float> > (sendBuffer, count, destRank, tag, comm);
933 RCP<Teuchos::CommRequest<int> >
934 isend (
const ArrayRCP<
const std::complex<float> >& sendBuffer,
937 const Comm<int>& comm)
939 return isendImpl<std::complex<float> > (sendBuffer, destRank, tag, comm);
941 #endif // HAVE_TEUCHOS_COMPLEX
950 const double sendBuffer[],
951 double globalReducts[])
954 "Teuchos::reduceAll<int, double> (" << count <<
", "
957 reduceAllImpl<double> (comm, reductType, count, sendBuffer, globalReducts);
961 RCP<Teuchos::CommRequest<int> >
964 const int sourceRank)
967 return ireceiveImpl<double> (comm, recvBuffer, sourceRank);
971 RCP<Teuchos::CommRequest<int> >
973 const int sourceRank,
978 return ireceiveImpl<double> (recvBuffer, sourceRank, tag, comm);
985 const double sendBuffer[],
988 return sendImpl<double> (comm, count, sendBuffer, destRank);
999 return sendImpl<double> (sendBuffer, count, destRank, tag, comm);
1003 RCP<Teuchos::CommRequest<int> >
1009 return isendImpl<double> (sendBuffer, destRank, tag, comm);
1015 const int sendCount,
1017 const int recvCounts[],
1022 gathervImpl<double> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1032 const float sendBuffer[],
1033 float globalReducts[])
1036 "Teuchos::reduceAll<int, float> (" << count <<
", "
1039 reduceAllImpl<float> (comm, reductType, count, sendBuffer, globalReducts);
1043 RCP<Teuchos::CommRequest<int> >
1046 const int sourceRank)
1049 return ireceiveImpl<float> (comm, recvBuffer, sourceRank);
1053 RCP<Teuchos::CommRequest<int> >
1055 const int sourceRank,
1060 return ireceiveImpl<float> (recvBuffer, sourceRank, tag, comm);
1067 const float sendBuffer[],
1070 return sendImpl<float> (comm, count, sendBuffer, destRank);
1081 return sendImpl<float> (sendBuffer, count, destRank, tag, comm);
1085 RCP<Teuchos::CommRequest<int> >
1091 return isendImpl<float> (sendBuffer, destRank, tag, comm);
1097 const int sendCount,
1099 const int recvCounts[],
1104 gathervImpl<float> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1112 const int sendCount,
1113 long long recvBuf[],
1114 const int recvCount,
1118 gatherImpl<long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1124 const int sendCount,
1125 long long recvBuf[],
1126 const int recvCounts[],
1131 gathervImpl<long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1139 const long long sendBuffer[],
1140 long long globalReducts[])
1143 "Teuchos::reduceAll<int, long long> (" << count <<
", "
1146 reduceAllImpl<long long> (comm, reductType, count, sendBuffer, globalReducts);
1150 RCP<Teuchos::CommRequest<int> >
1153 const int sourceRank)
1156 return ireceiveImpl<long long> (comm, recvBuffer, sourceRank);
1160 RCP<Teuchos::CommRequest<int> >
1162 const int sourceRank,
1167 return ireceiveImpl<long long> (recvBuffer, sourceRank, tag, comm);
1174 const long long sendBuffer[],
1177 return sendImpl<long long> (comm, count, sendBuffer, destRank);
1188 return sendImpl<long long> (sendBuffer, count, destRank, tag, comm);
1192 RCP<Teuchos::CommRequest<int> >
1198 return isendImpl<long long> (sendBuffer, destRank, tag, comm);
1205 const int sendCount,
1206 unsigned long long recvBuf[],
1207 const int recvCount,
1211 gatherImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1217 const int sendCount,
1218 unsigned long long recvBuf[],
1219 const int recvCounts[],
1224 gathervImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1232 const unsigned long long sendBuffer[],
1233 unsigned long long globalReducts[])
1236 "Teuchos::reduceAll<int, unsigned long long> (" << count <<
", "
1239 reduceAllImpl<unsigned long long> (comm, reductType, count, sendBuffer, globalReducts);
1243 RCP<Teuchos::CommRequest<int> >
1246 const int sourceRank)
1249 return ireceiveImpl<unsigned long long> (comm, recvBuffer, sourceRank);
1253 RCP<Teuchos::CommRequest<int> >
1255 const int sourceRank,
1260 return ireceiveImpl<unsigned long long> (recvBuffer, sourceRank, tag, comm);
1267 const unsigned long long sendBuffer[],
1270 return sendImpl<unsigned long long> (comm, count, sendBuffer, destRank);
1281 return sendImpl<unsigned long long> (sendBuffer, count, destRank, tag, comm);
1285 RCP<Teuchos::CommRequest<int> >
1291 return isendImpl<unsigned long long> (sendBuffer, destRank, tag, comm);
1299 const int sendCount,
1301 const int recvCount,
1305 gatherImpl<long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1311 const int sendCount,
1313 const int recvCounts[],
1318 gathervImpl<long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1326 const long sendBuffer[],
1327 long globalReducts[])
1330 "Teuchos::reduceAll<int, long> (" << count <<
", "
1333 reduceAllImpl<long> (comm, reductType, count, sendBuffer, globalReducts);
1337 RCP<Teuchos::CommRequest<int> >
1340 const int sourceRank)
1343 return ireceiveImpl<long> (comm, recvBuffer, sourceRank);
1347 RCP<Teuchos::CommRequest<int> >
1349 const int sourceRank,
1354 return ireceiveImpl<long> (recvBuffer, sourceRank, tag, comm);
1361 const long sendBuffer[],
1364 return sendImpl<long> (comm, count, sendBuffer, destRank);
1375 return sendImpl<long> (sendBuffer, count, destRank, tag, comm);
1379 RCP<Teuchos::CommRequest<int> >
1385 return isendImpl<long> (sendBuffer, destRank, tag, comm);
1393 const int sendCount,
1394 unsigned long recvBuf[],
1395 const int recvCount,
1399 gatherImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1405 const int sendCount,
1406 unsigned long recvBuf[],
1407 const int recvCounts[],
1412 gathervImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1420 const unsigned long sendBuffer[],
1421 unsigned long globalReducts[])
1424 "Teuchos::reduceAll<int, unsigned long> (" << count <<
", "
1427 reduceAllImpl<unsigned long> (comm, reductType, count, sendBuffer, globalReducts);
1431 RCP<Teuchos::CommRequest<int> >
1434 const int sourceRank)
1437 return ireceiveImpl<unsigned long> (comm, recvBuffer, sourceRank);
1441 RCP<Teuchos::CommRequest<int> >
1443 const int sourceRank,
1448 return ireceiveImpl<unsigned long> (recvBuffer, sourceRank, tag, comm);
1455 const unsigned long sendBuffer[],
1458 return sendImpl<unsigned long> (comm, count, sendBuffer, destRank);
1469 return sendImpl<unsigned long> (sendBuffer, count, destRank, tag, comm);
1473 RCP<Teuchos::CommRequest<int> >
1479 return isendImpl<unsigned long> (sendBuffer, destRank, tag, comm);
1486 const int sendCount,
1488 const int recvCount,
1492 gatherImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1498 const int sendCount,
1500 const int recvCounts[],
1505 gathervImpl<int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1511 const int sendCount,
1513 const int recvCount,
1517 scatterImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1530 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1532 reduceImpl<int> (sendBuf, recvBuf, count, reductType, root, comm);
1544 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1546 reduceImpl<long> (sendBuf, recvBuf, count, reductType, root, comm);
1552 unsigned long recvBuf[],
1559 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1561 reduceImpl<unsigned long> (sendBuf, recvBuf, count, reductType, root, comm);
1567 unsigned long long recvBuf[],
1574 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1576 reduceImpl<unsigned long long> (sendBuf, recvBuf, count, reductType, root, comm);
1589 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1591 reduceImpl<double> (sendBuf, recvBuf, count, reductType, root, comm);
1598 const int sendBuffer[],
1599 int globalReducts[])
1602 "Teuchos::reduceAll<int, int> (" << count <<
", "
1605 reduceAllImpl<int> (comm, reductType, count, sendBuffer, globalReducts);
1609 RCP<Teuchos::CommRequest<int> >
1612 const int sourceRank)
1615 return ireceiveImpl<int> (comm, recvBuffer, sourceRank);
1619 RCP<Teuchos::CommRequest<int> >
1621 const int sourceRank,
1626 return ireceiveImpl<int> (recvBuffer, sourceRank, tag, comm);
1633 const int sendBuffer[],
1636 return sendImpl<int> (comm, count, sendBuffer, destRank);
1647 return sendImpl<int> (sendBuffer, count, destRank, tag, comm);
1651 RCP<Teuchos::CommRequest<int> >
1657 return isendImpl<int> (sendBuffer, destRank, tag, comm);
1664 const int sendCount,
1665 unsigned int recvBuf[],
1666 const int recvCount,
1670 gatherImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1676 const int sendCount,
1677 unsigned int recvBuf[],
1678 const int recvCounts[],
1683 gathervImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1691 const unsigned int sendBuffer[],
1692 unsigned int globalReducts[])
1695 "Teuchos::reduceAll<int, unsigned int> (" << count <<
", "
1698 reduceAllImpl<unsigned int> (comm, reductType, count, sendBuffer, globalReducts);
1702 RCP<Teuchos::CommRequest<int> >
1705 const int sourceRank)
1708 return ireceiveImpl<unsigned int> (comm, recvBuffer, sourceRank);
1712 RCP<Teuchos::CommRequest<int> >
1714 const int sourceRank,
1719 return ireceiveImpl<unsigned int> (recvBuffer, sourceRank, tag, comm);
1726 const unsigned int sendBuffer[],
1729 return sendImpl<unsigned int> (comm, count, sendBuffer, destRank);
1740 return sendImpl<unsigned int> (sendBuffer, count, destRank, tag, comm);
1744 RCP<Teuchos::CommRequest<int> >
1750 return isendImpl<unsigned int> (sendBuffer, destRank, tag, comm);
1758 const int sendCount,
1760 const int recvCount,
1764 gatherImpl<short> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1770 const int sendCount,
1772 const int recvCounts[],
1777 gathervImpl<short> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1785 const short sendBuffer[],
1786 short globalReducts[])
1789 "Teuchos::reduceAll<int, short> (" << count <<
", "
1792 reduceAllImpl<short> (comm, reductType, count, sendBuffer, globalReducts);
1796 RCP<Teuchos::CommRequest<int> >
1799 const int sourceRank)
1802 return ireceiveImpl<short> (comm, recvBuffer, sourceRank);
1806 RCP<Teuchos::CommRequest<int> >
1808 const int sourceRank,
1813 return ireceiveImpl<short> (recvBuffer, sourceRank, tag, comm);
1820 const short sendBuffer[],
1823 return sendImpl<short> (comm, count, sendBuffer, destRank);
1834 return sendImpl<short> (sendBuffer, count, destRank, tag, comm);
1838 RCP<Teuchos::CommRequest<int> >
1844 return isendImpl<short> (sendBuffer, destRank, tag, comm);
1859 reduceAll<int, char> (
const Comm<int>& comm,
1860 const EReductionType reductType,
1862 const char sendBuffer[],
1863 char globalReducts[])
1866 "Teuchos::reduceAll<int, char> (" << count <<
", "
1869 reduceAllImpl<char> (comm, reductType, count, sendBuffer, globalReducts);
void reduce< int, unsigned long >(const unsigned long sendBuf[], unsigned long recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
void reduce< int, long >(const long sendBuf[], long recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
RCP< Teuchos::CommRequest< int > > ireceive< int, unsigned long long >(const Comm< int > &comm, const ArrayRCP< unsigned long long > &recvBuffer, const int sourceRank)
void send< int, float >(const Comm< int > &comm, const int count, const float sendBuffer[], const int destRank)
EReductionType
Predefined reduction operations that Teuchos::Comm understands.
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 gather< int, unsigned long long >(const unsigned long long sendBuf[], const int sendCount, unsigned long long recvBuf[], const int recvCount, 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[])
void send< int, unsigned long long >(const Comm< int > &comm, const int count, const unsigned long long sendBuffer[], const int destRank)
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 reduce< int, double >(const double sendBuf[], double recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
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 gatherv< int, long long >(const long long sendBuf[], const int sendCount, long long 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)
RCP< Teuchos::CommRequest< int > > ireceive< int, long long >(const Comm< int > &comm, const ArrayRCP< long long > &recvBuffer, const int sourceRank)
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)
void gather< int, long long >(const long long sendBuf[], const int sendCount, long long 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 send< int, long long >(const Comm< int > &comm, const int count, const long long sendBuffer[], const int destRank)
void reduceAll< int, short >(const Comm< int > &comm, const EReductionType reductType, const int count, const short sendBuffer[], short globalReducts[])
void reduce< int, unsigned long long >(const unsigned long long sendBuf[], unsigned long long recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
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, unsigned long long >(const unsigned long long sendBuf[], const int sendCount, unsigned long long recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
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)
void reduceAll< int, int >(const Comm< int > &comm, const EReductionType reductType, const int count, const int sendBuffer[], int globalReducts[])
void reduceAll< int, unsigned long long >(const Comm< int > &comm, const EReductionType reductType, const int count, const unsigned long long sendBuffer[], unsigned long long 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)
void gatherv< int, double >(const double sendBuf[], const int sendCount, double recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
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[])
Declaration of Teuchos::Details::MpiTypeTraits (only if building with MPI)
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)
void reduceAll< int, long long >(const Comm< int > &comm, const EReductionType reductType, const int count, const long long sendBuffer[], long long globalReducts[])
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)
void gatherv< int, float >(const float sendBuf[], const int sendCount, float recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)