42 #include "Teuchos_CommHelpers.hpp" 44 # include "Teuchos_Details_MpiCommRequest.hpp" 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)
425 TEUCHOS_COMM_TIME_MONITOR(
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)
446 TEUCHOS_COMM_TIME_MONITOR(
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[],
596 TEUCHOS_COMM_TIME_MONITOR(
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)
614 TEUCHOS_COMM_TIME_MONITOR(
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,
743 TEUCHOS_COMM_TIME_MONITOR(
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)
766 TEUCHOS_COMM_TIME_MONITOR(
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[])
854 TEUCHOS_COMM_TIME_MONITOR(
855 "Teuchos::reduceAll<int, std::complex<double> > (" << count <<
", " 856 << toString (reductType) <<
")" 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)
867 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, std::complex<double> >");
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)
878 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, std::complex<double> >");
879 return ireceiveImpl<std::complex<double> > (recvBuffer, sourceRank, tag, comm);
883 TEUCHOSCOMM_LIB_DLL_EXPORT
void 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);
893 TEUCHOSCOMM_LIB_DLL_EXPORT
void 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);
904 TEUCHOSCOMM_LIB_DLL_EXPORT RCP<Teuchos::CommRequest<int> >
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[])
922 TEUCHOS_COMM_TIME_MONITOR(
923 "Teuchos::reduceAll<int, std::complex<float> > (" << count <<
", " 924 << toString (reductType) <<
")" 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)
935 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, std::complex<float> >");
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)
946 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, std::complex<float> >");
947 return ireceiveImpl<std::complex<float> > (recvBuffer, sourceRank, tag, comm);
951 TEUCHOSCOMM_LIB_DLL_EXPORT
void 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);
961 TEUCHOSCOMM_LIB_DLL_EXPORT
void 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);
972 TEUCHOSCOMM_LIB_DLL_EXPORT RCP<Teuchos::CommRequest<int> >
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 986 reduceAll<int, double> (
const Comm<int>& comm,
987 const EReductionType reductType,
989 const double sendBuffer[],
990 double globalReducts[])
992 TEUCHOS_COMM_TIME_MONITOR(
993 "Teuchos::reduceAll<int, double> (" << count <<
", " 994 << toString (reductType) <<
")" 996 reduceAllImpl<double> (comm, reductType, count, sendBuffer, globalReducts);
1000 RCP<Teuchos::CommRequest<int> >
1001 ireceive<int, double> (
const Comm<int>& comm,
1002 const ArrayRCP<double>& recvBuffer,
1003 const int sourceRank)
1005 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, double>");
1006 return ireceiveImpl<double> (comm, recvBuffer, sourceRank);
1010 RCP<Teuchos::CommRequest<int> >
1011 ireceive<int, double> (
const ArrayRCP<double>& recvBuffer,
1012 const int sourceRank,
1014 const Comm<int>& comm)
1016 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, double>");
1017 return ireceiveImpl<double> (recvBuffer, sourceRank, tag, comm);
1021 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1022 send<int, double> (
const Comm<int>& comm,
1024 const double sendBuffer[],
1027 return sendImpl<double> (comm, count, sendBuffer, destRank);
1031 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1032 send<int, double> (
const double sendBuffer[],
1036 const Comm<int>& comm)
1038 return sendImpl<double> (sendBuffer, count, destRank, tag, comm);
1042 TEUCHOSCOMM_LIB_DLL_EXPORT RCP<Teuchos::CommRequest<int> >
1043 isend (
const ArrayRCP<const double>& sendBuffer,
1046 const Comm<int>& comm)
1048 return isendImpl<double> (sendBuffer, destRank, tag, comm);
1054 reduceAll<int, float> (
const Comm<int>& comm,
1055 const EReductionType reductType,
1057 const float sendBuffer[],
1058 float globalReducts[])
1060 TEUCHOS_COMM_TIME_MONITOR(
1061 "Teuchos::reduceAll<int, float> (" << count <<
", " 1062 << toString (reductType) <<
")" 1064 reduceAllImpl<float> (comm, reductType, count, sendBuffer, globalReducts);
1068 RCP<Teuchos::CommRequest<int> >
1069 ireceive<int, float> (
const Comm<int>& comm,
1070 const ArrayRCP<float>& recvBuffer,
1071 const int sourceRank)
1073 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, float>");
1074 return ireceiveImpl<float> (comm, recvBuffer, sourceRank);
1078 RCP<Teuchos::CommRequest<int> >
1079 ireceive<int, float> (
const ArrayRCP<float>& recvBuffer,
1080 const int sourceRank,
1082 const Comm<int>& comm)
1084 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, float>");
1085 return ireceiveImpl<float> (recvBuffer, sourceRank, tag, comm);
1089 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1090 send<int, float> (
const Comm<int>& comm,
1092 const float sendBuffer[],
1095 return sendImpl<float> (comm, count, sendBuffer, destRank);
1099 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1100 send<int, float> (
const float sendBuffer[],
1104 const Comm<int>& comm)
1106 return sendImpl<float> (sendBuffer, count, destRank, tag, comm);
1110 TEUCHOSCOMM_LIB_DLL_EXPORT RCP<Teuchos::CommRequest<int> >
1111 isend (
const ArrayRCP<const float>& sendBuffer,
1114 const Comm<int>& 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[])
1155 TEUCHOS_COMM_TIME_MONITOR(
1156 "Teuchos::reduceAll<int, long long> (" << count <<
", " 1157 << toString (reductType) <<
")" 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)
1168 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, long long>");
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)
1179 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, long long>");
1180 return ireceiveImpl<long long> (recvBuffer, sourceRank, tag, comm);
1184 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1185 send<int, long long> (
const Comm<int>& comm,
1187 const long long sendBuffer[],
1190 return sendImpl<long long> (comm, count, sendBuffer, destRank);
1194 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1195 send<int, long long> (
const long long sendBuffer[],
1199 const Comm<int>& comm)
1201 return sendImpl<long long> (sendBuffer, count, destRank, tag, comm);
1205 TEUCHOSCOMM_LIB_DLL_EXPORT RCP<Teuchos::CommRequest<int> >
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 1219 gather<int, long> (
const long sendBuf[],
1220 const int sendCount,
1222 const int recvCount,
1224 const Comm<int>& comm)
1226 gatherImpl<long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1231 gatherv<int, long> (
const long sendBuf[],
1232 const int sendCount,
1234 const int recvCounts[],
1237 const Comm<int>& comm)
1239 gathervImpl<long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1244 reduceAll<int, long> (
const Comm<int>& comm,
1245 const EReductionType reductType,
1247 const long sendBuffer[],
1248 long globalReducts[])
1250 TEUCHOS_COMM_TIME_MONITOR(
1251 "Teuchos::reduceAll<int, long> (" << count <<
", " 1252 << toString (reductType) <<
")" 1254 reduceAllImpl<long> (comm, reductType, count, sendBuffer, globalReducts);
1258 RCP<Teuchos::CommRequest<int> >
1259 ireceive<int, long> (
const Comm<int>& comm,
1260 const ArrayRCP<long>& recvBuffer,
1261 const int sourceRank)
1263 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, long>");
1264 return ireceiveImpl<long> (comm, recvBuffer, sourceRank);
1268 RCP<Teuchos::CommRequest<int> >
1269 ireceive<int, long> (
const ArrayRCP<long>& recvBuffer,
1270 const int sourceRank,
1272 const Comm<int>& comm)
1274 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, long>");
1275 return ireceiveImpl<long> (recvBuffer, sourceRank, tag, comm);
1279 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1280 send<int, long> (
const Comm<int>& comm,
1282 const long sendBuffer[],
1285 return sendImpl<long> (comm, count, sendBuffer, destRank);
1289 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1290 send<int, long> (
const long sendBuffer[],
1294 const Comm<int>& comm)
1296 return sendImpl<long> (sendBuffer, count, destRank, tag, comm);
1300 TEUCHOSCOMM_LIB_DLL_EXPORT RCP<Teuchos::CommRequest<int> >
1301 isend (
const ArrayRCP<const long>& sendBuffer,
1304 const Comm<int>& comm)
1306 return isendImpl<long> (sendBuffer, destRank, tag, comm);
1312 gather<int, int> (
const int sendBuf[],
1313 const int sendCount,
1315 const int recvCount,
1317 const Comm<int>& comm)
1319 gatherImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1324 gatherv<int, int> (
const int sendBuf[],
1325 const int sendCount,
1327 const int recvCounts[],
1330 const Comm<int>& comm)
1332 gathervImpl<int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1337 reduceAll<int, int> (
const Comm<int>& comm,
1338 const EReductionType reductType,
1340 const int sendBuffer[],
1341 int globalReducts[])
1343 TEUCHOS_COMM_TIME_MONITOR(
1344 "Teuchos::reduceAll<int, int> (" << count <<
", " 1345 << toString (reductType) <<
")" 1347 reduceAllImpl<int> (comm, reductType, count, sendBuffer, globalReducts);
1352 reduceAllAndScatter<int, int> (
const Comm<int>& comm,
1353 const EReductionType reductType,
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> >
1365 ireceive<int, int> (
const Comm<int>& comm,
1366 const ArrayRCP<int>& recvBuffer,
1367 const int sourceRank)
1369 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, int>");
1370 return ireceiveImpl<int> (comm, recvBuffer, sourceRank);
1374 RCP<Teuchos::CommRequest<int> >
1375 ireceive<int, int> (
const ArrayRCP<int>& recvBuffer,
1376 const int sourceRank,
1378 const Comm<int>& comm)
1380 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, int>");
1381 return ireceiveImpl<int> (recvBuffer, sourceRank, tag, comm);
1385 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1386 send<int, int> (
const Comm<int>& comm,
1388 const int sendBuffer[],
1391 return sendImpl<int> (comm, count, sendBuffer, destRank);
1395 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1396 send<int, int> (
const int sendBuffer[],
1400 const Comm<int>& comm)
1402 return sendImpl<int> (sendBuffer, count, destRank, tag, comm);
1406 TEUCHOSCOMM_LIB_DLL_EXPORT RCP<Teuchos::CommRequest<int> >
1407 isend (
const ArrayRCP<const int>& sendBuffer,
1410 const Comm<int>& comm)
1412 return isendImpl<int> (sendBuffer, destRank, tag, comm);
1418 gather<int, short> (
const short sendBuf[],
1419 const int sendCount,
1421 const int recvCount,
1423 const Comm<int>& comm)
1425 gatherImpl<short> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1430 gatherv<int, short> (
const short sendBuf[],
1431 const int sendCount,
1433 const int recvCounts[],
1436 const Comm<int>& comm)
1438 gathervImpl<short> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1443 reduceAll<int, short> (
const Comm<int>& comm,
1444 const EReductionType reductType,
1446 const short sendBuffer[],
1447 short globalReducts[])
1449 TEUCHOS_COMM_TIME_MONITOR(
1450 "Teuchos::reduceAll<int, short> (" << count <<
", " 1451 << toString (reductType) <<
")" 1453 reduceAllImpl<short> (comm, reductType, count, sendBuffer, globalReducts);
1457 RCP<Teuchos::CommRequest<int> >
1458 ireceive<int, short> (
const Comm<int>& comm,
1459 const ArrayRCP<short>& recvBuffer,
1460 const int sourceRank)
1462 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, short>");
1463 return ireceiveImpl<short> (comm, recvBuffer, sourceRank);
1467 RCP<Teuchos::CommRequest<int> >
1468 ireceive<int, short> (
const ArrayRCP<short>& recvBuffer,
1469 const int sourceRank,
1471 const Comm<int>& comm)
1473 TEUCHOS_COMM_TIME_MONITOR(
"ireceive<int, short>");
1474 return ireceiveImpl<short> (recvBuffer, sourceRank, tag, comm);
1478 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1479 send<int, short> (
const Comm<int>& comm,
1481 const short sendBuffer[],
1484 return sendImpl<short> (comm, count, sendBuffer, destRank);
1488 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1489 send<int, short> (
const short sendBuffer[],
1493 const Comm<int>& comm)
1495 return sendImpl<short> (sendBuffer, count, destRank, tag, comm);
1499 TEUCHOSCOMM_LIB_DLL_EXPORT RCP<Teuchos::CommRequest<int> >
1500 isend (
const ArrayRCP<const short>& sendBuffer,
1503 const Comm<int>& 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[])
1526 TEUCHOS_COMM_TIME_MONITOR(
1527 "Teuchos::reduceAll<int, char> (" << count <<
", " 1528 << toString (reductType) <<
")" 1530 reduceAllImpl<char> (comm, reductType, count, sendBuffer, globalReducts);
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
TEUCHOS_DEPRECATED void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *globalReduct)
Deprecated .
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos, as well as a number of utility routines.
static std::string name()