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
225 scattervImpl (
const T sendBuf[],
226 const int sendCounts[],
231 const Comm<int>& comm)
233 #ifdef HAVE_TEUCHOS_MPI
234 using Teuchos::Details::MpiTypeTraits;
239 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
240 if (mpiComm == NULL) {
242 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
243 if (serialComm == NULL) {
246 scatterv<int, T> (sendBuf, sendCounts, displs, recvBuf, recvCount, root, comm);
249 std::copy (sendBuf, sendBuf + sendCounts[0], recvBuf);
252 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
254 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
256 MPI_Scatterv (const_cast<T*> (sendBuf), sendCounts, displs, rawMpiType,
257 recvBuf, recvCount, rawMpiType,
260 (err != MPI_SUCCESS, std::runtime_error,
261 "MPI_Scatter failed with the following error: "
262 << ::Teuchos::Details::getMpiErrorString (err));
267 std::copy (sendBuf, sendBuf + sendCounts[0], recvBuf);
268 #endif // HAVE_TEUCHOS_MPI
281 reduceImpl (
const T sendBuf[],
284 const EReductionType reductType,
286 const Comm<int>& comm)
288 #ifdef HAVE_TEUCHOS_MPI
289 using Teuchos::Details::MpiTypeTraits;
294 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
295 if (mpiComm == NULL) {
297 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
298 if (serialComm == NULL) {
301 reduce<int, T> (sendBuf, recvBuf, count, reductType, root, comm);
304 std::copy (sendBuf, sendBuf + count, recvBuf);
307 MPI_Op rawMpiOp = ::Teuchos::Details::getMpiOpForEReductionType (reductType);
308 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
310 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
311 const int err = MPI_Reduce (const_cast<T*> (sendBuf), recvBuf, count,
312 rawMpiType, rawMpiOp, root, rawMpiComm);
314 (err != MPI_SUCCESS, std::runtime_error,
"MPI_Reduce failed with the "
315 "following error: " << ::Teuchos::Details::getMpiErrorString (err));
319 std::copy (sendBuf, sendBuf + count, recvBuf);
320 #endif // HAVE_TEUCHOS_MPI
333 gathervImpl (
const T sendBuf[],
336 const int recvCounts[],
339 const Comm<int>& comm)
341 #ifdef HAVE_TEUCHOS_MPI
342 using Teuchos::Details::MpiTypeTraits;
347 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
348 if (mpiComm == NULL) {
350 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
351 if (serialComm == NULL) {
354 gatherv<int, T> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
358 recvCounts[0] > sendCount, std::invalid_argument,
359 "Teuchos::gatherv: If the input communicator contains only one "
360 "process, then you cannot receive more entries than you send. "
361 "You aim to receive " << recvCounts[0] <<
" entries, but to send "
362 << sendCount <<
" entries.");
366 std::copy (sendBuf, sendBuf + recvCounts[0], recvBuf + displs[0]);
369 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
371 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
372 const int err = MPI_Gatherv (const_cast<T*> (sendBuf),
376 const_cast<int*> (recvCounts),
377 const_cast<int*> (displs),
384 "MPI_Gatherv failed with the following error: "
385 << ::Teuchos::Details::getMpiErrorString (err));
390 recvCounts[0] > sendCount, std::invalid_argument,
391 "Teuchos::gatherv: If the input communicator contains only one "
392 "process, then you cannot receive more entries than you send. "
393 "You aim to receive " << recvCounts[0] <<
" entries, but to send "
394 << sendCount <<
" entries.");
398 std::copy (sendBuf, sendBuf + recvCounts[0], recvBuf + displs[0]);
399 #endif // HAVE_TEUCHOS_MPI
407 template<
typename Packet>
408 RCP<Teuchos::CommRequest<int> >
409 ireceiveGeneral(
const Comm<int>& comm,
410 const ArrayRCP<Packet> &recvBuffer,
411 const int sourceRank)
414 "Teuchos::ireceive<int, " <<
"," << TypeNameTraits<Packet>::name ()
415 <<
"> ( value type )"
417 ValueTypeSerializationBuffer<int, Packet>
418 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
419 RCP<CommRequest<int> > commRequest =
420 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank);
421 set_extra_data (recvBuffer,
"buffer", inOutArg (commRequest));
427 template<
typename Packet>
428 RCP<Teuchos::CommRequest<int> >
429 ireceiveGeneral (
const ArrayRCP<Packet> &recvBuffer,
430 const int sourceRank,
432 const Comm<int>& comm)
435 "Teuchos::ireceive<int, " <<
"," << TypeNameTraits<Packet>::name ()
436 <<
"> ( value type )"
438 ValueTypeSerializationBuffer<int, Packet>
439 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
440 RCP<CommRequest<int> > commRequest =
441 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank, tag);
442 set_extra_data (recvBuffer,
"buffer", inOutArg (commRequest));
459 RCP<CommRequest<int> >
460 ireceiveImpl (
const Comm<int>& comm,
461 const ArrayRCP<T>& recvBuffer,
462 const int sourceRank)
464 #ifdef HAVE_TEUCHOS_MPI
465 using Teuchos::Details::MpiTypeTraits;
470 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
471 if (mpiComm == NULL) {
473 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
474 if (serialComm == NULL) {
477 return ireceiveGeneral<T> (comm, recvBuffer, sourceRank);
483 "ireceiveImpl: Not implemented for a serial communicator.");
487 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
489 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
490 T* rawRecvBuf = recvBuffer.getRawPtr ();
491 const int count = as<int> (recvBuffer.size ());
492 const int tag = mpiComm->getTag ();
493 MPI_Request rawRequest = MPI_REQUEST_NULL;
494 const int err = MPI_Irecv (rawRecvBuf, count, rawType, sourceRank, tag,
495 rawComm, &rawRequest);
497 err != MPI_SUCCESS, std::runtime_error,
498 "MPI_Irecv failed with the following error: "
499 << ::Teuchos::Details::getMpiErrorString (err));
501 ArrayRCP<const char> buf =
502 arcp_const_cast<
const char> (arcp_reinterpret_cast<
char> (recvBuffer));
503 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
504 return rcp_implicit_cast<CommRequest<int> > (req);
510 "ireceiveImpl: Not implemented for a serial communicator.");
521 #endif // HAVE_TEUCHOS_MPI
527 RCP<CommRequest<int> >
528 ireceiveImpl (
const ArrayRCP<T>& recvBuffer,
529 const int sourceRank,
531 const Comm<int>& comm)
533 #ifdef HAVE_TEUCHOS_MPI
534 using Teuchos::Details::MpiTypeTraits;
539 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
540 if (mpiComm == NULL) {
542 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
543 if (serialComm == NULL) {
546 return ireceiveGeneral<T> (recvBuffer, sourceRank, tag, comm);
552 "ireceiveImpl: Not implemented for a serial communicator.");
556 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
558 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
559 T* rawRecvBuf = recvBuffer.getRawPtr ();
560 const int count = as<int> (recvBuffer.size ());
561 MPI_Request rawRequest = MPI_REQUEST_NULL;
562 const int err = MPI_Irecv (rawRecvBuf, count, rawType, sourceRank, tag,
563 rawComm, &rawRequest);
565 err != MPI_SUCCESS, std::runtime_error,
566 "MPI_Irecv failed with the following error: "
567 << ::Teuchos::Details::getMpiErrorString (err));
569 ArrayRCP<const char> buf =
570 arcp_const_cast<
const char> (arcp_reinterpret_cast<
char> (recvBuffer));
571 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
572 return rcp_implicit_cast<CommRequest<int> > (req);
578 "ireceiveImpl: Not implemented for a serial communicator.");
581 #endif // HAVE_TEUCHOS_MPI
591 sendGeneral (
const Comm<int>& comm,
593 const T sendBuffer[],
597 "Teuchos::send<int, " << TypeNameTraits<T>::name () <<
">");
598 ConstValueTypeSerializationBuffer<int,T> charSendBuffer (count, sendBuffer);
599 comm.send (charSendBuffer.getBytes (),
600 charSendBuffer.getCharBuffer (),
608 sendGeneral (
const T sendBuffer[],
612 const Comm<int>& comm)
615 "Teuchos::send<int, " << TypeNameTraits<T>::name () <<
">");
616 ConstValueTypeSerializationBuffer<int,T> charSendBuffer (count, sendBuffer);
617 comm.send (charSendBuffer.getBytes (),
618 charSendBuffer.getCharBuffer (),
636 sendImpl (
const Comm<int>& comm,
638 const T sendBuffer[],
641 #ifdef HAVE_TEUCHOS_MPI
642 using Teuchos::Details::MpiTypeTraits;
647 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
648 if (mpiComm == NULL) {
650 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
651 if (serialComm == NULL) {
654 sendGeneral<T> (comm, count, sendBuffer, destRank);
660 "sendImpl: Not implemented for a serial communicator.");
664 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
666 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
667 T* rawBuf =
const_cast<T*
> (sendBuffer);
668 const int tag = mpiComm->getTag ();
669 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
673 "MPI_Send failed with the following error: "
674 << ::Teuchos::Details::getMpiErrorString (err));
680 "sendImpl: Not implemented for a serial communicator.");
681 #endif // HAVE_TEUCHOS_MPI
688 sendImpl (
const T sendBuffer[],
692 const Comm<int>& comm)
694 #ifdef HAVE_TEUCHOS_MPI
695 using Teuchos::Details::MpiTypeTraits;
700 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
701 if (mpiComm == NULL) {
703 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
704 if (serialComm == NULL) {
707 sendGeneral<T> (sendBuffer, count, destRank, tag, comm);
713 "sendImpl: Not implemented for a serial communicator.");
717 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
719 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
720 T* rawBuf =
const_cast<T*
> (sendBuffer);
721 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
725 "MPI_Send failed with the following error: "
726 << ::Teuchos::Details::getMpiErrorString (err));
732 "sendImpl: Not implemented for a serial communicator.");
733 #endif // HAVE_TEUCHOS_MPI
742 RCP<CommRequest<int> >
743 isendGeneral (
const Comm<int>& comm,
744 const ArrayRCP<const T>& sendBuffer,
748 "Teuchos::isend<int," << TypeNameTraits<T>::name () <<
">");
749 ConstValueTypeSerializationBuffer<int, T>
750 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
751 RCP<CommRequest<int> > commRequest =
752 comm.isend (charSendBuffer.getCharBufferView (), destRank);
753 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
764 RCP<CommRequest<int> >
765 isendGeneral (
const ArrayRCP<const T>& sendBuffer,
768 const Comm<int>& comm)
771 "Teuchos::isend<int," << TypeNameTraits<T>::name () <<
">");
772 ConstValueTypeSerializationBuffer<int, T>
773 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
774 RCP<CommRequest<int> > commRequest =
775 comm.isend (charSendBuffer.getCharBufferView (), destRank, tag);
776 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
783 RCP<Teuchos::CommRequest<int> >
784 isendImpl (
const ArrayRCP<const T>& sendBuffer,
787 const Comm<int>& comm)
789 #ifdef HAVE_TEUCHOS_MPI
790 using Teuchos::Details::MpiTypeTraits;
795 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
796 if (mpiComm == NULL) {
798 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
799 if (serialComm == NULL) {
802 return isendGeneral<T> (sendBuffer, destRank, tag, comm);
806 true, std::logic_error,
807 "isendImpl: Not implemented for a serial communicator.");
811 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
813 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
817 T* rawSendBuf =
const_cast<T*
> (sendBuffer.getRawPtr ());
818 const int count = as<int> (sendBuffer.size ());
819 MPI_Request rawRequest = MPI_REQUEST_NULL;
820 const int err = MPI_Isend (rawSendBuf, count, rawType, destRank, tag,
821 rawComm, &rawRequest);
825 "MPI_Isend failed with the following error: "
826 << ::Teuchos::Details::getMpiErrorString (err));
828 ArrayRCP<const char> buf = arcp_reinterpret_cast<
const char> (sendBuffer);
829 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
830 return rcp_implicit_cast<CommRequest<int> > (req);
836 "isendImpl: Not implemented for a serial communicator.");
837 #endif // HAVE_TEUCHOS_MPI
853 #ifdef HAVE_TEUCHOS_COMPLEX
857 reduceAll<int, std::complex<double> > (
const Comm<int>& comm,
858 const EReductionType reductType,
860 const std::complex<double> sendBuffer[],
861 std::complex<double> globalReducts[])
864 "Teuchos::reduceAll<int, std::complex<double> > (" << count <<
", "
867 reduceAllImpl<std::complex<double> > (comm, reductType, count, sendBuffer, globalReducts);
871 RCP<Teuchos::CommRequest<int> >
872 ireceive<int, std::complex<double> > (
const Comm<int>& comm,
873 const ArrayRCP<std::complex<double> >& recvBuffer,
874 const int sourceRank)
877 return ireceiveImpl<std::complex<double> > (comm, recvBuffer, sourceRank);
881 RCP<Teuchos::CommRequest<int> >
882 ireceive<int, std::complex<double> > (
const ArrayRCP<std::complex<double> >& recvBuffer,
883 const int sourceRank,
885 const Comm<int>& comm)
888 return ireceiveImpl<std::complex<double> > (recvBuffer, sourceRank, tag, comm);
893 send<int, std::complex<double> > (
const Comm<int>& comm,
895 const std::complex<double> sendBuffer[],
898 sendImpl<std::complex<double> > (comm, count, sendBuffer, destRank);
903 send<int, std::complex<double> > (
const std::complex<double> sendBuffer[],
907 const Comm<int>& comm)
909 sendImpl<std::complex<double> > (sendBuffer, count, destRank, tag, comm);
913 RCP<Teuchos::CommRequest<int> >
914 isend (
const ArrayRCP<
const std::complex<double> >& sendBuffer,
917 const Comm<int>& comm)
919 return isendImpl<std::complex<double> > (sendBuffer, destRank, tag, comm);
925 reduceAll<int, std::complex<float> > (
const Comm<int>& comm,
926 const EReductionType reductType,
928 const std::complex<float> sendBuffer[],
929 std::complex<float> globalReducts[])
932 "Teuchos::reduceAll<int, std::complex<float> > (" << count <<
", "
935 reduceAllImpl<std::complex<float> > (comm, reductType, count, sendBuffer, globalReducts);
939 RCP<Teuchos::CommRequest<int> >
940 ireceive<int, std::complex<float> > (
const Comm<int>& comm,
941 const ArrayRCP<std::complex<float> >& recvBuffer,
942 const int sourceRank)
945 return ireceiveImpl<std::complex<float> > (comm, recvBuffer, sourceRank);
949 RCP<Teuchos::CommRequest<int> >
950 ireceive<int, std::complex<float> > (
const ArrayRCP<std::complex<float> >& recvBuffer,
951 const int sourceRank,
953 const Comm<int>& comm)
956 return ireceiveImpl<std::complex<float> > (recvBuffer, sourceRank, tag, comm);
961 send<int, std::complex<float> > (
const Comm<int>& comm,
963 const std::complex<float> sendBuffer[],
966 return sendImpl<std::complex<float> > (comm, count, sendBuffer, destRank);
971 send<int, std::complex<float> > (
const std::complex<float> sendBuffer[],
975 const Comm<int>& comm)
977 return sendImpl<std::complex<float> > (sendBuffer, count, destRank, tag, comm);
981 RCP<Teuchos::CommRequest<int> >
982 isend (
const ArrayRCP<
const std::complex<float> >& sendBuffer,
985 const Comm<int>& comm)
987 return isendImpl<std::complex<float> > (sendBuffer, destRank, tag, comm);
989 #endif // HAVE_TEUCHOS_COMPLEX
998 const double sendBuffer[],
999 double globalReducts[])
1002 "Teuchos::reduceAll<int, double> (" << count <<
", "
1005 reduceAllImpl<double> (comm, reductType, count, sendBuffer, globalReducts);
1009 RCP<Teuchos::CommRequest<int> >
1012 const int sourceRank)
1015 return ireceiveImpl<double> (comm, recvBuffer, sourceRank);
1019 RCP<Teuchos::CommRequest<int> >
1021 const int sourceRank,
1026 return ireceiveImpl<double> (recvBuffer, sourceRank, tag, comm);
1033 const double sendBuffer[],
1036 return sendImpl<double> (comm, count, sendBuffer, destRank);
1047 return sendImpl<double> (sendBuffer, count, destRank, tag, comm);
1051 RCP<Teuchos::CommRequest<int> >
1057 return isendImpl<double> (sendBuffer, destRank, tag, comm);
1063 const int sendCount,
1065 const int recvCounts[],
1070 gathervImpl<double> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1080 const float sendBuffer[],
1081 float globalReducts[])
1084 "Teuchos::reduceAll<int, float> (" << count <<
", "
1087 reduceAllImpl<float> (comm, reductType, count, sendBuffer, globalReducts);
1091 RCP<Teuchos::CommRequest<int> >
1094 const int sourceRank)
1097 return ireceiveImpl<float> (comm, recvBuffer, sourceRank);
1101 RCP<Teuchos::CommRequest<int> >
1103 const int sourceRank,
1108 return ireceiveImpl<float> (recvBuffer, sourceRank, tag, comm);
1115 const float sendBuffer[],
1118 return sendImpl<float> (comm, count, sendBuffer, destRank);
1129 return sendImpl<float> (sendBuffer, count, destRank, tag, comm);
1133 RCP<Teuchos::CommRequest<int> >
1139 return isendImpl<float> (sendBuffer, destRank, tag, comm);
1145 const int sendCount,
1147 const int recvCounts[],
1152 gathervImpl<float> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1160 const int sendCount,
1161 long long recvBuf[],
1162 const int recvCount,
1166 gatherImpl<long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1172 const int sendCount,
1173 long long recvBuf[],
1174 const int recvCounts[],
1179 gathervImpl<long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1187 const long long sendBuffer[],
1188 long long globalReducts[])
1191 "Teuchos::reduceAll<int, long long> (" << count <<
", "
1194 reduceAllImpl<long long> (comm, reductType, count, sendBuffer, globalReducts);
1198 RCP<Teuchos::CommRequest<int> >
1201 const int sourceRank)
1204 return ireceiveImpl<long long> (comm, recvBuffer, sourceRank);
1208 RCP<Teuchos::CommRequest<int> >
1210 const int sourceRank,
1215 return ireceiveImpl<long long> (recvBuffer, sourceRank, tag, comm);
1222 const long long sendBuffer[],
1225 return sendImpl<long long> (comm, count, sendBuffer, destRank);
1236 return sendImpl<long long> (sendBuffer, count, destRank, tag, comm);
1240 RCP<Teuchos::CommRequest<int> >
1246 return isendImpl<long long> (sendBuffer, destRank, tag, comm);
1253 const int sendCount,
1254 unsigned long long recvBuf[],
1255 const int recvCount,
1259 gatherImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1265 const int sendCount,
1266 unsigned long long recvBuf[],
1267 const int recvCounts[],
1272 gathervImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1280 const unsigned long long sendBuffer[],
1281 unsigned long long globalReducts[])
1284 "Teuchos::reduceAll<int, unsigned long long> (" << count <<
", "
1287 reduceAllImpl<unsigned long long> (comm, reductType, count, sendBuffer, globalReducts);
1291 RCP<Teuchos::CommRequest<int> >
1294 const int sourceRank)
1297 return ireceiveImpl<unsigned long long> (comm, recvBuffer, sourceRank);
1301 RCP<Teuchos::CommRequest<int> >
1303 const int sourceRank,
1308 return ireceiveImpl<unsigned long long> (recvBuffer, sourceRank, tag, comm);
1315 const unsigned long long sendBuffer[],
1318 return sendImpl<unsigned long long> (comm, count, sendBuffer, destRank);
1329 return sendImpl<unsigned long long> (sendBuffer, count, destRank, tag, comm);
1333 RCP<Teuchos::CommRequest<int> >
1339 return isendImpl<unsigned long long> (sendBuffer, destRank, tag, comm);
1347 const int sendCount,
1349 const int recvCount,
1353 gatherImpl<long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1359 const int sendCount,
1361 const int recvCounts[],
1366 gathervImpl<long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1374 const long sendBuffer[],
1375 long globalReducts[])
1378 "Teuchos::reduceAll<int, long> (" << count <<
", "
1381 reduceAllImpl<long> (comm, reductType, count, sendBuffer, globalReducts);
1385 RCP<Teuchos::CommRequest<int> >
1388 const int sourceRank)
1391 return ireceiveImpl<long> (comm, recvBuffer, sourceRank);
1395 RCP<Teuchos::CommRequest<int> >
1397 const int sourceRank,
1402 return ireceiveImpl<long> (recvBuffer, sourceRank, tag, comm);
1409 const long sendBuffer[],
1412 return sendImpl<long> (comm, count, sendBuffer, destRank);
1423 return sendImpl<long> (sendBuffer, count, destRank, tag, comm);
1427 RCP<Teuchos::CommRequest<int> >
1433 return isendImpl<long> (sendBuffer, destRank, tag, comm);
1441 const int sendCount,
1442 unsigned long recvBuf[],
1443 const int recvCount,
1447 gatherImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1453 const int sendCount,
1454 unsigned long recvBuf[],
1455 const int recvCounts[],
1460 gathervImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1468 const unsigned long sendBuffer[],
1469 unsigned long globalReducts[])
1472 "Teuchos::reduceAll<int, unsigned long> (" << count <<
", "
1475 reduceAllImpl<unsigned long> (comm, reductType, count, sendBuffer, globalReducts);
1479 RCP<Teuchos::CommRequest<int> >
1482 const int sourceRank)
1485 return ireceiveImpl<unsigned long> (comm, recvBuffer, sourceRank);
1489 RCP<Teuchos::CommRequest<int> >
1491 const int sourceRank,
1496 return ireceiveImpl<unsigned long> (recvBuffer, sourceRank, tag, comm);
1503 const unsigned long sendBuffer[],
1506 return sendImpl<unsigned long> (comm, count, sendBuffer, destRank);
1517 return sendImpl<unsigned long> (sendBuffer, count, destRank, tag, comm);
1521 RCP<Teuchos::CommRequest<int> >
1527 return isendImpl<unsigned long> (sendBuffer, destRank, tag, comm);
1534 const int sendCount,
1536 const int recvCount,
1540 gatherImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1546 const int sendCount,
1548 const int recvCounts[],
1553 gathervImpl<int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1559 const int sendCount,
1561 const int recvCount,
1565 scatterImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1571 const int sendCount[],
1574 const int recvCount,
1578 scattervImpl<double> (sendBuf, sendCount, displs, recvBuf, recvCount, root, comm);
1584 const int sendCounts[],
1587 const int recvCount,
1591 scattervImpl<float> (sendBuf, sendCounts, displs, recvBuf, recvCount, root, comm);
1604 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1606 reduceImpl<int> (sendBuf, recvBuf, count, reductType, root, comm);
1618 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1620 reduceImpl<long> (sendBuf, recvBuf, count, reductType, root, comm);
1626 unsigned long recvBuf[],
1633 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1635 reduceImpl<unsigned long> (sendBuf, recvBuf, count, reductType, root, comm);
1641 unsigned long long recvBuf[],
1648 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1650 reduceImpl<unsigned long long> (sendBuf, recvBuf, count, reductType, root, comm);
1663 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1665 reduceImpl<double> (sendBuf, recvBuf, count, reductType, root, comm);
1672 const int sendBuffer[],
1673 int globalReducts[])
1676 "Teuchos::reduceAll<int, int> (" << count <<
", "
1679 reduceAllImpl<int> (comm, reductType, count, sendBuffer, globalReducts);
1683 RCP<Teuchos::CommRequest<int> >
1686 const int sourceRank)
1689 return ireceiveImpl<int> (comm, recvBuffer, sourceRank);
1693 RCP<Teuchos::CommRequest<int> >
1695 const int sourceRank,
1700 return ireceiveImpl<int> (recvBuffer, sourceRank, tag, comm);
1707 const int sendBuffer[],
1710 return sendImpl<int> (comm, count, sendBuffer, destRank);
1721 return sendImpl<int> (sendBuffer, count, destRank, tag, comm);
1725 RCP<Teuchos::CommRequest<int> >
1731 return isendImpl<int> (sendBuffer, destRank, tag, comm);
1738 const int sendCount,
1739 unsigned int recvBuf[],
1740 const int recvCount,
1744 gatherImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1750 const int sendCount,
1751 unsigned int recvBuf[],
1752 const int recvCounts[],
1757 gathervImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1765 const unsigned int sendBuffer[],
1766 unsigned int globalReducts[])
1769 "Teuchos::reduceAll<int, unsigned int> (" << count <<
", "
1772 reduceAllImpl<unsigned int> (comm, reductType, count, sendBuffer, globalReducts);
1776 RCP<Teuchos::CommRequest<int> >
1779 const int sourceRank)
1782 return ireceiveImpl<unsigned int> (comm, recvBuffer, sourceRank);
1786 RCP<Teuchos::CommRequest<int> >
1788 const int sourceRank,
1793 return ireceiveImpl<unsigned int> (recvBuffer, sourceRank, tag, comm);
1800 const unsigned int sendBuffer[],
1803 return sendImpl<unsigned int> (comm, count, sendBuffer, destRank);
1814 return sendImpl<unsigned int> (sendBuffer, count, destRank, tag, comm);
1818 RCP<Teuchos::CommRequest<int> >
1824 return isendImpl<unsigned int> (sendBuffer, destRank, tag, comm);
1832 const int sendCount,
1834 const int recvCount,
1838 gatherImpl<short> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1844 const int sendCount,
1846 const int recvCounts[],
1851 gathervImpl<short> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1859 const short sendBuffer[],
1860 short globalReducts[])
1863 "Teuchos::reduceAll<int, short> (" << count <<
", "
1866 reduceAllImpl<short> (comm, reductType, count, sendBuffer, globalReducts);
1870 RCP<Teuchos::CommRequest<int> >
1873 const int sourceRank)
1876 return ireceiveImpl<short> (comm, recvBuffer, sourceRank);
1880 RCP<Teuchos::CommRequest<int> >
1882 const int sourceRank,
1887 return ireceiveImpl<short> (recvBuffer, sourceRank, tag, comm);
1894 const short sendBuffer[],
1897 return sendImpl<short> (comm, count, sendBuffer, destRank);
1908 return sendImpl<short> (sendBuffer, count, destRank, tag, comm);
1912 RCP<Teuchos::CommRequest<int> >
1918 return isendImpl<short> (sendBuffer, destRank, tag, comm);
1933 reduceAll<int, char> (
const Comm<int>& comm,
1934 const EReductionType reductType,
1936 const char sendBuffer[],
1937 char globalReducts[])
1940 "Teuchos::reduceAll<int, char> (" << count <<
", "
1943 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 scatterv< int, double >(const double sendBuf[], const int sendCount[], const int displs[], double recvBuf[], const int recvCount, 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 scatterv< int, float >(const float sendBuf[], const int sendCounts[], const int displs[], float recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
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)