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.");
665 "Teuchos::sendImpl<" << TypeNameTraits<T>::name () <<
">");
666 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
668 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
669 T* rawBuf =
const_cast<T*
> (sendBuffer);
670 const int tag = mpiComm->getTag ();
671 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
675 "MPI_Send failed with the following error: "
676 << ::Teuchos::Details::getMpiErrorString (err));
682 "sendImpl: Not implemented for a serial communicator.");
683 #endif // HAVE_TEUCHOS_MPI
690 sendImpl (
const T sendBuffer[],
694 const Comm<int>& comm)
696 #ifdef HAVE_TEUCHOS_MPI
697 using Teuchos::Details::MpiTypeTraits;
702 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
703 if (mpiComm == NULL) {
705 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
706 if (serialComm == NULL) {
709 sendGeneral<T> (sendBuffer, count, destRank, tag, comm);
715 "sendImpl: Not implemented for a serial communicator.");
720 "Teuchos::sendImpl<" << TypeNameTraits<T>::name () <<
">");
721 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
723 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
724 T* rawBuf =
const_cast<T*
> (sendBuffer);
725 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
729 "MPI_Send failed with the following error: "
730 << ::Teuchos::Details::getMpiErrorString (err));
736 "sendImpl: Not implemented for a serial communicator.");
737 #endif // HAVE_TEUCHOS_MPI
746 RCP<CommRequest<int> >
747 isendGeneral (
const Comm<int>& comm,
748 const ArrayRCP<const T>& sendBuffer,
752 "Teuchos::isend<int," << TypeNameTraits<T>::name () <<
">");
753 ConstValueTypeSerializationBuffer<int, T>
754 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
755 RCP<CommRequest<int> > commRequest =
756 comm.isend (charSendBuffer.getCharBufferView (), destRank);
757 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
768 RCP<CommRequest<int> >
769 isendGeneral (
const ArrayRCP<const T>& sendBuffer,
772 const Comm<int>& comm)
775 "Teuchos::isend<int," << TypeNameTraits<T>::name () <<
">");
776 ConstValueTypeSerializationBuffer<int, T>
777 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
778 RCP<CommRequest<int> > commRequest =
779 comm.isend (charSendBuffer.getCharBufferView (), destRank, tag);
780 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
787 RCP<Teuchos::CommRequest<int> >
788 isendImpl (
const ArrayRCP<const T>& sendBuffer,
791 const Comm<int>& comm)
793 #ifdef HAVE_TEUCHOS_MPI
794 using Teuchos::Details::MpiTypeTraits;
799 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
800 if (mpiComm == NULL) {
802 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
803 if (serialComm == NULL) {
806 return isendGeneral<T> (sendBuffer, destRank, tag, comm);
810 true, std::logic_error,
811 "isendImpl: Not implemented for a serial communicator.");
816 "Teuchos::isendImpl<" << TypeNameTraits<T>::name () <<
">");
818 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
820 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
824 T* rawSendBuf =
const_cast<T*
> (sendBuffer.getRawPtr ());
825 const int count = as<int> (sendBuffer.size ());
826 MPI_Request rawRequest = MPI_REQUEST_NULL;
827 const int err = MPI_Isend (rawSendBuf, count, rawType, destRank, tag,
828 rawComm, &rawRequest);
832 "MPI_Isend failed with the following error: "
833 << ::Teuchos::Details::getMpiErrorString (err));
835 ArrayRCP<const char> buf = arcp_reinterpret_cast<
const char> (sendBuffer);
836 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
837 return rcp_implicit_cast<CommRequest<int> > (req);
843 "isendImpl: Not implemented for a serial communicator.");
844 #endif // HAVE_TEUCHOS_MPI
860 #ifdef HAVE_TEUCHOS_COMPLEX
864 reduceAll<int, std::complex<double> > (
const Comm<int>& comm,
865 const EReductionType reductType,
867 const std::complex<double> sendBuffer[],
868 std::complex<double> globalReducts[])
871 "Teuchos::reduceAll<int, std::complex<double> > (" << count <<
", "
874 reduceAllImpl<std::complex<double> > (comm, reductType, count, sendBuffer, globalReducts);
878 RCP<Teuchos::CommRequest<int> >
879 ireceive<int, std::complex<double> > (
const Comm<int>& comm,
880 const ArrayRCP<std::complex<double> >& recvBuffer,
881 const int sourceRank)
884 return ireceiveImpl<std::complex<double> > (comm, recvBuffer, sourceRank);
888 RCP<Teuchos::CommRequest<int> >
889 ireceive<int, std::complex<double> > (
const ArrayRCP<std::complex<double> >& recvBuffer,
890 const int sourceRank,
892 const Comm<int>& comm)
895 return ireceiveImpl<std::complex<double> > (recvBuffer, sourceRank, tag, comm);
900 send<int, std::complex<double> > (
const Comm<int>& comm,
902 const std::complex<double> sendBuffer[],
905 sendImpl<std::complex<double> > (comm, count, sendBuffer, destRank);
910 send<int, std::complex<double> > (
const std::complex<double> sendBuffer[],
914 const Comm<int>& comm)
916 sendImpl<std::complex<double> > (sendBuffer, count, destRank, tag, comm);
920 RCP<Teuchos::CommRequest<int> >
921 isend (
const ArrayRCP<
const std::complex<double> >& sendBuffer,
924 const Comm<int>& comm)
926 return isendImpl<std::complex<double> > (sendBuffer, destRank, tag, comm);
932 reduceAll<int, std::complex<float> > (
const Comm<int>& comm,
933 const EReductionType reductType,
935 const std::complex<float> sendBuffer[],
936 std::complex<float> globalReducts[])
939 "Teuchos::reduceAll<int, std::complex<float> > (" << count <<
", "
942 reduceAllImpl<std::complex<float> > (comm, reductType, count, sendBuffer, globalReducts);
946 RCP<Teuchos::CommRequest<int> >
947 ireceive<int, std::complex<float> > (
const Comm<int>& comm,
948 const ArrayRCP<std::complex<float> >& recvBuffer,
949 const int sourceRank)
952 return ireceiveImpl<std::complex<float> > (comm, recvBuffer, sourceRank);
956 RCP<Teuchos::CommRequest<int> >
957 ireceive<int, std::complex<float> > (
const ArrayRCP<std::complex<float> >& recvBuffer,
958 const int sourceRank,
960 const Comm<int>& comm)
963 return ireceiveImpl<std::complex<float> > (recvBuffer, sourceRank, tag, comm);
968 send<int, std::complex<float> > (
const Comm<int>& comm,
970 const std::complex<float> sendBuffer[],
973 return sendImpl<std::complex<float> > (comm, count, sendBuffer, destRank);
978 send<int, std::complex<float> > (
const std::complex<float> sendBuffer[],
982 const Comm<int>& comm)
984 return sendImpl<std::complex<float> > (sendBuffer, count, destRank, tag, comm);
988 RCP<Teuchos::CommRequest<int> >
989 isend (
const ArrayRCP<
const std::complex<float> >& sendBuffer,
992 const Comm<int>& comm)
994 return isendImpl<std::complex<float> > (sendBuffer, destRank, tag, comm);
996 #endif // HAVE_TEUCHOS_COMPLEX
1005 const double sendBuffer[],
1006 double globalReducts[])
1009 "Teuchos::reduceAll<int, double> (" << count <<
", "
1012 reduceAllImpl<double> (comm, reductType, count, sendBuffer, globalReducts);
1016 RCP<Teuchos::CommRequest<int> >
1019 const int sourceRank)
1022 return ireceiveImpl<double> (comm, recvBuffer, sourceRank);
1026 RCP<Teuchos::CommRequest<int> >
1028 const int sourceRank,
1033 return ireceiveImpl<double> (recvBuffer, sourceRank, tag, comm);
1040 const double sendBuffer[],
1043 return sendImpl<double> (comm, count, sendBuffer, destRank);
1054 return sendImpl<double> (sendBuffer, count, destRank, tag, comm);
1058 RCP<Teuchos::CommRequest<int> >
1064 return isendImpl<double> (sendBuffer, destRank, tag, comm);
1070 const int sendCount,
1072 const int recvCounts[],
1077 gathervImpl<double> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1087 const float sendBuffer[],
1088 float globalReducts[])
1091 "Teuchos::reduceAll<int, float> (" << count <<
", "
1094 reduceAllImpl<float> (comm, reductType, count, sendBuffer, globalReducts);
1098 RCP<Teuchos::CommRequest<int> >
1101 const int sourceRank)
1104 return ireceiveImpl<float> (comm, recvBuffer, sourceRank);
1108 RCP<Teuchos::CommRequest<int> >
1110 const int sourceRank,
1115 return ireceiveImpl<float> (recvBuffer, sourceRank, tag, comm);
1122 const float sendBuffer[],
1125 return sendImpl<float> (comm, count, sendBuffer, destRank);
1136 return sendImpl<float> (sendBuffer, count, destRank, tag, comm);
1140 RCP<Teuchos::CommRequest<int> >
1146 return isendImpl<float> (sendBuffer, destRank, tag, comm);
1152 const int sendCount,
1154 const int recvCounts[],
1159 gathervImpl<float> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1167 const int sendCount,
1168 long long recvBuf[],
1169 const int recvCount,
1173 gatherImpl<long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1179 const int sendCount,
1180 long long recvBuf[],
1181 const int recvCounts[],
1186 gathervImpl<long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1194 const long long sendBuffer[],
1195 long long globalReducts[])
1198 "Teuchos::reduceAll<int, long long> (" << count <<
", "
1201 reduceAllImpl<long long> (comm, reductType, count, sendBuffer, globalReducts);
1205 RCP<Teuchos::CommRequest<int> >
1208 const int sourceRank)
1211 return ireceiveImpl<long long> (comm, recvBuffer, sourceRank);
1215 RCP<Teuchos::CommRequest<int> >
1217 const int sourceRank,
1222 return ireceiveImpl<long long> (recvBuffer, sourceRank, tag, comm);
1229 const long long sendBuffer[],
1232 return sendImpl<long long> (comm, count, sendBuffer, destRank);
1243 return sendImpl<long long> (sendBuffer, count, destRank, tag, comm);
1247 RCP<Teuchos::CommRequest<int> >
1253 return isendImpl<long long> (sendBuffer, destRank, tag, comm);
1260 const int sendCount,
1261 unsigned long long recvBuf[],
1262 const int recvCount,
1266 gatherImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1272 const int sendCount,
1273 unsigned long long recvBuf[],
1274 const int recvCounts[],
1279 gathervImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1287 const unsigned long long sendBuffer[],
1288 unsigned long long globalReducts[])
1291 "Teuchos::reduceAll<int, unsigned long long> (" << count <<
", "
1294 reduceAllImpl<unsigned long long> (comm, reductType, count, sendBuffer, globalReducts);
1298 RCP<Teuchos::CommRequest<int> >
1301 const int sourceRank)
1304 return ireceiveImpl<unsigned long long> (comm, recvBuffer, sourceRank);
1308 RCP<Teuchos::CommRequest<int> >
1310 const int sourceRank,
1315 return ireceiveImpl<unsigned long long> (recvBuffer, sourceRank, tag, comm);
1322 const unsigned long long sendBuffer[],
1325 return sendImpl<unsigned long long> (comm, count, sendBuffer, destRank);
1336 return sendImpl<unsigned long long> (sendBuffer, count, destRank, tag, comm);
1340 RCP<Teuchos::CommRequest<int> >
1346 return isendImpl<unsigned long long> (sendBuffer, destRank, tag, comm);
1354 const int sendCount,
1356 const int recvCount,
1360 gatherImpl<long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1366 const int sendCount,
1368 const int recvCounts[],
1373 gathervImpl<long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1381 const long sendBuffer[],
1382 long globalReducts[])
1385 "Teuchos::reduceAll<int, long> (" << count <<
", "
1388 reduceAllImpl<long> (comm, reductType, count, sendBuffer, globalReducts);
1392 RCP<Teuchos::CommRequest<int> >
1395 const int sourceRank)
1398 return ireceiveImpl<long> (comm, recvBuffer, sourceRank);
1402 RCP<Teuchos::CommRequest<int> >
1404 const int sourceRank,
1409 return ireceiveImpl<long> (recvBuffer, sourceRank, tag, comm);
1416 const long sendBuffer[],
1419 return sendImpl<long> (comm, count, sendBuffer, destRank);
1430 return sendImpl<long> (sendBuffer, count, destRank, tag, comm);
1434 RCP<Teuchos::CommRequest<int> >
1440 return isendImpl<long> (sendBuffer, destRank, tag, comm);
1448 const int sendCount,
1449 unsigned long recvBuf[],
1450 const int recvCount,
1454 gatherImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1460 const int sendCount,
1461 unsigned long recvBuf[],
1462 const int recvCounts[],
1467 gathervImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1475 const unsigned long sendBuffer[],
1476 unsigned long globalReducts[])
1479 "Teuchos::reduceAll<int, unsigned long> (" << count <<
", "
1482 reduceAllImpl<unsigned long> (comm, reductType, count, sendBuffer, globalReducts);
1486 RCP<Teuchos::CommRequest<int> >
1489 const int sourceRank)
1492 return ireceiveImpl<unsigned long> (comm, recvBuffer, sourceRank);
1496 RCP<Teuchos::CommRequest<int> >
1498 const int sourceRank,
1503 return ireceiveImpl<unsigned long> (recvBuffer, sourceRank, tag, comm);
1510 const unsigned long sendBuffer[],
1513 return sendImpl<unsigned long> (comm, count, sendBuffer, destRank);
1524 return sendImpl<unsigned long> (sendBuffer, count, destRank, tag, comm);
1528 RCP<Teuchos::CommRequest<int> >
1534 return isendImpl<unsigned long> (sendBuffer, destRank, tag, comm);
1541 const int sendCount,
1543 const int recvCount,
1547 gatherImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1553 const int sendCount,
1555 const int recvCounts[],
1560 gathervImpl<int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1566 const int sendCount,
1568 const int recvCount,
1572 scatterImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1578 const int sendCount[],
1581 const int recvCount,
1585 scattervImpl<double> (sendBuf, sendCount, displs, recvBuf, recvCount, root, comm);
1591 const int sendCounts[],
1594 const int recvCount,
1598 scattervImpl<float> (sendBuf, sendCounts, displs, recvBuf, recvCount, root, comm);
1611 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1613 reduceImpl<int> (sendBuf, recvBuf, count, reductType, root, comm);
1625 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1627 reduceImpl<long> (sendBuf, recvBuf, count, reductType, root, comm);
1633 unsigned long recvBuf[],
1640 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1642 reduceImpl<unsigned long> (sendBuf, recvBuf, count, reductType, root, comm);
1648 unsigned long long recvBuf[],
1655 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1657 reduceImpl<unsigned long long> (sendBuf, recvBuf, count, reductType, root, comm);
1670 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1672 reduceImpl<double> (sendBuf, recvBuf, count, reductType, root, comm);
1679 const int sendBuffer[],
1680 int globalReducts[])
1683 "Teuchos::reduceAll<int, int> (" << count <<
", "
1686 reduceAllImpl<int> (comm, reductType, count, sendBuffer, globalReducts);
1690 RCP<Teuchos::CommRequest<int> >
1693 const int sourceRank)
1696 return ireceiveImpl<int> (comm, recvBuffer, sourceRank);
1700 RCP<Teuchos::CommRequest<int> >
1702 const int sourceRank,
1707 return ireceiveImpl<int> (recvBuffer, sourceRank, tag, comm);
1714 const int sendBuffer[],
1717 return sendImpl<int> (comm, count, sendBuffer, destRank);
1728 return sendImpl<int> (sendBuffer, count, destRank, tag, comm);
1732 RCP<Teuchos::CommRequest<int> >
1738 return isendImpl<int> (sendBuffer, destRank, tag, comm);
1745 const int sendCount,
1746 unsigned int recvBuf[],
1747 const int recvCount,
1751 gatherImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1757 const int sendCount,
1758 unsigned int recvBuf[],
1759 const int recvCounts[],
1764 gathervImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1772 const unsigned int sendBuffer[],
1773 unsigned int globalReducts[])
1776 "Teuchos::reduceAll<int, unsigned int> (" << count <<
", "
1779 reduceAllImpl<unsigned int> (comm, reductType, count, sendBuffer, globalReducts);
1783 RCP<Teuchos::CommRequest<int> >
1786 const int sourceRank)
1789 return ireceiveImpl<unsigned int> (comm, recvBuffer, sourceRank);
1793 RCP<Teuchos::CommRequest<int> >
1795 const int sourceRank,
1800 return ireceiveImpl<unsigned int> (recvBuffer, sourceRank, tag, comm);
1807 const unsigned int sendBuffer[],
1810 return sendImpl<unsigned int> (comm, count, sendBuffer, destRank);
1821 return sendImpl<unsigned int> (sendBuffer, count, destRank, tag, comm);
1825 RCP<Teuchos::CommRequest<int> >
1831 return isendImpl<unsigned int> (sendBuffer, destRank, tag, comm);
1839 const int sendCount,
1841 const int recvCount,
1845 gatherImpl<short> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1851 const int sendCount,
1853 const int recvCounts[],
1858 gathervImpl<short> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1866 const short sendBuffer[],
1867 short globalReducts[])
1870 "Teuchos::reduceAll<int, short> (" << count <<
", "
1873 reduceAllImpl<short> (comm, reductType, count, sendBuffer, globalReducts);
1877 RCP<Teuchos::CommRequest<int> >
1880 const int sourceRank)
1883 return ireceiveImpl<short> (comm, recvBuffer, sourceRank);
1887 RCP<Teuchos::CommRequest<int> >
1889 const int sourceRank,
1894 return ireceiveImpl<short> (recvBuffer, sourceRank, tag, comm);
1901 const short sendBuffer[],
1904 return sendImpl<short> (comm, count, sendBuffer, destRank);
1915 return sendImpl<short> (sendBuffer, count, destRank, tag, comm);
1919 RCP<Teuchos::CommRequest<int> >
1925 return isendImpl<short> (sendBuffer, destRank, tag, comm);
1940 reduceAll<int, char> (
const Comm<int>& comm,
1941 const EReductionType reductType,
1943 const char sendBuffer[],
1944 char globalReducts[])
1947 "Teuchos::reduceAll<int, char> (" << count <<
", "
1950 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)