51 MPI_Op getMpiOpForEReductionType (
const enum EReductionType reductionType) {
53 switch (reductionType) {
60 "The given EReductionType value is invalid.");
67 std::string getMpiErrorString (
const int errCode) {
70 char errString [MPI_MAX_ERROR_STRING+1];
71 int errStringLen = MPI_MAX_ERROR_STRING;
72 (void) MPI_Error_string (errCode, errString, &errStringLen);
77 if (errString[errStringLen-1] !=
'\0') {
78 errString[errStringLen] =
'\0';
80 return std::string (errString);
98 static MPI_Datatype getType (
const T&);
101 #ifdef TEUCHOS_HAVE_COMPLEX
103 class MpiTypeTraits<std::complex<double> > {
105 static MPI_Datatype getType (
const T&) {
106 return MPI_C_DOUBLE_COMPLEX;
111 class MpiTypeTraits<std::complex<float> > {
113 static MPI_Datatype getType (
const T&) {
114 return MPI_C_FLOAT_COMPLEX;
117 #endif // TEUCHOS_HAVE_COMPLEX
120 class MpiTypeTraits<double> {
122 static MPI_Datatype getType (
const double&) {
128 class MpiTypeTraits<float> {
130 static MPI_Datatype getType (
const float&) {
135 #ifdef TEUCHOS_HAVE_LONG_LONG_INT
137 class MpiTypeTraits<long long> {
139 static MPI_Datatype getType (
const long long&) {
140 return MPI_LONG_LONG;
143 #endif // TEUCHOS_HAVE_LONG_LONG_INT
146 class MpiTypeTraits<long> {
148 static MPI_Datatype getType (
const long&) {
154 class MpiTypeTraits<int> {
156 static MPI_Datatype getType (
const int&) {
162 class MpiTypeTraits<short> {
164 static MPI_Datatype getType (
const short&) {
180 reduceAllImpl (
const Comm<int>& comm,
181 const EReductionType reductType,
183 const T sendBuffer[],
190 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
191 if (mpiComm == NULL) {
193 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
194 if (serialComm == NULL) {
197 std::auto_ptr<ValueTypeReductionOp<int, T> > reductOp (createOp<int, T> (reductType));
198 reduceAll (comm, *reductOp, count, sendBuffer, globalReducts);
201 std::copy (sendBuffer, sendBuffer + count, globalReducts);
204 MPI_Op rawMpiOp = getMpiOpForEReductionType (reductType);
205 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
207 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
208 const int err = MPI_Allreduce (const_cast<T*> (sendBuffer),
209 globalReducts, count, rawMpiType, rawMpiOp, rawMpiComm);
213 "MPI_Allreduce failed with the following error: "
214 << getMpiErrorString (err));
218 std::copy (sendBuffer, sendBuffer + count, globalReducts);
232 gatherImpl (
const T sendBuf[],
237 const Comm<int>& comm)
243 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
244 if (mpiComm == NULL) {
246 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
247 if (serialComm == NULL) {
250 gather<int, T> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
253 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
256 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
258 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
259 const int err = MPI_Gather (const_cast<T*> (sendBuf), sendCount, rawMpiType,
260 recvBuf, recvCount, rawMpiType,
265 "MPI_Gather failed with the following error: "
266 << getMpiErrorString (err));
270 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
284 gathervImpl (
const T sendBuf[],
287 const int recvCounts[],
290 const Comm<int>& comm)
296 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
297 if (mpiComm == NULL) {
299 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
300 if (serialComm == NULL) {
303 gatherv<int, T> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
307 recvCounts[0] > sendCount, std::invalid_argument,
308 "Teuchos::gatherv: If the input communicator contains only one "
309 "process, then you cannot receive more entries than you send. "
310 "You aim to receive " << recvCounts[0] <<
" entries, but to send "
311 << sendCount <<
" entries.");
315 std::copy (sendBuf, sendBuf + recvCounts[0], recvBuf + displs[0]);
318 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
320 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
321 const int err = MPI_Gatherv (const_cast<T*> (sendBuf),
325 const_cast<int*> (recvCounts),
326 const_cast<int*> (displs),
333 "MPI_Gatherv failed with the following error: "
334 << getMpiErrorString (err));
339 recvCounts[0] > sendCount, std::invalid_argument,
340 "Teuchos::gatherv: If the input communicator contains only one "
341 "process, then you cannot receive more entries than you send. "
342 "You aim to receive " << recvCounts[0] <<
" entries, but to send "
343 << sendCount <<
" entries.");
347 std::copy (sendBuf, sendBuf + recvCounts[0], recvBuf + displs[0]);
361 reduceAllAndScatterImpl (
const Comm<int>& comm,
362 const EReductionType reductType,
364 const T sendBuffer[],
365 const int recvCounts[],
372 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
373 if (mpiComm == NULL) {
375 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
376 if (serialComm == NULL) {
378 "Not implemented for Comm not MpiComm or SerialComm.");
385 std::copy (sendBuffer, sendBuffer + sendCount, myGlobalReducts);
388 MPI_Op rawMpiOp = getMpiOpForEReductionType (reductType);
389 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
391 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
392 const int err = MPI_Reduce_scatter (const_cast<T*> (sendBuffer),
394 const_cast<int*> (recvCounts),
401 "MPI_Reduce_scatter failed with the following error: "
402 << getMpiErrorString (err));
409 std::copy (sendBuffer, sendBuffer + sendCount, myGlobalReducts);
419 template<
typename Packet>
420 RCP<Teuchos::CommRequest<int> >
421 ireceiveGeneral(
const Comm<int>& comm,
422 const ArrayRCP<Packet> &recvBuffer,
423 const int sourceRank)
426 "Teuchos::ireceive<int, " <<
"," << TypeNameTraits<Packet>::name ()
427 <<
"> ( value type )"
429 ValueTypeSerializationBuffer<int, Packet>
430 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
431 RCP<CommRequest<int> > commRequest =
432 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank);
433 set_extra_data (recvBuffer,
"buffer", inOutArg (commRequest));
439 template<
typename Packet>
440 RCP<Teuchos::CommRequest<int> >
441 ireceiveGeneral (
const ArrayRCP<Packet> &recvBuffer,
442 const int sourceRank,
444 const Comm<int>& comm)
447 "Teuchos::ireceive<int, " <<
"," << TypeNameTraits<Packet>::name ()
448 <<
"> ( value type )"
450 ValueTypeSerializationBuffer<int, Packet>
451 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
452 RCP<CommRequest<int> > commRequest =
453 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank, tag);
454 set_extra_data (recvBuffer,
"buffer", inOutArg (commRequest));
471 RCP<CommRequest<int> >
472 ireceiveImpl (
const Comm<int>& comm,
473 const ArrayRCP<T>& recvBuffer,
474 const int sourceRank)
480 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
481 if (mpiComm == NULL) {
483 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
484 if (serialComm == NULL) {
487 return ireceiveGeneral<T> (comm, recvBuffer, sourceRank);
493 "ireceiveImpl: Not implemented for a serial communicator.");
497 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
499 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
500 T* rawRecvBuf = recvBuffer.getRawPtr ();
501 const int count = as<int> (recvBuffer.size ());
502 const int tag = mpiComm->getTag ();
503 MPI_Request rawRequest = MPI_REQUEST_NULL;
504 const int err = MPI_Irecv (rawRecvBuf, count, rawType, sourceRank, tag,
505 rawComm, &rawRequest);
507 err != MPI_SUCCESS, std::runtime_error,
508 "MPI_Irecv failed with the following error: "
509 << getMpiErrorString (err));
511 ArrayRCP<const char> buf =
512 arcp_const_cast<
const char> (arcp_reinterpret_cast<
char> (recvBuffer));
513 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
514 return rcp_implicit_cast<CommRequest<int> > (req);
520 "ireceiveImpl: Not implemented for a serial communicator.");
529 RCP<CommRequest<int> >
530 ireceiveImpl (
const ArrayRCP<T>& recvBuffer,
531 const int sourceRank,
533 const Comm<int>& comm)
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 << 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.");
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[],
645 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
646 if (mpiComm == NULL) {
648 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
649 if (serialComm == NULL) {
652 sendGeneral<T> (comm, count, sendBuffer, destRank);
658 "sendImpl: Not implemented for a serial communicator.");
662 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
664 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
665 T* rawBuf =
const_cast<T*
> (sendBuffer);
666 const int tag = mpiComm->getTag ();
667 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
671 "MPI_Send failed with the following error: "
672 << getMpiErrorString (err));
678 "sendImpl: Not implemented for a serial communicator.");
686 sendImpl (
const T sendBuffer[],
690 const Comm<int>& comm)
696 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
697 if (mpiComm == NULL) {
699 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
700 if (serialComm == NULL) {
703 sendGeneral<T> (sendBuffer, count, destRank, tag, comm);
709 "sendImpl: Not implemented for a serial communicator.");
713 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
715 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
716 T* rawBuf =
const_cast<T*
> (sendBuffer);
717 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
721 "MPI_Send failed with the following error: "
722 << getMpiErrorString (err));
728 "sendImpl: Not implemented for a serial communicator.");
738 RCP<CommRequest<int> >
739 isendGeneral (
const Comm<int>& comm,
740 const ArrayRCP<const T>& sendBuffer,
744 "Teuchos::isend<int," << TypeNameTraits<T>::name () <<
">");
745 ConstValueTypeSerializationBuffer<int, T>
746 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
747 RCP<CommRequest<int> > commRequest =
748 comm.isend (charSendBuffer.getCharBufferView (), destRank);
749 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
760 RCP<CommRequest<int> >
761 isendGeneral (
const ArrayRCP<const T>& sendBuffer,
764 const Comm<int>& comm)
767 "Teuchos::isend<int," << TypeNameTraits<T>::name () <<
">");
768 ConstValueTypeSerializationBuffer<int, T>
769 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
770 RCP<CommRequest<int> > commRequest =
771 comm.isend (charSendBuffer.getCharBufferView (), destRank, tag);
772 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
779 RCP<Teuchos::CommRequest<int> >
780 isendImpl (
const ArrayRCP<const T>& sendBuffer,
783 const Comm<int>& comm)
789 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
790 if (mpiComm == NULL) {
792 const SerialComm<int>* serialComm =
dynamic_cast<const SerialComm<int>*
> (&comm);
793 if (serialComm == NULL) {
796 return isendGeneral<T> (sendBuffer, destRank, tag, comm);
800 true, std::logic_error,
801 "isendImpl: Not implemented for a serial communicator.");
805 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
807 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
811 T* rawSendBuf =
const_cast<T*
> (sendBuffer.getRawPtr ());
812 const int count = as<int> (sendBuffer.size ());
813 MPI_Request rawRequest = MPI_REQUEST_NULL;
814 const int err = MPI_Isend (rawSendBuf, count, rawType, destRank, tag,
815 rawComm, &rawRequest);
819 "MPI_Isend failed with the following error: "
820 << getMpiErrorString (err));
822 ArrayRCP<const char> buf = arcp_reinterpret_cast<
const char> (sendBuffer);
823 RCP<Details::MpiCommRequest> req (
new Details::MpiCommRequest (rawRequest, buf));
824 return rcp_implicit_cast<CommRequest<int> > (req);
830 "isendImpl: Not implemented for a serial communicator.");
844 #ifdef TEUCHOS_HAVE_COMPLEX
848 reduceAll<int, std::complex<double> > (
const Comm<int>& comm,
849 const EReductionType reductType,
851 const std::complex<double> sendBuffer[],
852 std::complex<double> globalReducts[])
855 "Teuchos::reduceAll<int, std::complex<double> > (" << count <<
", "
858 reduceAllImpl<std::complex<double> > (comm, reductType, count, sendBuffer, globalReducts);
862 RCP<Teuchos::CommRequest<int> >
863 ireceive<int, std::complex<double> > (
const Comm<int>& comm,
864 const ArrayRCP<std::complex<double> >& recvBuffer,
865 const int sourceRank)
868 return ireceiveImpl<std::complex<double> > (comm, recvBuffer, sourceRank);
872 RCP<Teuchos::CommRequest<int> >
873 ireceive<int, std::complex<double> > (
const ArrayRCP<std::complex<double> >& recvBuffer,
874 const int sourceRank,
876 const Comm<int>& comm)
879 return ireceiveImpl<std::complex<double> > (recvBuffer, sourceRank, tag, comm);
884 send<int, std::complex<double> > (
const Comm<int>& comm,
886 const std::complex<double> sendBuffer[],
889 sendImpl<std::complex<double> > (comm, count, sendBuffer, destRank);
894 send<int, std::complex<double> > (
const std::complex<double> sendBuffer[],
898 const Comm<int>& comm)
900 sendImpl<std::complex<double> > (sendBuffer, count, destRank, tag, comm);
905 isend (
const ArrayRCP<
const std::complex<double> >& sendBuffer,
908 const Comm<int>& comm)
910 return isendImpl<std::complex<double> > (sendBuffer, destRank, tag, comm);
916 reduceAll<int, std::complex<float> > (
const Comm<int>& comm,
917 const EReductionType reductType,
919 const std::complex<float> sendBuffer[],
920 std::complex<float> globalReducts[])
923 "Teuchos::reduceAll<int, std::complex<float> > (" << count <<
", "
926 reduceAllImpl<std::complex<float> > (comm, reductType, count, sendBuffer, globalReducts);
930 RCP<Teuchos::CommRequest<int> >
931 ireceive<int, std::complex<float> > (
const Comm<int>& comm,
932 const ArrayRCP<std::complex<float> >& recvBuffer,
933 const int sourceRank)
936 return ireceiveImpl<std::complex<float> > (comm, recvBuffer, sourceRank);
940 RCP<Teuchos::CommRequest<int> >
941 ireceive<int, std::complex<float> > (
const ArrayRCP<std::complex<float> >& recvBuffer,
942 const int sourceRank,
944 const Comm<int>& comm)
947 return ireceiveImpl<std::complex<float> > (recvBuffer, sourceRank, tag, comm);
952 send<int, std::complex<float> > (
const Comm<int>& comm,
954 const std::complex<float> sendBuffer[],
957 return sendImpl<std::complex<float> > (comm, count, sendBuffer, destRank);
962 send<int, std::complex<float> > (
const std::complex<float> sendBuffer[],
966 const Comm<int>& comm)
968 return sendImpl<std::complex<float> > (sendBuffer, count, destRank, tag, comm);
973 isend (
const ArrayRCP<
const std::complex<float> >& sendBuffer,
976 const Comm<int>& comm)
978 return isendImpl<std::complex<float> > (sendBuffer, destRank, tag, comm);
980 #endif // TEUCHOS_HAVE_COMPLEX
989 const double sendBuffer[],
990 double globalReducts[])
993 "Teuchos::reduceAll<int, double> (" << count <<
", "
996 reduceAllImpl<double> (comm, reductType, count, sendBuffer, globalReducts);
1000 RCP<Teuchos::CommRequest<int> >
1003 const int sourceRank)
1006 return ireceiveImpl<double> (comm, recvBuffer, sourceRank);
1010 RCP<Teuchos::CommRequest<int> >
1012 const int sourceRank,
1017 return ireceiveImpl<double> (recvBuffer, sourceRank, tag, comm);
1024 const double sendBuffer[],
1027 return sendImpl<double> (comm, count, sendBuffer, destRank);
1038 return sendImpl<double> (sendBuffer, count, destRank, tag, comm);
1048 return isendImpl<double> (sendBuffer, destRank, tag, comm);
1057 const float sendBuffer[],
1058 float globalReducts[])
1061 "Teuchos::reduceAll<int, float> (" << count <<
", "
1064 reduceAllImpl<float> (comm, reductType, count, sendBuffer, globalReducts);
1068 RCP<Teuchos::CommRequest<int> >
1071 const int sourceRank)
1074 return ireceiveImpl<float> (comm, recvBuffer, sourceRank);
1078 RCP<Teuchos::CommRequest<int> >
1080 const int sourceRank,
1085 return ireceiveImpl<float> (recvBuffer, sourceRank, tag, comm);
1092 const float sendBuffer[],
1095 return sendImpl<float> (comm, count, sendBuffer, destRank);
1106 return sendImpl<float> (sendBuffer, count, destRank, tag, comm);
1116 return isendImpl<float> (sendBuffer, destRank, tag, comm);
1120 #ifdef TEUCHOS_HAVE_LONG_LONG_INT
1124 gather<int, long long> (
const long long sendBuf[],
1125 const int sendCount,
1126 long long recvBuf[],
1127 const int recvCount,
1129 const Comm<int>& comm)
1131 gatherImpl<long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1136 gatherv<int, long long> (
const long long sendBuf[],
1137 const int sendCount,
1138 long long recvBuf[],
1139 const int recvCounts[],
1142 const Comm<int>& comm)
1144 gathervImpl<long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1149 reduceAll<int, long long> (
const Comm<int>& comm,
1150 const EReductionType reductType,
1152 const long long sendBuffer[],
1153 long long globalReducts[])
1156 "Teuchos::reduceAll<int, long long> (" << count <<
", "
1159 reduceAllImpl<long long> (comm, reductType, count, sendBuffer, globalReducts);
1163 RCP<Teuchos::CommRequest<int> >
1164 ireceive<int, long long> (
const Comm<int>& comm,
1165 const ArrayRCP<long long>& recvBuffer,
1166 const int sourceRank)
1169 return ireceiveImpl<long long> (comm, recvBuffer, sourceRank);
1173 RCP<Teuchos::CommRequest<int> >
1174 ireceive<int, long long> (
const ArrayRCP<long long>& recvBuffer,
1175 const int sourceRank,
1177 const Comm<int>& comm)
1180 return ireceiveImpl<long long> (recvBuffer, sourceRank, tag, comm);
1185 send<int, long long> (
const Comm<int>& comm,
1187 const long long sendBuffer[],
1190 return sendImpl<long long> (comm, count, sendBuffer, destRank);
1195 send<int, long long> (
const long long sendBuffer[],
1199 const Comm<int>& comm)
1201 return sendImpl<long long> (sendBuffer, count, destRank, tag, comm);
1206 isend (
const ArrayRCP<const long long>& sendBuffer,
1209 const Comm<int>& comm)
1211 return isendImpl<long long> (sendBuffer, destRank, tag, comm);
1213 #endif // TEUCHOS_HAVE_LONG_LONG_INT
1220 const int sendCount,
1222 const int recvCount,
1226 gatherImpl<long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1232 const int sendCount,
1234 const int recvCounts[],
1239 gathervImpl<long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1247 const long sendBuffer[],
1248 long globalReducts[])
1251 "Teuchos::reduceAll<int, long> (" << count <<
", "
1254 reduceAllImpl<long> (comm, reductType, count, sendBuffer, globalReducts);
1258 RCP<Teuchos::CommRequest<int> >
1261 const int sourceRank)
1264 return ireceiveImpl<long> (comm, recvBuffer, sourceRank);
1268 RCP<Teuchos::CommRequest<int> >
1270 const int sourceRank,
1275 return ireceiveImpl<long> (recvBuffer, sourceRank, tag, comm);
1282 const long sendBuffer[],
1285 return sendImpl<long> (comm, count, sendBuffer, destRank);
1296 return sendImpl<long> (sendBuffer, count, destRank, tag, comm);
1306 return isendImpl<long> (sendBuffer, destRank, tag, comm);
1313 const int sendCount,
1315 const int recvCount,
1319 gatherImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1325 const int sendCount,
1327 const int recvCounts[],
1332 gathervImpl<int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1340 const int sendBuffer[],
1341 int globalReducts[])
1344 "Teuchos::reduceAll<int, int> (" << count <<
", "
1347 reduceAllImpl<int> (comm, reductType, count, sendBuffer, globalReducts);
1354 const int sendCount,
1355 const int sendBuffer[],
1356 const int recvCounts[],
1357 int myGlobalReducts[])
1359 reduceAllAndScatterImpl<int> (comm, reductType, sendCount, sendBuffer,
1360 recvCounts, myGlobalReducts);
1364 RCP<Teuchos::CommRequest<int> >
1367 const int sourceRank)
1370 return ireceiveImpl<int> (comm, recvBuffer, sourceRank);
1374 RCP<Teuchos::CommRequest<int> >
1376 const int sourceRank,
1381 return ireceiveImpl<int> (recvBuffer, sourceRank, tag, comm);
1388 const int sendBuffer[],
1391 return sendImpl<int> (comm, count, sendBuffer, destRank);
1402 return sendImpl<int> (sendBuffer, count, destRank, tag, comm);
1412 return isendImpl<int> (sendBuffer, destRank, tag, comm);
1419 const int sendCount,
1421 const int recvCount,
1425 gatherImpl<short> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1431 const int sendCount,
1433 const int recvCounts[],
1438 gathervImpl<short> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1446 const short sendBuffer[],
1447 short globalReducts[])
1450 "Teuchos::reduceAll<int, short> (" << count <<
", "
1453 reduceAllImpl<short> (comm, reductType, count, sendBuffer, globalReducts);
1457 RCP<Teuchos::CommRequest<int> >
1460 const int sourceRank)
1463 return ireceiveImpl<short> (comm, recvBuffer, sourceRank);
1467 RCP<Teuchos::CommRequest<int> >
1469 const int sourceRank,
1474 return ireceiveImpl<short> (recvBuffer, sourceRank, tag, comm);
1481 const short sendBuffer[],
1484 return sendImpl<short> (comm, count, sendBuffer, destRank);
1495 return sendImpl<short> (sendBuffer, count, destRank, tag, comm);
1505 return isendImpl<short> (sendBuffer, destRank, tag, comm);
1520 reduceAll<int, char> (
const Comm<int>& comm,
1521 const EReductionType reductType,
1523 const char sendBuffer[],
1524 char globalReducts[])
1527 "Teuchos::reduceAll<int, char> (" << count <<
", "
1530 reduceAllImpl<char> (comm, reductType, count, sendBuffer, globalReducts);
TEUCHOSCOMM_LIB_DLL_EXPORT RCP< Teuchos::CommRequest< int > > isend(const ArrayRCP< const double > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
EReductionType
Enumeration for selecting from a set of pre-defined reduction operations.
RCP< Teuchos::CommRequest< int > > ireceive< int, float >(const Comm< int > &comm, const ArrayRCP< float > &recvBuffer, const int sourceRank)
void gatherv< int, short >(const short sendBuf[], const int sendCount, short recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
void reduceAll< int, long >(const Comm< int > &comm, const EReductionType reductType, const int count, const long sendBuffer[], long globalReducts[])
RCP< Teuchos::CommRequest< int > > ireceive< int, double >(const Comm< int > &comm, const ArrayRCP< double > &recvBuffer, const int sourceRank)
RCP< Teuchos::CommRequest< int > > ireceive< int, short >(const Comm< int > &comm, const ArrayRCP< short > &recvBuffer, const int sourceRank)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
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)
TEUCHOSCOMM_LIB_DLL_EXPORT void send< int, short >(const Comm< int > &comm, const int count, const short sendBuffer[], const int destRank)
void gather< int, long >(const long sendBuf[], const int sendCount, long recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void reduceAllAndScatter< int, int >(const Comm< int > &comm, const EReductionType reductType, const int sendCount, const int sendBuffer[], const int recvCounts[], int myGlobalReducts[])
TEUCHOSCOMM_LIB_DLL_EXPORT void send< int, long >(const Comm< int > &comm, const int count, const long sendBuffer[], const int destRank)
void gather< int, int >(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
#define TEUCHOS_COMM_TIME_MONITOR(FUNCNAME)
TEUCHOSCOMM_LIB_DLL_EXPORT void send< int, int >(const Comm< int > &comm, const int count, const int sendBuffer[], const int destRank)
void reduceAll< int, short >(const Comm< int > &comm, const EReductionType reductType, const int count, const short sendBuffer[], short globalReducts[])
void reduceAll< int, double >(const Comm< int > &comm, const EReductionType reductType, const int count, const double sendBuffer[], double globalReducts[])
std::string toString(const HashSet< Key > &h)
void gatherv< int, long >(const long sendBuf[], const int sendCount, long recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
TEUCHOS_DEPRECATED void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *globalReduct)
Deprecated .
void reduceAll< int, int >(const Comm< int > &comm, const EReductionType reductType, const int count, const int sendBuffer[], int globalReducts[])
TEUCHOSCOMM_LIB_DLL_EXPORT void send< int, double >(const Comm< int > &comm, const int count, const double sendBuffer[], const int destRank)
RCP< Teuchos::CommRequest< int > > ireceive< int, int >(const Comm< int > &comm, const ArrayRCP< int > &recvBuffer, const int sourceRank)
TEUCHOSCOMM_LIB_DLL_EXPORT void send< int, float >(const Comm< int > &comm, const int count, const float sendBuffer[], const int destRank)
Abstract interface for distributed-memory communication.
void reduceAll< int, float >(const Comm< int > &comm, const EReductionType reductType, const int count, const float sendBuffer[], float globalReducts[])
#define TEUCHOSCOMM_LIB_DLL_EXPORT
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)
Reference-counted smart pointer for managing arrays.