43 #ifdef HAVE_TEUCHOS_MPI
46 #endif // HAVE_TEUCHOS_MPI
47 #ifdef HAVE_TEUCHOSCORE_CXX11
53 #ifdef HAVE_TEUCHOS_MPI
56 std::string getMpiErrorString (
const int errCode) {
59 char errString [MPI_MAX_ERROR_STRING+1];
60 int errStringLen = MPI_MAX_ERROR_STRING;
61 (void) MPI_Error_string (errCode, errString, &errStringLen);
66 if (errString[errStringLen-1] !=
'\0') {
67 errString[errStringLen] =
'\0';
69 return std::string (errString);
73 #endif // HAVE_TEUCHOS_MPI
86 reduceAllImpl (
const Comm<int>& comm,
87 const EReductionType reductType,
92 #ifdef HAVE_TEUCHOS_MPI
93 using Teuchos::Details::MpiTypeTraits;
98 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
99 if (mpiComm == NULL) {
101 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
102 if (serialComm == NULL) {
105 #ifdef HAVE_TEUCHOSCORE_CXX11
106 std::unique_ptr<ValueTypeReductionOp<int, T> >
108 std::auto_ptr<ValueTypeReductionOp<int, T> >
110 reductOp (createOp<int, T> (reductType));
111 reduceAll (comm, *reductOp, count, sendBuffer, globalReducts);
114 std::copy (sendBuffer, sendBuffer + count, globalReducts);
117 MPI_Op rawMpiOp = ::Teuchos::Details::getMpiOpForEReductionType (reductType);
118 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
120 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
122 int err = MPI_SUCCESS;
123 if (sendBuffer == globalReducts) {
127 err = MPI_Allreduce (MPI_IN_PLACE, globalReducts,
128 count, rawMpiType, rawMpiOp, rawMpiComm);
131 err = MPI_Allreduce (const_cast<T*> (sendBuffer), globalReducts,
132 count, rawMpiType, rawMpiOp, rawMpiComm);
137 "MPI_Allreduce failed with the following error: "
138 << ::Teuchos::Details::getMpiErrorString (err));
142 std::copy (sendBuffer, sendBuffer + count, globalReducts);
143 #endif // HAVE_TEUCHOS_MPI
156 gatherImpl (
const T sendBuf[],
161 const Comm<int>& comm)
163 #ifdef HAVE_TEUCHOS_MPI
164 using Teuchos::Details::MpiTypeTraits;
169 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
170 if (mpiComm == NULL) {
172 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
173 if (serialComm == NULL) {
176 gather<int, T> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
179 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
182 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
184 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
185 const int err = MPI_Gather (const_cast<T*> (sendBuf), sendCount, rawMpiType,
186 recvBuf, recvCount, rawMpiType,
191 "MPI_Gather failed with the following error: "
192 << ::Teuchos::Details::getMpiErrorString (err));
196 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
197 #endif // HAVE_TEUCHOS_MPI
210 scatterImpl (
const T sendBuf[],
215 const Comm<int>& comm)
217 #ifdef HAVE_TEUCHOS_MPI
218 using Teuchos::Details::MpiTypeTraits;
223 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
224 if (mpiComm == NULL) {
226 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
227 if (serialComm == NULL) {
230 scatter<int, T> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
233 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
236 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
238 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
240 MPI_Scatter (const_cast<T*> (sendBuf), sendCount, rawMpiType,
241 recvBuf, recvCount, rawMpiType,
244 (err != MPI_SUCCESS, std::runtime_error,
245 "MPI_Scatter failed with the following error: "
246 << ::Teuchos::Details::getMpiErrorString (err));
251 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
252 #endif // HAVE_TEUCHOS_MPI
265 reduceImpl (
const T sendBuf[],
268 const EReductionType reductType,
270 const Comm<int>& comm)
272 #ifdef HAVE_TEUCHOS_MPI
273 using Teuchos::Details::MpiTypeTraits;
278 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
279 if (mpiComm == NULL) {
281 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
282 if (serialComm == NULL) {
285 reduce<int, T> (sendBuf, recvBuf, count, reductType, root, comm);
288 std::copy (sendBuf, sendBuf + count, recvBuf);
291 MPI_Op rawMpiOp = ::Teuchos::Details::getMpiOpForEReductionType (reductType);
292 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
294 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
295 const int err = MPI_Reduce (const_cast<T*> (sendBuf), recvBuf, count,
296 rawMpiType, rawMpiOp, root, rawMpiComm);
298 (err != MPI_SUCCESS, std::runtime_error,
"MPI_Reduce failed with the "
299 "following error: " << ::Teuchos::Details::getMpiErrorString (err));
303 std::copy (sendBuf, sendBuf + count, recvBuf);
304 #endif // HAVE_TEUCHOS_MPI
317 gathervImpl (
const T sendBuf[],
320 const int recvCounts[],
323 const Comm<int>& comm)
325 #ifdef HAVE_TEUCHOS_MPI
326 using Teuchos::Details::MpiTypeTraits;
331 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
332 if (mpiComm == NULL) {
334 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
335 if (serialComm == NULL) {
338 gatherv<int, T> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
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]);
353 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
355 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
356 const int err = MPI_Gatherv (const_cast<T*> (sendBuf),
360 const_cast<int*> (recvCounts),
361 const_cast<int*> (displs),
368 "MPI_Gatherv failed with the following error: "
369 << ::Teuchos::Details::getMpiErrorString (err));
374 recvCounts[0] > sendCount, std::invalid_argument,
375 "Teuchos::gatherv: If the input communicator contains only one "
376 "process, then you cannot receive more entries than you send. "
377 "You aim to receive " << recvCounts[0] <<
" entries, but to send "
378 << sendCount <<
" entries.");
382 std::copy (sendBuf, sendBuf + recvCounts[0], recvBuf + displs[0]);
383 #endif // HAVE_TEUCHOS_MPI
391 template<
typename Packet>
392 RCP<Teuchos::CommRequest<int> >
393 ireceiveGeneral(
const Comm<int>& comm,
394 const ArrayRCP<Packet> &recvBuffer,
395 const int sourceRank)
398 "Teuchos::ireceive<int, " <<
"," << TypeNameTraits<Packet>::name ()
399 <<
"> ( value type )"
401 ValueTypeSerializationBuffer<int, Packet>
402 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
403 RCP<CommRequest<int> > commRequest =
404 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank);
405 set_extra_data (recvBuffer,
"buffer", inOutArg (commRequest));
411 template<
typename Packet>
412 RCP<Teuchos::CommRequest<int> >
413 ireceiveGeneral (
const ArrayRCP<Packet> &recvBuffer,
414 const int sourceRank,
416 const Comm<int>& comm)
419 "Teuchos::ireceive<int, " <<
"," << TypeNameTraits<Packet>::name ()
420 <<
"> ( value type )"
422 ValueTypeSerializationBuffer<int, Packet>
423 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
424 RCP<CommRequest<int> > commRequest =
425 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank, tag);
426 set_extra_data (recvBuffer,
"buffer", inOutArg (commRequest));
443 RCP<CommRequest<int> >
444 ireceiveImpl (
const Comm<int>& comm,
445 const ArrayRCP<T>& recvBuffer,
446 const int sourceRank)
448 #ifdef HAVE_TEUCHOS_MPI
449 using Teuchos::Details::MpiTypeTraits;
454 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
455 if (mpiComm == NULL) {
457 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
458 if (serialComm == NULL) {
461 return ireceiveGeneral<T> (comm, recvBuffer, sourceRank);
467 "ireceiveImpl: Not implemented for a serial communicator.");
471 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
473 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
474 T* rawRecvBuf = recvBuffer.getRawPtr ();
475 const int count = as<int> (recvBuffer.size ());
476 const int tag = mpiComm->getTag ();
477 MPI_Request rawRequest = MPI_REQUEST_NULL;
478 const int err = MPI_Irecv (rawRecvBuf, count, rawType, sourceRank, tag,
479 rawComm, &rawRequest);
481 err != MPI_SUCCESS, std::runtime_error,
482 "MPI_Irecv failed with the following error: "
483 << ::Teuchos::Details::getMpiErrorString (err));
485 ArrayRCP<const char> buf =
486 arcp_const_cast<
const char> (arcp_reinterpret_cast<
char> (recvBuffer));
487 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
488 return rcp_implicit_cast<CommRequest<int> > (req);
494 "ireceiveImpl: Not implemented for a serial communicator.");
505 #endif // HAVE_TEUCHOS_MPI
511 RCP<CommRequest<int> >
512 ireceiveImpl (
const ArrayRCP<T>& recvBuffer,
513 const int sourceRank,
515 const Comm<int>& comm)
517 #ifdef HAVE_TEUCHOS_MPI
518 using Teuchos::Details::MpiTypeTraits;
523 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
524 if (mpiComm == NULL) {
526 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
527 if (serialComm == NULL) {
530 return ireceiveGeneral<T> (recvBuffer, sourceRank, tag, comm);
536 "ireceiveImpl: Not implemented for a serial communicator.");
540 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
542 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
543 T* rawRecvBuf = recvBuffer.getRawPtr ();
544 const int count = as<int> (recvBuffer.size ());
545 MPI_Request rawRequest = MPI_REQUEST_NULL;
546 const int err = MPI_Irecv (rawRecvBuf, count, rawType, sourceRank, tag,
547 rawComm, &rawRequest);
549 err != MPI_SUCCESS, std::runtime_error,
550 "MPI_Irecv failed with the following error: "
551 << ::Teuchos::Details::getMpiErrorString (err));
553 ArrayRCP<const char> buf =
554 arcp_const_cast<
const char> (arcp_reinterpret_cast<
char> (recvBuffer));
555 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
556 return rcp_implicit_cast<CommRequest<int> > (req);
562 "ireceiveImpl: Not implemented for a serial communicator.");
565 #endif // HAVE_TEUCHOS_MPI
575 sendGeneral (
const Comm<int>& comm,
577 const T sendBuffer[],
581 "Teuchos::send<int, " << TypeNameTraits<T>::name () <<
">");
582 ConstValueTypeSerializationBuffer<int,T> charSendBuffer (count, sendBuffer);
583 comm.send (charSendBuffer.getBytes (),
584 charSendBuffer.getCharBuffer (),
592 sendGeneral (
const T sendBuffer[],
596 const Comm<int>& comm)
599 "Teuchos::send<int, " << TypeNameTraits<T>::name () <<
">");
600 ConstValueTypeSerializationBuffer<int,T> charSendBuffer (count, sendBuffer);
601 comm.send (charSendBuffer.getBytes (),
602 charSendBuffer.getCharBuffer (),
620 sendImpl (
const Comm<int>& comm,
622 const T sendBuffer[],
625 #ifdef HAVE_TEUCHOS_MPI
626 using Teuchos::Details::MpiTypeTraits;
631 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
632 if (mpiComm == NULL) {
634 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
635 if (serialComm == NULL) {
638 sendGeneral<T> (comm, count, sendBuffer, destRank);
644 "sendImpl: Not implemented for a serial communicator.");
648 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
650 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
651 T* rawBuf =
const_cast<T*
> (sendBuffer);
652 const int tag = mpiComm->getTag ();
653 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
657 "MPI_Send failed with the following error: "
658 << ::Teuchos::Details::getMpiErrorString (err));
664 "sendImpl: Not implemented for a serial communicator.");
665 #endif // HAVE_TEUCHOS_MPI
672 sendImpl (
const T sendBuffer[],
676 const Comm<int>& comm)
678 #ifdef HAVE_TEUCHOS_MPI
679 using Teuchos::Details::MpiTypeTraits;
684 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
685 if (mpiComm == NULL) {
687 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
688 if (serialComm == NULL) {
691 sendGeneral<T> (sendBuffer, count, destRank, tag, comm);
697 "sendImpl: Not implemented for a serial communicator.");
701 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
703 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
704 T* rawBuf =
const_cast<T*
> (sendBuffer);
705 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
709 "MPI_Send failed with the following error: "
710 << ::Teuchos::Details::getMpiErrorString (err));
716 "sendImpl: Not implemented for a serial communicator.");
717 #endif // HAVE_TEUCHOS_MPI
726 RCP<CommRequest<int> >
727 isendGeneral (
const Comm<int>& comm,
728 const ArrayRCP<const T>& sendBuffer,
732 "Teuchos::isend<int," << TypeNameTraits<T>::name () <<
">");
733 ConstValueTypeSerializationBuffer<int, T>
734 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
735 RCP<CommRequest<int> > commRequest =
736 comm.isend (charSendBuffer.getCharBufferView (), destRank);
737 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
748 RCP<CommRequest<int> >
749 isendGeneral (
const ArrayRCP<const T>& sendBuffer,
752 const Comm<int>& comm)
755 "Teuchos::isend<int," << TypeNameTraits<T>::name () <<
">");
756 ConstValueTypeSerializationBuffer<int, T>
757 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
758 RCP<CommRequest<int> > commRequest =
759 comm.isend (charSendBuffer.getCharBufferView (), destRank, tag);
760 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
767 RCP<Teuchos::CommRequest<int> >
768 isendImpl (
const ArrayRCP<const T>& sendBuffer,
771 const Comm<int>& comm)
773 #ifdef HAVE_TEUCHOS_MPI
774 using Teuchos::Details::MpiTypeTraits;
779 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
780 if (mpiComm == NULL) {
782 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
783 if (serialComm == NULL) {
786 return isendGeneral<T> (sendBuffer, destRank, tag, comm);
790 true, std::logic_error,
791 "isendImpl: Not implemented for a serial communicator.");
795 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
797 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
801 T* rawSendBuf =
const_cast<T*
> (sendBuffer.getRawPtr ());
802 const int count = as<int> (sendBuffer.size ());
803 MPI_Request rawRequest = MPI_REQUEST_NULL;
804 const int err = MPI_Isend (rawSendBuf, count, rawType, destRank, tag,
805 rawComm, &rawRequest);
809 "MPI_Isend failed with the following error: "
810 << ::Teuchos::Details::getMpiErrorString (err));
812 ArrayRCP<const char> buf = arcp_reinterpret_cast<
const char> (sendBuffer);
813 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
814 return rcp_implicit_cast<CommRequest<int> > (req);
820 "isendImpl: Not implemented for a serial communicator.");
821 #endif // HAVE_TEUCHOS_MPI
837 #ifdef HAVE_TEUCHOS_COMPLEX
841 reduceAll<int, std::complex<double> > (
const Comm<int>& comm,
842 const EReductionType reductType,
844 const std::complex<double> sendBuffer[],
845 std::complex<double> globalReducts[])
848 "Teuchos::reduceAll<int, std::complex<double> > (" << count <<
", "
851 reduceAllImpl<std::complex<double> > (comm, reductType, count, sendBuffer, globalReducts);
855 RCP<Teuchos::CommRequest<int> >
856 ireceive<int, std::complex<double> > (
const Comm<int>& comm,
857 const ArrayRCP<std::complex<double> >& recvBuffer,
858 const int sourceRank)
861 return ireceiveImpl<std::complex<double> > (comm, recvBuffer, sourceRank);
865 RCP<Teuchos::CommRequest<int> >
866 ireceive<int, std::complex<double> > (
const ArrayRCP<std::complex<double> >& recvBuffer,
867 const int sourceRank,
869 const Comm<int>& comm)
872 return ireceiveImpl<std::complex<double> > (recvBuffer, sourceRank, tag, comm);
877 send<int, std::complex<double> > (
const Comm<int>& comm,
879 const std::complex<double> sendBuffer[],
882 sendImpl<std::complex<double> > (comm, count, sendBuffer, destRank);
887 send<int, std::complex<double> > (
const std::complex<double> sendBuffer[],
891 const Comm<int>& comm)
893 sendImpl<std::complex<double> > (sendBuffer, count, destRank, tag, comm);
897 RCP<Teuchos::CommRequest<int> >
898 isend (
const ArrayRCP<
const std::complex<double> >& sendBuffer,
901 const Comm<int>& comm)
903 return isendImpl<std::complex<double> > (sendBuffer, destRank, tag, comm);
909 reduceAll<int, std::complex<float> > (
const Comm<int>& comm,
910 const EReductionType reductType,
912 const std::complex<float> sendBuffer[],
913 std::complex<float> globalReducts[])
916 "Teuchos::reduceAll<int, std::complex<float> > (" << count <<
", "
919 reduceAllImpl<std::complex<float> > (comm, reductType, count, sendBuffer, globalReducts);
923 RCP<Teuchos::CommRequest<int> >
924 ireceive<int, std::complex<float> > (
const Comm<int>& comm,
925 const ArrayRCP<std::complex<float> >& recvBuffer,
926 const int sourceRank)
929 return ireceiveImpl<std::complex<float> > (comm, recvBuffer, sourceRank);
933 RCP<Teuchos::CommRequest<int> >
934 ireceive<int, std::complex<float> > (
const ArrayRCP<std::complex<float> >& recvBuffer,
935 const int sourceRank,
937 const Comm<int>& comm)
940 return ireceiveImpl<std::complex<float> > (recvBuffer, sourceRank, tag, comm);
945 send<int, std::complex<float> > (
const Comm<int>& comm,
947 const std::complex<float> sendBuffer[],
950 return sendImpl<std::complex<float> > (comm, count, sendBuffer, destRank);
955 send<int, std::complex<float> > (
const std::complex<float> sendBuffer[],
959 const Comm<int>& comm)
961 return sendImpl<std::complex<float> > (sendBuffer, count, destRank, tag, comm);
965 RCP<Teuchos::CommRequest<int> >
966 isend (
const ArrayRCP<
const std::complex<float> >& sendBuffer,
969 const Comm<int>& comm)
971 return isendImpl<std::complex<float> > (sendBuffer, destRank, tag, comm);
973 #endif // HAVE_TEUCHOS_COMPLEX
983 const double sendBuffer[],
984 double globalReducts[])
987 "Teuchos::reduceAll<int, double> (" << count <<
", "
990 reduceAllImpl<double> (comm, reductType, count, sendBuffer, globalReducts);
994 RCP<Teuchos::CommRequest<int> >
997 const int sourceRank)
1000 return ireceiveImpl<double> (comm, recvBuffer, sourceRank);
1004 RCP<Teuchos::CommRequest<int> >
1006 const int sourceRank,
1011 return ireceiveImpl<double> (recvBuffer, sourceRank, tag, comm);
1018 const double sendBuffer[],
1021 return sendImpl<double> (comm, count, sendBuffer, destRank);
1032 return sendImpl<double> (sendBuffer, count, destRank, tag, comm);
1036 RCP<Teuchos::CommRequest<int> >
1042 return isendImpl<double> (sendBuffer, destRank, tag, comm);
1051 const float sendBuffer[],
1052 float globalReducts[])
1055 "Teuchos::reduceAll<int, float> (" << count <<
", "
1058 reduceAllImpl<float> (comm, reductType, count, sendBuffer, globalReducts);
1062 RCP<Teuchos::CommRequest<int> >
1065 const int sourceRank)
1068 return ireceiveImpl<float> (comm, recvBuffer, sourceRank);
1072 RCP<Teuchos::CommRequest<int> >
1074 const int sourceRank,
1079 return ireceiveImpl<float> (recvBuffer, sourceRank, tag, comm);
1086 const float sendBuffer[],
1089 return sendImpl<float> (comm, count, sendBuffer, destRank);
1100 return sendImpl<float> (sendBuffer, count, destRank, tag, comm);
1104 RCP<Teuchos::CommRequest<int> >
1110 return isendImpl<float> (sendBuffer, destRank, tag, comm);
1118 const int sendCount,
1119 long long recvBuf[],
1120 const int recvCount,
1124 gatherImpl<long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1130 const int sendCount,
1131 long long recvBuf[],
1132 const int recvCounts[],
1137 gathervImpl<long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1145 const long long sendBuffer[],
1146 long long globalReducts[])
1149 "Teuchos::reduceAll<int, long long> (" << count <<
", "
1152 reduceAllImpl<long long> (comm, reductType, count, sendBuffer, globalReducts);
1156 RCP<Teuchos::CommRequest<int> >
1159 const int sourceRank)
1162 return ireceiveImpl<long long> (comm, recvBuffer, sourceRank);
1166 RCP<Teuchos::CommRequest<int> >
1168 const int sourceRank,
1173 return ireceiveImpl<long long> (recvBuffer, sourceRank, tag, comm);
1180 const long long sendBuffer[],
1183 return sendImpl<long long> (comm, count, sendBuffer, destRank);
1194 return sendImpl<long long> (sendBuffer, count, destRank, tag, comm);
1198 RCP<Teuchos::CommRequest<int> >
1204 return isendImpl<long long> (sendBuffer, destRank, tag, comm);
1211 const int sendCount,
1212 unsigned long long recvBuf[],
1213 const int recvCount,
1217 gatherImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1223 const int sendCount,
1224 unsigned long long recvBuf[],
1225 const int recvCounts[],
1230 gathervImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1238 const unsigned long long sendBuffer[],
1239 unsigned long long globalReducts[])
1242 "Teuchos::reduceAll<int, unsigned long long> (" << count <<
", "
1245 reduceAllImpl<unsigned long long> (comm, reductType, count, sendBuffer, globalReducts);
1249 RCP<Teuchos::CommRequest<int> >
1252 const int sourceRank)
1255 return ireceiveImpl<unsigned long long> (comm, recvBuffer, sourceRank);
1259 RCP<Teuchos::CommRequest<int> >
1261 const int sourceRank,
1266 return ireceiveImpl<unsigned long long> (recvBuffer, sourceRank, tag, comm);
1273 const unsigned long long sendBuffer[],
1276 return sendImpl<unsigned long long> (comm, count, sendBuffer, destRank);
1287 return sendImpl<unsigned long long> (sendBuffer, count, destRank, tag, comm);
1291 RCP<Teuchos::CommRequest<int> >
1297 return isendImpl<unsigned long long> (sendBuffer, destRank, tag, comm);
1305 const int sendCount,
1307 const int recvCount,
1311 gatherImpl<long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1317 const int sendCount,
1319 const int recvCounts[],
1324 gathervImpl<long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1332 const long sendBuffer[],
1333 long globalReducts[])
1336 "Teuchos::reduceAll<int, long> (" << count <<
", "
1339 reduceAllImpl<long> (comm, reductType, count, sendBuffer, globalReducts);
1343 RCP<Teuchos::CommRequest<int> >
1346 const int sourceRank)
1349 return ireceiveImpl<long> (comm, recvBuffer, sourceRank);
1353 RCP<Teuchos::CommRequest<int> >
1355 const int sourceRank,
1360 return ireceiveImpl<long> (recvBuffer, sourceRank, tag, comm);
1367 const long sendBuffer[],
1370 return sendImpl<long> (comm, count, sendBuffer, destRank);
1381 return sendImpl<long> (sendBuffer, count, destRank, tag, comm);
1385 RCP<Teuchos::CommRequest<int> >
1391 return isendImpl<long> (sendBuffer, destRank, tag, comm);
1399 const int sendCount,
1400 unsigned long recvBuf[],
1401 const int recvCount,
1405 gatherImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1411 const int sendCount,
1412 unsigned long recvBuf[],
1413 const int recvCounts[],
1418 gathervImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1426 const unsigned long sendBuffer[],
1427 unsigned long globalReducts[])
1430 "Teuchos::reduceAll<int, unsigned long> (" << count <<
", "
1433 reduceAllImpl<unsigned long> (comm, reductType, count, sendBuffer, globalReducts);
1437 RCP<Teuchos::CommRequest<int> >
1440 const int sourceRank)
1443 return ireceiveImpl<unsigned long> (comm, recvBuffer, sourceRank);
1447 RCP<Teuchos::CommRequest<int> >
1449 const int sourceRank,
1454 return ireceiveImpl<unsigned long> (recvBuffer, sourceRank, tag, comm);
1461 const unsigned long sendBuffer[],
1464 return sendImpl<unsigned long> (comm, count, sendBuffer, destRank);
1475 return sendImpl<unsigned long> (sendBuffer, count, destRank, tag, comm);
1479 RCP<Teuchos::CommRequest<int> >
1485 return isendImpl<unsigned long> (sendBuffer, destRank, tag, comm);
1492 const int sendCount,
1494 const int recvCount,
1498 gatherImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1504 const int sendCount,
1506 const int recvCounts[],
1511 gathervImpl<int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1517 const int sendCount,
1519 const int recvCount,
1523 scatterImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1536 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1538 reduceImpl<int> (sendBuf, recvBuf, count, reductType, root, comm);
1550 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1552 reduceImpl<long> (sendBuf, recvBuf, count, reductType, root, comm);
1558 unsigned long recvBuf[],
1565 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1567 reduceImpl<unsigned long> (sendBuf, recvBuf, count, reductType, root, comm);
1573 unsigned long long recvBuf[],
1580 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1582 reduceImpl<unsigned long long> (sendBuf, recvBuf, count, reductType, root, comm);
1595 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1597 reduceImpl<double> (sendBuf, recvBuf, count, reductType, root, comm);
1604 const int sendBuffer[],
1605 int globalReducts[])
1608 "Teuchos::reduceAll<int, int> (" << count <<
", "
1611 reduceAllImpl<int> (comm, reductType, count, sendBuffer, globalReducts);
1615 RCP<Teuchos::CommRequest<int> >
1618 const int sourceRank)
1621 return ireceiveImpl<int> (comm, recvBuffer, sourceRank);
1625 RCP<Teuchos::CommRequest<int> >
1627 const int sourceRank,
1632 return ireceiveImpl<int> (recvBuffer, sourceRank, tag, comm);
1639 const int sendBuffer[],
1642 return sendImpl<int> (comm, count, sendBuffer, destRank);
1653 return sendImpl<int> (sendBuffer, count, destRank, tag, comm);
1657 RCP<Teuchos::CommRequest<int> >
1663 return isendImpl<int> (sendBuffer, destRank, tag, comm);
1670 const int sendCount,
1671 unsigned int recvBuf[],
1672 const int recvCount,
1676 gatherImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1682 const int sendCount,
1683 unsigned int recvBuf[],
1684 const int recvCounts[],
1689 gathervImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1697 const unsigned int sendBuffer[],
1698 unsigned int globalReducts[])
1701 "Teuchos::reduceAll<int, unsigned int> (" << count <<
", "
1704 reduceAllImpl<unsigned int> (comm, reductType, count, sendBuffer, globalReducts);
1708 RCP<Teuchos::CommRequest<int> >
1711 const int sourceRank)
1714 return ireceiveImpl<unsigned int> (comm, recvBuffer, sourceRank);
1718 RCP<Teuchos::CommRequest<int> >
1720 const int sourceRank,
1725 return ireceiveImpl<unsigned int> (recvBuffer, sourceRank, tag, comm);
1732 const unsigned int sendBuffer[],
1735 return sendImpl<unsigned int> (comm, count, sendBuffer, destRank);
1746 return sendImpl<unsigned int> (sendBuffer, count, destRank, tag, comm);
1750 RCP<Teuchos::CommRequest<int> >
1756 return isendImpl<unsigned int> (sendBuffer, destRank, tag, comm);
1764 const int sendCount,
1766 const int recvCount,
1770 gatherImpl<short> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1776 const int sendCount,
1778 const int recvCounts[],
1783 gathervImpl<short> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1791 const short sendBuffer[],
1792 short globalReducts[])
1795 "Teuchos::reduceAll<int, short> (" << count <<
", "
1798 reduceAllImpl<short> (comm, reductType, count, sendBuffer, globalReducts);
1802 RCP<Teuchos::CommRequest<int> >
1805 const int sourceRank)
1808 return ireceiveImpl<short> (comm, recvBuffer, sourceRank);
1812 RCP<Teuchos::CommRequest<int> >
1814 const int sourceRank,
1819 return ireceiveImpl<short> (recvBuffer, sourceRank, tag, comm);
1826 const short sendBuffer[],
1829 return sendImpl<short> (comm, count, sendBuffer, destRank);
1840 return sendImpl<short> (sendBuffer, count, destRank, tag, comm);
1844 RCP<Teuchos::CommRequest<int> >
1850 return isendImpl<short> (sendBuffer, destRank, tag, comm);
1865 reduceAll<int, char> (
const Comm<int>& comm,
1866 const EReductionType reductType,
1868 const char sendBuffer[],
1869 char globalReducts[])
1872 "Teuchos::reduceAll<int, char> (" << count <<
", "
1875 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)
TEUCHOS_DEPRECATED void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *globalReduct)
Deprecated .
void reduceAll< int, int >(const Comm< int > &comm, const EReductionType reductType, const int count, const int sendBuffer[], int globalReducts[])
void 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)
Abstract interface for distributed-memory communication.
RCP< Teuchos::CommRequest< int > > isend(const ArrayRCP< const double > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
void reduceAll< int, float >(const Comm< int > &comm, const EReductionType reductType, const int count, const float sendBuffer[], float globalReducts[])
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)