Teuchos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Teuchos_CommHelpers.hpp
Go to the documentation of this file.
1// @HEADER
2// ***********************************************************************
3//
4// Teuchos: Common Tools Package
5// Copyright (2004) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38//
39// ***********************************************************************
40// @HEADER
41
42#ifndef TEUCHOS_COMM_HELPERS_HPP
43#define TEUCHOS_COMM_HELPERS_HPP
44
45#include "Teuchos_Comm.hpp"
52#include "Teuchos_Array.hpp"
54#include "Teuchos_Workspace.hpp"
55#include "Teuchos_as.hpp"
56
57#ifdef HAVE_TEUCHOS_MPI
59#endif // HAVE_TEUCHOS_MPI
62
63namespace Teuchos {
64
65//
66// Teuchos::Comm Helper Functions
67//
68
69#ifdef HAVE_TEUCHOS_MPI
70namespace Details {
71
78std::string getMpiErrorString (const int errCode);
79
80} // namespace Details
81#endif // HAVE_TEUCHOS_MPI
82
87template<typename Ordinal>
88int rank(const Comm<Ordinal>& comm);
89
94template<typename Ordinal>
95int size(const Comm<Ordinal>& comm);
96
101template<typename Ordinal>
102void barrier(const Comm<Ordinal>& comm);
103
108template<typename Ordinal, typename Packet>
110 const Comm<Ordinal>& comm,
111 const int rootRank,
112 const Ordinal count, Packet buffer[]
113 );
114
119template<typename Ordinal, typename Packet>
121 const Comm<Ordinal>& comm,
122 const int rootRank,
123 const ArrayView<Packet> &buffer
124 );
125
130template<typename Ordinal, typename Packet>
132 const Comm<Ordinal>& comm,
133 const int rootRank, Packet *object
134 );
135
140template<typename Ordinal, typename Packet>
142 const Comm<Ordinal>& comm,
143 const int rootRank, const Ptr<Packet> &object
144 );
145
150template<typename Ordinal, typename Packet>
152 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
153 const int rootRank, const Ordinal count, Packet*const buffer[]
154 );
155
160template<typename Ordinal, typename Packet>
162 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
163 const int rootRank, const ArrayView<const Ptr<Packet> > &buffer
164 );
165
171template<typename Ordinal, typename Packet, typename Serializer>
173 const Comm<Ordinal>& comm,
174 const Serializer& serializer,
175 const int rootRank,
176 const Ordinal count, Packet buffer[]
177 );
178
183template<typename Ordinal, typename Packet>
184void
185gather (const Packet sendBuf[],
186 const Ordinal sendCount,
187 Packet recvBuf[],
188 const Ordinal recvCount,
189 const int root,
190 const Comm<Ordinal>& comm);
191
196template<typename Ordinal, typename Packet>
197void
198gatherv (const Packet sendBuf[],
199 const Ordinal sendCount,
200 Packet recvBuf[],
201 const Ordinal recvCounts[],
202 const Ordinal displs[],
203 const int root,
204 const Comm<Ordinal>& comm);
205
211template<typename Ordinal, typename Packet>
213 const Comm<Ordinal>& comm,
214 const Ordinal sendCount, const Packet sendBuffer[],
215 const Ordinal recvCount, Packet recvBuffer[]
216 );
217
223template<typename Ordinal, typename Packet>
225 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
226 const Ordinal sendCount, const Packet*const sendBuffer[],
227 const Ordinal recvCount, Packet*const recvBuffer[]
228 );
229
235template<typename Ordinal, typename Packet, typename Serializer>
237 const Comm<Ordinal>& comm,
238 const Serializer& serializer,
239 const Ordinal sendCount, const Packet sendBuffer[],
240 const Ordinal recvCount, Packet recvBuffer[]
241 );
242
269template<typename Ordinal, typename Packet>
270void
271scatter (const Packet sendBuf[],
272 const Ordinal sendCount,
273 Packet recvBuf[],
274 const Ordinal recvCount,
275 const Ordinal root,
276 const Comm<Ordinal>& comm)
277{
278 // See Bug 6375; Tpetra does not actually need any specializations
279 // other than Ordinal = int and Packet = int. We may add them later
280 // if there is interest.
282 (true, std::logic_error, "Teuchos::scatter<" <<
284 << ">: Generic version is not yet implemented. This function currently "
285 "only has an implementtion for Ordinal = int and Packet = int. "
286 "See Bug 6375 and Bug 6336.");
287}
288
316template<typename Ordinal, typename Packet>
317void
318reduce (const Packet sendBuf[],
319 Packet recvBuf[],
320 const Ordinal count,
321 const EReductionType reductType,
322 const Ordinal root,
323 const Comm<Ordinal>& comm);
324
347template<typename Ordinal, typename Packet>
349 const Comm<Ordinal>& comm, const ValueTypeReductionOp<Ordinal,Packet> &reductOp,
350 const Ordinal count, const Packet sendBuffer[], Packet globalReducts[]
351 );
352
358template<typename Ordinal, typename Packet>
360 const Comm<Ordinal>& comm, const EReductionType reductType,
361 const Ordinal count, const Packet sendBuffer[], Packet globalReducts[]
362 );
363
369template<typename Ordinal, typename Packet>
371 const Comm<Ordinal>& comm, const EReductionType reductType,
372 const Packet &send, const Ptr<Packet> &globalReduct
373 );
374
380template<typename Ordinal, typename Packet>
382 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
384 const Ordinal count, const Packet*const sendBuffer[], Packet*const globalReducts[]
385 );
386
392template<typename Ordinal, typename Packet, typename Serializer>
394 const Comm<Ordinal>& comm,
395 const Serializer& serializer,
397 const Ordinal count, const Packet sendBuffer[], Packet globalReducts[]
398 );
399
405template<typename Ordinal, typename Packet, typename Serializer>
407 const Comm<Ordinal>& comm,
408 const Serializer& serializer,
409 const EReductionType reductType,
410 const Ordinal count, const Packet sendBuffer[], Packet globalReducts[]
411 );
412
418template<typename Ordinal, typename Packet>
419void scan(
420 const Comm<Ordinal>& comm, const ValueTypeReductionOp<Ordinal,Packet> &reductOp,
421 const Ordinal count, const Packet sendBuffer[], Packet scanReducts[]
422 );
423
429template<typename Ordinal, typename Packet>
430void scan(
431 const Comm<Ordinal>& comm, const EReductionType reductType,
432 const Ordinal count, const Packet sendBuffer[], Packet scanReducts[]
433 );
434
440template<typename Ordinal, typename Packet>
441void scan(
442 const Comm<Ordinal>& comm, const EReductionType reductType,
443 const Packet &send, const Ptr<Packet> &scanReduct
444 );
445
451template<typename Ordinal, typename Packet>
452void scan(
453 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
455 const Ordinal count, const Packet*const sendBuffer[], Packet*const scanReducts[]
456 );
457
463template<typename Ordinal, typename Packet, typename Serializer>
464void scan(
465 const Comm<Ordinal>& comm,
466 const Serializer& serializer,
468 const Ordinal count, const Packet sendBuffer[], Packet scanReducts[]
469 );
470
476template<typename Ordinal, typename Packet, typename Serializer>
477void scan(
478 const Comm<Ordinal>& comm,
479 const Serializer& serializer,
480 const EReductionType reductType,
481 const Ordinal count, const Packet sendBuffer[], Packet scanReducts[]
482 );
483
488template<typename Ordinal, typename Packet>
489void send(
490 const Comm<Ordinal>& comm,
491 const Ordinal count, const Packet sendBuffer[], const int destRank
492 );
493
495template<typename Ordinal, typename Packet>
496void
497send (const Packet sendBuffer[],
498 const Ordinal count,
499 const int destRank,
500 const int tag,
501 const Comm<Ordinal>& comm);
502
507template<typename Ordinal, typename Packet>
508void ssend(
509 const Comm<Ordinal>& comm,
510 const Ordinal count, const Packet sendBuffer[], const int destRank
511 );
512
514template<typename Ordinal, typename Packet>
515void
516ssend (const Packet sendBuffer[],
517 const Ordinal count,
518 const int destRank,
519 const int tag,
520 const Comm<Ordinal>& comm);
521
526template<typename Ordinal, typename Packet>
527void send(
528 const Comm<Ordinal>& comm,
529 const Packet &send, const int destRank
530 );
531
536template<typename Ordinal, typename Packet>
537void ssend(
538 const Comm<Ordinal>& comm,
539 const Packet &send, const int destRank
540 );
541
548template<typename Ordinal, typename Packet>
549void send(
550 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
551 const Ordinal count, const Packet*const sendBuffer[], const int destRank
552 );
553
559template<typename Ordinal, typename Packet, typename Serializer>
560void send(
561 const Comm<Ordinal>& comm,
562 const Serializer& serializer,
563 const Ordinal count, const Packet sendBuffer[], const int destRank
564 );
565
570template<typename Ordinal, typename Packet>
572 const Comm<Ordinal>& comm,
573 const int sourceRank, const Ordinal count, Packet recvBuffer[]
574 );
575
580template<typename Ordinal, typename Packet>
582 const Comm<Ordinal>& comm,
583 const int sourceRank, Packet *recv
584 );
585
590template<typename Ordinal, typename Packet>
592 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
593 const int sourceRank, const Ordinal count, Packet*const recvBuffer[]
594 );
595
601template<typename Ordinal, typename Packet, typename Serializer>
603 const Comm<Ordinal>& comm,
604 const Serializer& serializer,
605 const int sourceRank, const Ordinal count, Packet recvBuffer[]
606 );
607
613template<typename Ordinal, typename Packet>
615 const Comm<Ordinal>& comm,
616 const ArrayView<const Packet> &sendBuffer,
617 const int destRank
618 );
619
621template<typename Ordinal, typename Packet>
622void
623readySend (const Packet sendBuffer[],
624 const Ordinal count,
625 const int destRank,
626 const int tag,
627 const Comm<Ordinal>& comm);
628
633template<typename Ordinal, typename Packet>
635 const Comm<Ordinal>& comm,
636 const Packet &send,
637 const int destRank
638 );
639
645template<typename Ordinal, typename Packet, typename Serializer>
647 const Comm<Ordinal>& comm,
648 const Serializer& serializer,
649 const ArrayView<const Packet> &sendBuffer,
650 const int destRank
651 );
652
657template<typename Ordinal, typename Packet>
659 const Comm<Ordinal>& comm,
660 const ArrayRCP<const Packet> &sendBuffer,
661 const int destRank
662 );
663
665template<typename Ordinal, typename Packet>
667isend (const ArrayRCP<const Packet>& sendBuffer,
668 const int destRank,
669 const int tag,
670 const Comm<Ordinal>& comm);
671
676template<typename Ordinal, typename Packet>
678 const Comm<Ordinal>& comm,
679 const RCP<const Packet> &send,
680 const int destRank
681 );
682
688template<typename Ordinal, typename Packet, typename Serializer>
690 const Comm<Ordinal>& comm,
691 const Serializer& serializer,
692 const ArrayRCP<const Packet> &sendBuffer,
693 const int destRank
694 );
695
696
697// 2008/07/29: rabartl: ToDo: Add reference semantics version of isend!
698
699
709template<typename Ordinal, typename Packet>
711 const Comm<Ordinal>& comm,
712 const ArrayRCP<Packet> &recvBuffer,
713 const int sourceRank
714 );
715
717template<typename Ordinal, typename Packet>
719ireceive (const ArrayRCP<Packet> &recvBuffer,
720 const int sourceRank,
721 const int tag,
722 const Comm<Ordinal>& comm);
723
735template<typename Ordinal, typename Packet>
737 const Comm<Ordinal>& comm,
738 const RCP<Packet> &recv,
739 const int sourceRank
740 );
741
747template<typename Ordinal, typename Packet, typename Serializer>
749 const Comm<Ordinal>& comm,
750 const Serializer& serializer,
751 const ArrayRCP<Packet> &recvBuffer,
752 const int sourceRank
753 );
754
755
756// 2008/07/29: rabartl: ToDo: Add reference semantics version of ireceive!
757
758
766template<typename Ordinal>
768 const Comm<Ordinal>& comm,
769 const ArrayView<RCP<CommRequest<Ordinal> > > &requests
770 );
771
801template<typename Ordinal>
802void
804 const ArrayView<RCP<CommRequest<Ordinal> > >& requests,
805 const ArrayView<RCP<CommStatus<Ordinal> > >& statuses);
806
830template<typename Ordinal>
832wait (const Comm<Ordinal>& comm, const Ptr<RCP<CommRequest<Ordinal> > >& request);
833
834//
835// Standard reduction subclasses for objects that use value semantics
836//
837
838
843template<typename Ordinal, typename Packet>
844class SumValueReductionOp : public ValueTypeReductionOp<Ordinal,Packet>
845{
846public:
848 void reduce(
849 const Ordinal count,
850 const Packet inBuffer[],
851 Packet inoutBuffer[]
852 ) const;
853};
854
855
864template<typename Ordinal, typename Packet>
865class MinValueReductionOp : public ValueTypeReductionOp<Ordinal,Packet>
866{
867public:
869 void reduce(
870 const Ordinal count,
871 const Packet inBuffer[],
872 Packet inoutBuffer[]
873 ) const;
874};
875
876
885template<typename Ordinal, typename Packet>
886class MaxValueReductionOp : public ValueTypeReductionOp<Ordinal,Packet>
887{
888public:
890 void reduce(
891 const Ordinal count,
892 const Packet inBuffer[],
893 Packet inoutBuffer[]
894 ) const;
895};
896
897
902template<typename Ordinal, typename Packet>
903class ANDValueReductionOp : public ValueTypeReductionOp<Ordinal,Packet>
904{
905public:
907 void reduce(
908 const Ordinal count,
909 const Packet inBuffer[],
910 Packet inoutBuffer[]
911 ) const;
912};
913
914
915// ////////////////////////////////////////////////////////////
916// Implementation details (not for geneal users to mess with)
917
918
919//
920// ReductionOp Utilities
921//
922
923
924namespace MixMaxUtilities {
925
926
927template<bool isComparable, typename Ordinal, typename Packet>
928class Min {};
929
930
931template<typename Ordinal, typename Packet>
932class Min<true,Ordinal,Packet> {
933public:
934 static void min(
935 const Ordinal count,
936 const Packet inBuffer[],
937 Packet inoutBuffer[]
938 )
939 {
940 for( int i = 0; i < count; ++i )
941 inoutBuffer[i] = TEUCHOS_MIN(inoutBuffer[i],inBuffer[i]);
942 }
943};
944
945
946template<typename Ordinal, typename Packet>
947class Min<false,Ordinal,Packet> {
948public:
949 static void min(
950 const Ordinal,
951 const Packet[],
952 Packet[]
953 )
954 {
956 true,std::logic_error,
957 "Error, the type "<<TypeNameTraits<Packet>::name()
958 <<" does not support comparison operations!"
959 );
960 }
961};
962
963
964template<bool isComparable, typename Ordinal, typename Packet>
965class Max {};
966
967
968template<typename Ordinal, typename Packet>
969class Max<true,Ordinal,Packet> {
970public:
971 static void max(
972 const Ordinal count,
973 const Packet inBuffer[],
974 Packet inoutBuffer[]
975 )
976 {
977 for( int i = 0; i < count; ++i )
978 inoutBuffer[i] = TEUCHOS_MAX(inoutBuffer[i],inBuffer[i]);
979 }
980};
981
982
983template<typename Ordinal, typename Packet>
984class Max<false,Ordinal,Packet> {
985public:
986 static void max(
987 const Ordinal,
988 const Packet[],
989 Packet[]
990 )
991 {
993 true,std::logic_error,
994 "Error, the type "<<TypeNameTraits<Packet>::name()
995 <<" does not support comparison operations!"
996 );
997 }
998};
999
1000
1001template<bool isComparable, typename Ordinal, typename Packet>
1002class AND {};
1003
1004
1005template<typename Ordinal, typename Packet>
1006class AND<true,Ordinal,Packet> {
1007public:
1008 static void andOp(
1009 const Ordinal count,
1010 const Packet inBuffer[],
1011 Packet inoutBuffer[]
1012 )
1013 {
1014 for( int i = 0; i < count; ++i )
1015 inoutBuffer[i] = inoutBuffer[i] && inBuffer[i];
1016 }
1017};
1018
1019
1020template<typename Ordinal, typename Packet>
1021class AND<false,Ordinal,Packet> {
1022public:
1023 static void andOp(
1024 const Ordinal,
1025 const Packet[],
1026 Packet[]
1027 )
1028 {
1030 true,std::logic_error,
1031 "Error, the type "<<TypeNameTraits<Packet>::name()
1032 <<" does not support logical AND operations!"
1033 );
1034 }
1035};
1036
1037
1038} // namespace MixMaxUtilities
1039
1040
1041template<typename Ordinal, typename Packet>
1043 const Ordinal count,
1044 const Packet inBuffer[],
1045 Packet inoutBuffer[]
1046 ) const
1047{
1048 for( int i = 0; i < count; ++i )
1049 inoutBuffer[i] += inBuffer[i];
1050}
1051
1052
1053template<typename Ordinal, typename Packet>
1055 const Ordinal count,
1056 const Packet inBuffer[],
1057 Packet inoutBuffer[]
1058 ) const
1059{
1060 typedef MixMaxUtilities::Min<ScalarTraits<Packet>::isComparable, Ordinal, Packet> min_type;
1061 min_type::min (count, inBuffer, inoutBuffer);
1062}
1063
1064
1065template<typename Ordinal, typename Packet>
1067 const Ordinal count,
1068 const Packet inBuffer[],
1069 Packet inoutBuffer[]
1070 ) const
1071{
1072 typedef MixMaxUtilities::Max<ScalarTraits<Packet>::isComparable, Ordinal, Packet> max_type;
1073 max_type::max (count,inBuffer,inoutBuffer);
1074}
1075
1076
1077template<typename Ordinal, typename Packet>
1079 const Ordinal count,
1080 const Packet inBuffer[],
1081 Packet inoutBuffer[]
1082 ) const
1083{
1084 typedef MixMaxUtilities::AND<ScalarTraits<Packet>::isComparable, Ordinal, Packet> and_type;
1085 and_type::andOp (count, inBuffer, inoutBuffer);
1086}
1087
1088
1089} // namespace Teuchos
1090
1091
1092// //////////////////////////
1093// Template implemenations
1094
1095
1096//
1097// ReductionOp utilities
1098//
1099
1100
1101namespace Teuchos {
1102
1103
1104// Not for the general user to use! I am returning a raw ReductionOp* pointer
1105// to avoid the overhead of using RCP. However, given the use case
1106// this is just fine since I can just use std::auto_ptr to make sure things
1107// are deleted correctly.
1108//
1109// NOTE (mfh 08 Feb 2015) std::auto_ptr has been deprecated in C++11.
1110// I could either replace it with std::unique_ptr, or just call 'new'
1111// and 'delete' manually. The former is less error prone, but
1112// requires checking a macro for whether C++11 is actually enabled.
1113// Thus, I've chosen (for now) to rewrite all the code that uses
1114// std::auto_ptr, so that it allocates and deletes manually.
1115template<typename Ordinal, typename Packet>
1116ValueTypeReductionOp<Ordinal,Packet>*
1117createOp (const EReductionType reductType)
1118{
1119 typedef ScalarTraits<Packet> ST;
1120 switch (reductType) {
1121 case REDUCE_SUM: {
1123 }
1124 case REDUCE_MIN: {
1125 if (ST::isComparable) {
1127 }
1128 else {
1130 (! ST::isComparable, std::invalid_argument, "Teuchos::createOp"
1131 "(EReductionType): The Packet type " << TypeNameTraits<Packet>::name ()
1132 << " is not less-than comparable, so it does not make sense to do a "
1133 "MIN reduction with it.");
1134 }
1135 }
1136 case REDUCE_MAX: {
1137 if (ST::isComparable) {
1139 }
1140 else {
1142 (! ST::isComparable, std::invalid_argument, "Teuchos::createOp"
1143 "(EReductionType): The Packet type " << TypeNameTraits<Packet>::name ()
1144 << " is not less-than comparable, so it does not make sense to do a "
1145 "MAX reduction with it.");
1146 }
1147 }
1148 case REDUCE_AND: {
1150 }
1151 default:
1153 true, std::invalid_argument, "Teuchos::createOp(EReductionType): "
1154 "Invalid EReductionType value " << reductType << ". Valid values "
1155 "include REDUCE_SUM, REDUCE_MIN, REDUCE_MAX, and REDUCE_AND.");
1156 }
1157}
1158
1159
1160} // namespace Teuchos
1161
1162
1163//
1164// Teuchos::Comm wrapper functions
1165//
1166
1167
1168template<typename Ordinal>
1169int Teuchos::rank(const Comm<Ordinal>& comm)
1170{
1171 return comm.getRank();
1172}
1173
1174
1175template<typename Ordinal>
1176int Teuchos::size(const Comm<Ordinal>& comm)
1177{
1178 return comm.getSize();
1179}
1180
1181
1182template<typename Ordinal>
1183void Teuchos::barrier(const Comm<Ordinal>& comm)
1184{
1186 "Teuchos::CommHelpers: barrier<"
1187 <<OrdinalTraits<Ordinal>::name()
1188 <<">()"
1189 );
1190 comm.barrier();
1191}
1192
1193
1194template<typename Ordinal, typename Packet>
1195void Teuchos::broadcast(
1196 const Comm<Ordinal>& comm,
1197 const int rootRank, const Ordinal count, Packet buffer[]
1198 )
1199{
1201 "Teuchos::CommHelpers: broadcast<"
1202 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
1203 <<">( value type )"
1204 );
1205 ValueTypeSerializationBuffer<Ordinal,Packet>
1206 charBuffer(count,buffer);
1207 comm.broadcast(
1208 rootRank,charBuffer.getBytes(),charBuffer.getCharBuffer()
1209 );
1210}
1211
1212
1213template<typename Ordinal, typename Packet>
1214void Teuchos::broadcast(
1215 const Comm<Ordinal>& comm,
1216 const int rootRank,
1217 const ArrayView<Packet> &buffer
1218 )
1219{
1220 broadcast<Ordinal, Packet>(comm, rootRank, buffer.size(), buffer.getRawPtr() );
1221}
1222
1223
1224template<typename Ordinal, typename Packet>
1225void Teuchos::broadcast(
1226 const Comm<Ordinal>& comm,
1227 const int rootRank, Packet *object
1228 )
1229{
1230 broadcast<Ordinal,Packet>(comm,rootRank,1,object);
1231}
1232
1233
1234template<typename Ordinal, typename Packet>
1235void Teuchos::broadcast(
1236 const Comm<Ordinal>& comm,
1237 const int rootRank, const Ptr<Packet> &object
1238 )
1239{
1240 broadcast<Ordinal,Packet>(comm,rootRank,1,object.getRawPtr());
1241}
1242
1243
1244template<typename Ordinal, typename Packet>
1245void Teuchos::broadcast(
1246 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
1247 const int rootRank, const Ordinal count, Packet*const buffer[]
1248 )
1249{
1251 "Teuchos::CommHelpers: broadcast<"
1252 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
1253 <<">( reference type )"
1254 );
1255 ReferenceTypeSerializationBuffer<Ordinal,Packet>
1256 charBuffer(serializer, count, buffer);
1257 comm.broadcast(
1258 rootRank,charBuffer.getBytes(),charBuffer.getCharBuffer()
1259 );
1260}
1261
1262
1263template<typename Ordinal, typename Packet>
1264void Teuchos::broadcast(
1265 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
1266 const int rootRank, const ArrayView<const Ptr<Packet> > &buffer
1267 )
1268{
1269 Array<Packet*> bufferPtrArray;
1270 for (int i = 0; i < buffer.size(); ++i) {
1271 bufferPtrArray.push_back(buffer[i].getRawPtr());
1272 }
1273 broadcast<Ordinal,Packet>(comm, serializer, rootRank,
1274 buffer.size(), bufferPtrArray.getRawPtr());
1275}
1276
1277template<typename Ordinal, typename Packet, typename Serializer>
1278void Teuchos::broadcast(
1279 const Comm<Ordinal>& comm,
1280 const Serializer& serializer,
1281 const int rootRank, const Ordinal count, Packet buffer[]
1282 )
1283{
1285 "Teuchos::CommHelpers: broadcast<"
1286 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
1287 <<">( value type )"
1288 );
1289 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
1290 charBuffer(count,buffer,rcp(&serializer,false));
1291 comm.broadcast(
1292 rootRank,charBuffer.getBytes(),charBuffer.getCharBuffer()
1293 );
1294}
1295
1296
1297template<typename Ordinal, typename Packet>
1298void Teuchos::gatherAll(
1299 const Comm<Ordinal>& comm,
1300 const Ordinal sendCount, const Packet sendBuffer[],
1301 const Ordinal recvCount, Packet recvBuffer[]
1302 )
1303{
1305 "Teuchos::CommHelpers: gatherAll<"
1306 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
1307 <<">( value type )"
1308 );
1309 ConstValueTypeSerializationBuffer<Ordinal,Packet>
1310 charSendBuffer(sendCount,sendBuffer);
1311 ValueTypeSerializationBuffer<Ordinal,Packet>
1312 charRecvBuffer(recvCount,recvBuffer);
1313 comm.gatherAll(
1314 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
1315 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
1316 );
1317}
1318
1319template<typename Ordinal, typename Packet>
1320void
1321Teuchos::gather (const Packet sendBuf[],
1322 const Ordinal sendCount,
1323 Packet recvBuf[],
1324 const Ordinal recvCount,
1325 const int root,
1326 const Comm<Ordinal>& comm)
1327{
1329 "Teuchos::CommHelpers: gather<"
1330 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
1331 <<">( value type )"
1332 );
1333 ConstValueTypeSerializationBuffer<Ordinal,Packet>
1334 charSendBuffer (sendCount, sendBuf);
1335 ValueTypeSerializationBuffer<Ordinal,Packet>
1336 charRecvBuffer (recvCount, recvBuf);
1337 comm.gather (charSendBuffer.getBytes (),
1338 charSendBuffer.getCharBuffer (),
1339 charRecvBuffer.getBytes (),
1340 charRecvBuffer.getCharBuffer (),
1341 root);
1342}
1343
1344template<typename Ordinal, typename Packet>
1345void
1346Teuchos::gatherv (const Packet sendBuf[],
1347 const Ordinal sendCount,
1348 Packet recvBuf[],
1349 const Ordinal recvCounts[],
1350 const Ordinal displs[],
1351 const int root,
1352 const Comm<Ordinal>& comm)
1353{
1354 // Ordinal totalRecvCount = 0;
1355
1356 // // In order to get the right output buffer length, we have to sum
1357 // // the receive counts from all the processes in the communicator.
1358 // const Ordinal numProcs = as<Ordinal> (comm->getSize ());
1359 // for (Ordinal k = 0; k < as<Ordinal> (numProcs); ++k) {
1360 // totalRecvCount += recvCounts[k];
1361 // }
1362
1363 // // FIXME (mfh 16 Apr 2013) We also have to redo the displacements.
1364
1365 // ConstValueTypeSerializationBuffer<Ordinal,Packet>
1366 // charSendBuffer (sendCount, sendBuf);
1367 // ValueTypeSerializationBuffer<Ordinal,Packet>
1368 // charRecvBuffer (totalRecvCount, recvBuf);
1369 // comm.gatherv (charSendBuffer.getBytes (),
1370 // charSendBuffer.getCharBuffer (),
1371 // charRecvBuffer.getBytes (),
1372 // charRecvBuffer.getCharBuffer (),
1373 // root);
1374 TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
1375 "Teuchos::gatherv: The general case is not implemented.");
1376}
1377
1378template<typename Ordinal, typename Packet>
1379void Teuchos::gatherAll(
1380 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
1381 const Ordinal sendCount, const Packet*const sendBuffer[],
1382 const Ordinal recvCount, Packet*const recvBuffer[]
1383 )
1384{
1385 TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Implement and test when needed!
1386}
1387
1388template<typename Ordinal, typename Packet, typename Serializer>
1389void Teuchos::gatherAll(
1390 const Comm<Ordinal>& comm,
1391 const Serializer& serializer,
1392 const Ordinal sendCount, const Packet sendBuffer[],
1393 const Ordinal recvCount, Packet recvBuffer[]
1394 )
1395{
1397 "Teuchos::CommHelpers: gatherAll<"
1398 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
1399 <<">( value type )"
1400 );
1401 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
1402 charSendBuffer(sendCount,sendBuffer,rcp(&serializer,false));
1403 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
1404 charRecvBuffer(recvCount,recvBuffer,rcp(&serializer,false));
1405 comm.gatherAll(
1406 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
1407 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
1408 );
1409}
1410
1411
1412template<typename Ordinal, typename Packet>
1413void
1414Teuchos::reduce (const Packet sendBuf[],
1415 Packet recvBuf[],
1416 const Ordinal count,
1417 const EReductionType reductType,
1418 const Ordinal root,
1419 const Comm<Ordinal>& comm)
1420{
1421 // See Bug 6375; Tpetra does not actually need any specializations
1422 // other than Ordinal = int and Packet = int. We may add them later
1423 // if there is interest.
1425 (true, std::logic_error, "Teuchos::reduce<" <<
1426 TypeNameTraits<Ordinal>::name () << "," << TypeNameTraits<Packet>::name ()
1427 << ">: Generic version not implemented. We only implement this function "
1428 "for Ordinal = int and Packet = specific types.");
1429}
1430
1431
1432template<typename Ordinal, typename Packet>
1433void Teuchos::reduceAll(
1434 const Comm<Ordinal>& comm, const ValueTypeReductionOp<Ordinal,Packet> &reductOp
1435 ,const Ordinal count, const Packet sendBuffer[], Packet globalReducts[]
1436 )
1437{
1439 "Teuchos::CommHelpers: reduceAll<"
1440 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
1441 <<">( value type, user-defined op )"
1442 );
1443 ConstValueTypeSerializationBuffer<Ordinal,Packet>
1444 charSendBuffer(count,sendBuffer);
1445 ValueTypeSerializationBuffer<Ordinal,Packet>
1446 charGlobalReducts(count,globalReducts);
1447 CharToValueTypeReductionOp<Ordinal,Packet>
1448 charReductOp(rcp(&reductOp,false));
1449 comm.reduceAll(
1450 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
1451 ,charGlobalReducts.getCharBuffer()
1452 );
1453}
1454
1455
1456template<typename Ordinal, typename Packet>
1457void Teuchos::reduceAll(
1458 const Comm<Ordinal>& comm, const EReductionType reductType,
1459 const Ordinal count, const Packet sendBuffer[], Packet globalReducts[]
1460 )
1461{
1463 "Teuchos::CommHelpers: reduceAll<"
1464 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
1465 <<">( value type, "<<toString(reductType)<<" )"
1466 );
1467
1468 ValueTypeReductionOp<Ordinal,Packet>* reductOp =
1469 createOp<Ordinal, Packet> (reductType);
1470 try {
1471 reduceAll(comm,*reductOp,count,sendBuffer,globalReducts);
1472 }
1473 catch (std::exception& e) {
1474 delete reductOp;
1475 throw e;
1476 }
1477 delete reductOp;
1478}
1479
1480
1481namespace Teuchos {
1482
1483// amb 11 Nov 2014. I am disabling these specializations for
1484// now. MPI_C_DOUBLE_COMPLEX is causing a problem in some builds. This code was
1485// effectively turned on only yesterday (10 Nov 2014) when TEUCHOS_HAVE_COMPLEX
1486// was corrected to be HAVE_TEUCHOS_COMPLEX, so evidently there are no users of
1487// these specializations.
1488#if 0
1489#ifdef HAVE_TEUCHOS_COMPLEX
1490// Specialization for Ordinal=int and Packet=std::complex<double>.
1491template<>
1493reduceAll<int, std::complex<double> > (const Comm<int>& comm,
1494 const EReductionType reductType,
1495 const int count,
1496 const std::complex<double> sendBuffer[],
1497 std::complex<double> globalReducts[]);
1498template<>
1499TEUCHOSCOMM_LIB_DLL_EXPORT RCP<CommRequest<int> >
1500ireceive<int, std::complex<double> > (const Comm<int>& comm,
1501 const ArrayRCP<std::complex<double> >& recvBuffer,
1502 const int sourceRank);
1503template<>
1504TEUCHOSCOMM_LIB_DLL_EXPORT RCP<CommRequest<int> >
1505ireceive<int, std::complex<double> > (const ArrayRCP<std::complex<double> > &recvBuffer,
1506 const int sourceRank,
1507 const int tag,
1508 const Comm<int>& comm);
1509template<>
1511send<int, std::complex<double> > (const Comm<int>& comm,
1512 const int count,
1513 const std::complex<double> sendBuffer[],
1514 const int destRank);
1515template<>
1517send<int, std::complex<double> > (const std::complex<double> sendBuffer[],
1518 const int count,
1519 const int destRank,
1520 const int tag,
1521 const Comm<int>& comm);
1522template<>
1523TEUCHOSCOMM_LIB_DLL_EXPORT RCP<CommRequest<int> >
1524isend<int, std::complex<double> > (const ArrayRCP<const std::complex<double> >& sendBuffer,
1525 const int destRank,
1526 const int tag,
1527 const Comm<int>& comm);
1528
1529// Specialization for Ordinal=int and Packet=std::complex<float>.
1530template<>
1532reduceAll<int, std::complex<float> > (const Comm<int>& comm,
1533 const EReductionType reductType,
1534 const int count,
1535 const std::complex<float> sendBuffer[],
1536 std::complex<float> globalReducts[]);
1537template<>
1538TEUCHOSCOMM_LIB_DLL_EXPORT RCP<CommRequest<int> >
1539ireceive<int, std::complex<float> > (const Comm<int>& comm,
1540 const ArrayRCP<std::complex<float> >& recvBuffer,
1541 const int sourceRank);
1542template<>
1543TEUCHOSCOMM_LIB_DLL_EXPORT RCP<CommRequest<int> >
1544ireceive<int, std::complex<float> > (const ArrayRCP<std::complex<float> > &recvBuffer,
1545 const int sourceRank,
1546 const int tag,
1547 const Comm<int>& comm);
1548template<>
1550send<int, std::complex<float> > (const Comm<int>& comm,
1551 const int count,
1552 const std::complex<float> sendBuffer[],
1553 const int destRank);
1554template<>
1556send<int, std::complex<float> > (const std::complex<float> sendBuffer[],
1557 const int count,
1558 const int destRank,
1559 const int tag,
1560 const Comm<int>& comm);
1561template<>
1562TEUCHOSCOMM_LIB_DLL_EXPORT RCP<CommRequest<int> >
1563isend<int, std::complex<float> > (const ArrayRCP<const std::complex<float> >& sendBuffer,
1564 const int destRank,
1565 const int tag,
1566 const Comm<int>& comm);
1567#endif // HAVE_TEUCHOS_COMPLEX
1568#endif // if 0
1569
1570// Specialization for Ordinal=int and Packet=double.
1571template<>
1573reduceAll<int, double> (const Comm<int>& comm,
1574 const EReductionType reductType,
1575 const int count,
1576 const double sendBuffer[],
1577 double globalReducts[]);
1578template<>
1579TEUCHOSCOMM_LIB_DLL_EXPORT RCP<CommRequest<int> >
1580ireceive<int, double> (const Comm<int>& comm,
1581 const ArrayRCP<double>& recvBuffer,
1582 const int sourceRank);
1583template<>
1584TEUCHOSCOMM_LIB_DLL_EXPORT RCP<CommRequest<int> >
1585ireceive<int, double> (const ArrayRCP<double> &recvBuffer,
1586 const int sourceRank,
1587 const int tag,
1588 const Comm<int>& comm);
1589template<>
1591send<int, double> (const Comm<int>& comm,
1592 const int count,
1593 const double sendBuffer[],
1594 const int destRank);
1595template<>
1597send<int, double> (const double sendBuffer[],
1598 const int count,
1599 const int destRank,
1600 const int tag,
1601 const Comm<int>& comm);
1602template<>
1605 const int destRank,
1606 const int tag,
1607 const Comm<int>& comm);
1608
1609// Specialization for Ordinal=int and Packet=float.
1610template<>
1612reduceAll<int, float> (const Comm<int>& comm,
1613 const EReductionType reductType,
1614 const int count,
1615 const float sendBuffer[],
1616 float globalReducts[]);
1617template<>
1619ireceive<int, float> (const Comm<int>& comm,
1620 const ArrayRCP<float>& recvBuffer,
1621 const int sourceRank);
1622template<>
1624ireceive<int, float> (const ArrayRCP<float> &recvBuffer,
1625 const int sourceRank,
1626 const int tag,
1627 const Comm<int>& comm);
1628template<>
1630send<int, float> (const Comm<int>& comm,
1631 const int count,
1632 const float sendBuffer[],
1633 const int destRank);
1634template<>
1636send<int, float> (const float sendBuffer[],
1637 const int count,
1638 const int destRank,
1639 const int tag,
1640 const Comm<int>& comm);
1641template<>
1643isend<int, float> (const ArrayRCP<const float>& sendBuffer,
1644 const int destRank,
1645 const int tag,
1646 const Comm<int>& comm);
1647
1648// Specialization for Ordinal=int and Packet=long long.
1649template<>
1651gather<int, long long> (const long long sendBuf[],
1652 const int sendCount,
1653 long long recvBuf[],
1654 const int recvCount,
1655 const int root,
1656 const Comm<int>& comm);
1657template<>
1659gatherv<int, long long> (const long long sendBuf[],
1660 const int sendCount,
1661 long long recvBuf[],
1662 const int recvCounts[],
1663 const int displs[],
1664 const int root,
1665 const Comm<int>& comm);
1666template<>
1669 const EReductionType reductType,
1670 const int count,
1671 const long long sendBuffer[],
1672 long long globalReducts[]);
1673template<>
1676 const ArrayRCP<long long>& recvBuffer,
1677 const int sourceRank);
1678template<>
1681 const int sourceRank,
1682 const int tag,
1683 const Comm<int>& comm);
1684template<>
1686send<int, long long> (const Comm<int>& comm,
1687 const int count,
1688 const long long sendBuffer[],
1689 const int destRank);
1690template<>
1692send<int, long long> (const long long sendBuffer[],
1693 const int count,
1694 const int destRank,
1695 const int tag,
1696 const Comm<int>& comm);
1697template<>
1700 const int destRank,
1701 const int tag,
1702 const Comm<int>& comm);
1703
1704// Specialization for Ordinal=int and Packet=unsigned long long.
1705template<>
1707gather<int, unsigned long long> (const unsigned long long sendBuf[],
1708 const int sendCount,
1709 unsigned long long recvBuf[],
1710 const int recvCount,
1711 const int root,
1712 const Comm<int>& comm);
1713template<>
1715gatherv<int, unsigned long long> (const unsigned long long sendBuf[],
1716 const int sendCount,
1717 unsigned long long recvBuf[],
1718 const int recvCounts[],
1719 const int displs[],
1720 const int root,
1721 const Comm<int>& comm);
1722template<>
1725 const EReductionType reductType,
1726 const int count,
1727 const unsigned long long sendBuffer[],
1728 unsigned long long globalReducts[]);
1729template<>
1732 const ArrayRCP<unsigned long long>& recvBuffer,
1733 const int sourceRank);
1734template<>
1737 const int sourceRank,
1738 const int tag,
1739 const Comm<int>& comm);
1740template<>
1743 const int count,
1744 const unsigned long long sendBuffer[],
1745 const int destRank);
1746template<>
1748send<int, unsigned long long> (const unsigned long long sendBuffer[],
1749 const int count,
1750 const int destRank,
1751 const int tag,
1752 const Comm<int>& comm);
1753template<>
1756 const int destRank,
1757 const int tag,
1758 const Comm<int>& comm);
1759
1760// Specialization for Ordinal=int and Packet=long.
1761template<>
1763gather<int, long> (const long sendBuf[],
1764 const int sendCount,
1765 long recvBuf[],
1766 const int recvCount,
1767 const int root,
1768 const Comm<int>& comm);
1769template<>
1771gatherv<int, long> (const long sendBuf[],
1772 const int sendCount,
1773 long recvBuf[],
1774 const int recvCounts[],
1775 const int displs[],
1776 const int root,
1777 const Comm<int>& comm);
1778template<>
1780reduceAll<int, long> (const Comm<int>& comm,
1781 const EReductionType reductType,
1782 const int count,
1783 const long sendBuffer[],
1784 long globalReducts[]);
1785template<>
1787ireceive<int, long> (const Comm<int>& comm,
1788 const ArrayRCP<long>& recvBuffer,
1789 const int sourceRank);
1790template<>
1792ireceive<int, long> (const ArrayRCP<long> &recvBuffer,
1793 const int sourceRank,
1794 const int tag,
1795 const Comm<int>& comm);
1796template<>
1798send<int, long> (const Comm<int>& comm,
1799 const int count,
1800 const long sendBuffer[],
1801 const int destRank);
1802template<>
1804send<int, long> (const long sendBuffer[],
1805 const int count,
1806 const int destRank,
1807 const int tag,
1808 const Comm<int>& comm);
1809template<>
1811isend<int, long> (const ArrayRCP<const long>& sendBuffer,
1812 const int destRank,
1813 const int tag,
1814 const Comm<int>& comm);
1815
1816// Specialization for Ordinal=int and Packet=unsigned long.
1817template<>
1819gather<int, unsigned long> (const unsigned long sendBuf[],
1820 const int sendCount,
1821 unsigned long recvBuf[],
1822 const int recvCount,
1823 const int root,
1824 const Comm<int>& comm);
1825template<>
1827gatherv<int, unsigned long> (const unsigned long sendBuf[],
1828 const int sendCount,
1829 unsigned long recvBuf[],
1830 const int recvCounts[],
1831 const int displs[],
1832 const int root,
1833 const Comm<int>& comm);
1834template<>
1837 const EReductionType reductType,
1838 const int count,
1839 const unsigned long sendBuffer[],
1840 unsigned long globalReducts[]);
1841template<>
1844 const ArrayRCP<unsigned long>& recvBuffer,
1845 const int sourceRank);
1846template<>
1849 const int sourceRank,
1850 const int tag,
1851 const Comm<int>& comm);
1852template<>
1855 const int count,
1856 const unsigned long sendBuffer[],
1857 const int destRank);
1858template<>
1860send<int, unsigned long> (const unsigned long sendBuffer[],
1861 const int count,
1862 const int destRank,
1863 const int tag,
1864 const Comm<int>& comm);
1865template<>
1868 const int destRank,
1869 const int tag,
1870 const Comm<int>& comm);
1871
1872// Specialization for Ordinal=int and Packet=int.
1873template<>
1875gather<int, int> (const int sendBuf[],
1876 const int sendCount,
1877 int recvBuf[],
1878 const int recvCount,
1879 const int root,
1880 const Comm<int>& comm);
1881template<>
1883gatherv<int, int> (const int sendBuf[],
1884 const int sendCount,
1885 int recvBuf[],
1886 const int recvCounts[],
1887 const int displs[],
1888 const int root,
1889 const Comm<int>& comm);
1890template<>
1892scatter (const int sendBuf[],
1893 const int sendCount,
1894 int recvBuf[],
1895 const int recvCount,
1896 const int root,
1897 const Comm<int>& comm);
1898template<>
1900reduce<int, int> (const int sendBuf[],
1901 int recvBuf[],
1902 const int count,
1903 const EReductionType reductType,
1904 const int root,
1905 const Comm<int>& comm);
1906template<>
1908reduce<int, long> (const long sendBuf[],
1909 long recvBuf[],
1910 const int count,
1911 const EReductionType reductType,
1912 const int root,
1913 const Comm<int>& comm);
1914template<>
1916reduce<int, unsigned long> (const unsigned long sendBuf[],
1917 unsigned long recvBuf[],
1918 const int count,
1919 const EReductionType reductType,
1920 const int root,
1921 const Comm<int>& comm);
1922template<>
1924reduce<int, unsigned long long > (const unsigned long long sendBuf[],
1925 unsigned long long recvBuf[],
1926 const int count,
1927 const EReductionType reductType,
1928 const int root,
1929 const Comm<int>& comm);
1930template<>
1932reduce<int, double> (const double sendBuf[],
1933 double recvBuf[],
1934 const int count,
1935 const EReductionType reductType,
1936 const int root,
1937 const Comm<int>& comm);
1938template<>
1940reduceAll<int, int> (const Comm<int>& comm,
1941 const EReductionType reductType,
1942 const int count,
1943 const int sendBuffer[],
1944 int globalReducts[]);
1945
1946template<>
1948ireceive<int, int> (const Comm<int>& comm,
1949 const ArrayRCP<int>& recvBuffer,
1950 const int sourceRank);
1951template<>
1953ireceive<int, int> (const ArrayRCP<int> &recvBuffer,
1954 const int sourceRank,
1955 const int tag,
1956 const Comm<int>& comm);
1957template<>
1959send<int, int> (const Comm<int>& comm,
1960 const int count,
1961 const int sendBuffer[],
1962 const int destRank);
1963template<>
1965send<int, int> (const int sendBuffer[],
1966 const int count,
1967 const int destRank,
1968 const int tag,
1969 const Comm<int>& comm);
1970template<>
1972isend<int, int> (const ArrayRCP<const int>& sendBuffer,
1973 const int destRank,
1974 const int tag,
1975 const Comm<int>& comm);
1976
1977// Specialization for Ordinal=int and Packet=unsigned int.
1978template<>
1980gather<int, unsigned int> (const unsigned int sendBuf[],
1981 const int sendCount,
1982 unsigned int recvBuf[],
1983 const int recvCount,
1984 const int root,
1985 const Comm<int>& comm);
1986template<>
1988gatherv<int, unsigned int> (const unsigned int sendBuf[],
1989 const int sendCount,
1990 unsigned int recvBuf[],
1991 const int recvCounts[],
1992 const int displs[],
1993 const int root,
1994 const Comm<int>& comm);
1995template<>
1998 const EReductionType reductType,
1999 const int count,
2000 const unsigned int sendBuffer[],
2001 unsigned int globalReducts[]);
2002template<>
2005 const ArrayRCP<unsigned int>& recvBuffer,
2006 const int sourceRank);
2007template<>
2010 const int sourceRank,
2011 const int tag,
2012 const Comm<int>& comm);
2013template<>
2016 const int count,
2017 const unsigned int sendBuffer[],
2018 const int destRank);
2019template<>
2021send<int, unsigned int> (const unsigned int sendBuffer[],
2022 const int count,
2023 const int destRank,
2024 const int tag,
2025 const Comm<int>& comm);
2026template<>
2029 const int destRank,
2030 const int tag,
2031 const Comm<int>& comm);
2032
2033// Specialization for Ordinal=int and Packet=short.
2034template<>
2036gather<int, short> (const short sendBuf[],
2037 const int sendCount,
2038 short recvBuf[],
2039 const int recvCount,
2040 const int root,
2041 const Comm<int>& comm);
2042template<>
2044gatherv<int, short> (const short sendBuf[],
2045 const int sendCount,
2046 short recvBuf[],
2047 const int recvCounts[],
2048 const int displs[],
2049 const int root,
2050 const Comm<int>& comm);
2051template<>
2053reduceAll<int, short> (const Comm<int>& comm,
2054 const EReductionType reductType,
2055 const int count,
2056 const short sendBuffer[],
2057 short globalReducts[]);
2058template<>
2060ireceive<int, short> (const Comm<int>& comm,
2061 const ArrayRCP<short>& recvBuffer,
2062 const int sourceRank);
2063template<>
2065ireceive<int, short> (const ArrayRCP<short> &recvBuffer,
2066 const int sourceRank,
2067 const int tag,
2068 const Comm<int>& comm);
2069template<>
2071send<int, short> (const Comm<int>& comm,
2072 const int count,
2073 const short sendBuffer[],
2074 const int destRank);
2075template<>
2077send<int, short> (const short sendBuffer[],
2078 const int count,
2079 const int destRank,
2080 const int tag,
2081 const Comm<int>& comm);
2082template<>
2084isend<int, short> (const ArrayRCP<const short>& sendBuffer,
2085 const int destRank,
2086 const int tag,
2087 const Comm<int>& comm);
2088
2089// mfh 18 Oct 2012: The specialization for Packet=char seems to be
2090// causing problems such as the following:
2091//
2092// http://testing.sandia.gov/cdash/testDetails.php?test=9909246&build=747699
2093//
2094// I am disabling it for now. This should revert back to the old
2095// behavior for Packet=char. That should fix the Tpetra errors, since
2096// many Tpetra objects inherit from DistObject<char, ...>.
2097#if 0
2098// Specialization for Ordinal=int and Packet=char.
2099template<>
2101reduceAll<int, char> (const Comm<int>& comm,
2102 const EReductionType reductType,
2103 const int count,
2104 const char sendBuffer[],
2105 char globalReducts[]);
2106#endif // 0
2107} // namespace Teuchos
2108
2109
2110template<typename Ordinal, typename Packet>
2111void Teuchos::reduceAll(
2112 const Comm<Ordinal>& comm, const EReductionType reductType
2113 ,const Packet &send, const Ptr<Packet> &globalReduct
2114 )
2115{
2116 // mfh 17 Oct 2012: This will invoke the above specializations for
2117 // general count, so we don't need to specialize this function.
2118 reduceAll<Ordinal,Packet>(comm, reductType, 1, &send, &*globalReduct);
2119}
2120
2121
2122template<typename Ordinal, typename Packet>
2123void Teuchos::reduceAll(
2124 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
2125 const ReferenceTypeReductionOp<Ordinal,Packet> &reductOp,
2126 const Ordinal count, const Packet*const sendBuffer[], Packet*const globalReducts[]
2127 )
2128{
2130 "Teuchos::CommHelpers: reduceAll<"
2131 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2132 <<">( reference type )"
2133 );
2134 ConstReferenceTypeSerializationBuffer<Ordinal,Packet>
2135 charSendBuffer(serializer,count,sendBuffer);
2136 ReferenceTypeSerializationBuffer<Ordinal,Packet>
2137 charGlobalReducts(serializer,count,globalReducts);
2138 CharToReferenceTypeReductionOp<Ordinal,Packet>
2139 charReductOp(rcp(&serializer,false),rcp(&reductOp,false));
2140 comm.reduceAll(
2141 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2142 ,charGlobalReducts.getCharBuffer()
2143 );
2144}
2145
2146template<typename Ordinal, typename Packet, typename Serializer>
2147void Teuchos::reduceAll(
2148 const Comm<Ordinal>& comm,
2149 const Serializer& serializer,
2150 const ValueTypeReductionOp<Ordinal,Packet> &reductOp,
2151 const Ordinal count, const Packet sendBuffer[], Packet globalReducts[]
2152 )
2153{
2155 "Teuchos::CommHelpers: reduceAll<"
2156 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2157 <<">( value type, user-defined op )"
2158 );
2159 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2160 charSendBuffer(count,sendBuffer,rcp(&serializer,false));
2161 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2162 charGlobalReducts(count,globalReducts,rcp(&serializer,false));
2163 CharToValueTypeReductionOp<Ordinal,Packet,Serializer>
2164 charReductOp(rcp(&reductOp,false),rcp(&serializer,false));
2165 comm.reduceAll(
2166 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2167 ,charGlobalReducts.getCharBuffer()
2168 );
2169}
2170
2171
2172template<typename Ordinal, typename Packet, typename Serializer>
2173void Teuchos::reduceAll(
2174 const Comm<Ordinal>& comm,
2175 const Serializer& serializer,
2176 const EReductionType reductType,
2177 const Ordinal count, const Packet sendBuffer[], Packet globalReducts[]
2178 )
2179{
2181 "Teuchos::CommHelpers: reduceAll<"
2182 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2183 <<">( value type, "<<toString(reductType)<<" )"
2184 );
2185
2186 ValueTypeReductionOp<Ordinal,Packet>* reductOp =
2187 createOp<Ordinal, Packet> (reductType);
2188 try {
2189 reduceAll(comm,serializer,*reductOp,count,sendBuffer,globalReducts);
2190 }
2191 catch (std::exception& e) {
2192 delete reductOp;
2193 throw e;
2194 }
2195 delete reductOp;
2196}
2197
2198
2199template<typename Ordinal, typename Packet>
2200void Teuchos::scan(
2201 const Comm<Ordinal>& comm, const ValueTypeReductionOp<Ordinal,Packet> &reductOp,
2202 const Ordinal count, const Packet sendBuffer[], Packet scanReducts[]
2203 )
2204{
2206 "Teuchos::CommHelpers: scan<"
2207 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2208 <<">( value type, user-defined op )"
2209 );
2210 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2211 charSendBuffer(count,sendBuffer);
2212 ValueTypeSerializationBuffer<Ordinal,Packet>
2213 charScanReducts(count,scanReducts);
2214 CharToValueTypeReductionOp<Ordinal,Packet>
2215 charReductOp(rcp(&reductOp,false));
2216 comm.scan(
2217 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2218 ,charScanReducts.getCharBuffer()
2219 );
2220}
2221
2222
2223template<typename Ordinal, typename Packet>
2224void Teuchos::scan(
2225 const Comm<Ordinal>& comm, const EReductionType reductType,
2226 const Ordinal count, const Packet sendBuffer[], Packet scanReducts[]
2227 )
2228{
2230 "Teuchos::CommHelpers: scan<"
2231 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2232 <<">( value type, "<<toString(reductType)<<" )"
2233 );
2234
2235 ValueTypeReductionOp<Ordinal,Packet>* reductOp =
2236 createOp<Ordinal, Packet> (reductType);
2237 try {
2238 scan(comm,*reductOp,count,sendBuffer,scanReducts);
2239 }
2240 catch (std::exception& e) {
2241 delete reductOp;
2242 throw e;
2243 }
2244 delete reductOp;
2245}
2246
2247
2248template<typename Ordinal, typename Packet>
2249void Teuchos::scan(
2250 const Comm<Ordinal>& comm, const EReductionType reductType,
2251 const Packet &send, const Ptr<Packet> &scanReduct
2252 )
2253{
2254 scan<Ordinal,Packet>(comm, reductType, 1, &send, &*scanReduct);
2255}
2256
2257
2258template<typename Ordinal, typename Packet>
2259void Teuchos::scan(
2260 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
2261 const ReferenceTypeReductionOp<Ordinal,Packet> &reductOp,
2262 const Ordinal count, const Packet*const sendBuffer[], Packet*const scanReducts[]
2263 )
2264{
2265 TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Implement and test when needed!
2266}
2267
2268template<typename Ordinal, typename Packet, typename Serializer>
2269void Teuchos::scan(
2270 const Comm<Ordinal>& comm,
2271 const Serializer& serializer,
2272 const ValueTypeReductionOp<Ordinal,Packet> &reductOp,
2273 const Ordinal count, const Packet sendBuffer[], Packet scanReducts[]
2274 )
2275{
2277 "Teuchos::CommHelpers: scan<"
2278 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2279 <<">( value type, user-defined op )"
2280 );
2281 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2282 charSendBuffer(count,sendBuffer,rcp(&serializer,false));
2283 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2284 charScanReducts(count,scanReducts,rcp(&serializer,false));
2285 CharToValueTypeReductionOp<Ordinal,Packet,Serializer>
2286 charReductOp(rcp(&reductOp,false),rcp(&serializer,false));
2287 comm.scan(
2288 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2289 ,charScanReducts.getCharBuffer()
2290 );
2291}
2292
2293
2294template<typename Ordinal, typename Packet, typename Serializer>
2295void Teuchos::scan(
2296 const Comm<Ordinal>& comm,
2297 const Serializer& serializer,
2298 const EReductionType reductType,
2299 const Ordinal count, const Packet sendBuffer[], Packet scanReducts[]
2300 )
2301{
2303 "Teuchos::CommHelpers: scan<"
2304 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2305 <<">( value type, "<<toString(reductType)<<" )"
2306 );
2307
2308 ValueTypeReductionOp<Ordinal,Packet>* reductOp =
2309 createOp<Ordinal, Packet> (reductType);
2310 try {
2311 scan(comm,serializer,*reductOp,count,sendBuffer,scanReducts);
2312 }
2313 catch (std::exception& e) {
2314 delete reductOp;
2315 throw e;
2316 }
2317 delete reductOp;
2318}
2319
2320template<typename Ordinal, typename Packet>
2321void Teuchos::send(
2322 const Comm<Ordinal>& comm,
2323 const Ordinal count, const Packet sendBuffer[], const int destRank
2324 )
2325{
2327 "Teuchos::CommHelpers: send<"
2328 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2329 <<">( value type )"
2330 );
2331 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2332 charSendBuffer(count,sendBuffer);
2333 comm.send(
2334 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2335 ,destRank
2336 );
2337}
2338
2339template<typename Ordinal, typename Packet>
2340void
2341Teuchos::send (const Packet sendBuffer[],
2342 const Ordinal count,
2343 const int destRank,
2344 const int tag,
2345 const Comm<Ordinal>& comm)
2346{
2348 "Teuchos::CommHelpers: send<"
2350 <<">( value type )"
2351 );
2352 ConstValueTypeSerializationBuffer<Ordinal,Packet> charSendBuffer (count, sendBuffer);
2353 comm.send (charSendBuffer.getBytes (), charSendBuffer.getCharBuffer (), destRank, tag);
2354}
2355
2356template<typename Ordinal, typename Packet>
2357void Teuchos::ssend(
2358 const Comm<Ordinal>& comm,
2359 const Ordinal count, const Packet sendBuffer[], const int destRank
2360 )
2361{
2363 "Teuchos::CommHelpers: ssend<"
2364 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2365 <<">( value type )"
2366 );
2367 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2368 charSendBuffer(count,sendBuffer);
2369 comm.ssend(
2370 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2371 ,destRank
2372 );
2373}
2374
2375template<typename Ordinal, typename Packet>
2376void
2377Teuchos::ssend (const Packet sendBuffer[],
2378 const Ordinal count,
2379 const int destRank,
2380 const int tag,
2381 const Comm<Ordinal>& comm)
2382{
2384 "Teuchos::CommHelpers: ssend<"
2386 <<">( value type )"
2387 );
2389 buf_type charSendBuffer (count, sendBuffer);
2390 comm.ssend (charSendBuffer.getBytes (),
2391 charSendBuffer.getCharBuffer (),
2392 destRank, tag);
2393}
2394
2395template<typename Ordinal, typename Packet>
2396void Teuchos::send(
2397 const Comm<Ordinal>& comm,
2398 const Packet &send, const int destRank
2399 )
2400{
2401 Teuchos::send<Ordinal,Packet>(comm,1,&send,destRank);
2402}
2403
2404template<typename Ordinal, typename Packet>
2405void Teuchos::ssend(
2406 const Comm<Ordinal>& comm,
2407 const Packet &send, const int destRank
2408 )
2409{
2410 Teuchos::ssend<Ordinal,Packet>(comm,1,&send,destRank);
2411}
2412
2413template<typename Ordinal, typename Packet>
2414void Teuchos::send(
2415 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
2416 const Ordinal count, const Packet*const sendBuffer[], const int destRank
2417 )
2418{
2419 TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Implement and test when needed!
2420}
2421
2422template<typename Ordinal, typename Packet, typename Serializer>
2423void Teuchos::send(
2424 const Comm<Ordinal>& comm,
2425 const Serializer& serializer,
2426 const Ordinal count, const Packet sendBuffer[], const int destRank
2427 )
2428{
2430 "Teuchos::CommHelpers: send<"
2431 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2432 <<">( value type )"
2433 );
2434 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2435 charSendBuffer(count,sendBuffer,rcp(&serializer,false));
2436 comm.send(
2437 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2438 ,destRank
2439 );
2440}
2441
2442template<typename Ordinal, typename Packet>
2443int Teuchos::receive(
2444 const Comm<Ordinal>& comm,
2445 const int sourceRank, const Ordinal count, Packet recvBuffer[]
2446 )
2447{
2449 "Teuchos::CommHelpers: receive<"
2450 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2451 <<">( value type )"
2452 );
2453 ValueTypeSerializationBuffer<Ordinal,Packet>
2454 charRecvBuffer(count,recvBuffer);
2455 return comm.receive(
2456 sourceRank
2457 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
2458 );
2459}
2460
2461
2462template<typename Ordinal, typename Packet>
2463int Teuchos::receive(
2464 const Comm<Ordinal>& comm,
2465 const int sourceRank, Packet *recv
2466 )
2467{
2468 return Teuchos::receive<Ordinal,Packet>(comm,sourceRank,1,recv);
2469}
2470
2471
2472template<typename Ordinal, typename Packet>
2473int Teuchos::receive(
2474 const Comm<Ordinal>& comm, const Serializer<Ordinal,Packet> &serializer,
2475 const int sourceRank, const Ordinal count, Packet*const recvBuffer[]
2476 )
2477{
2478 TEUCHOS_TEST_FOR_EXCEPT(true); // ToDo: Implement and test when needed!
2479}
2480
2481template<typename Ordinal, typename Packet, typename Serializer>
2482int Teuchos::receive(
2483 const Comm<Ordinal>& comm,
2484 const Serializer& serializer,
2485 const int sourceRank, const Ordinal count, Packet recvBuffer[]
2486 )
2487{
2489 "Teuchos::CommHelpers: receive<"
2490 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2491 <<">( value type )"
2492 );
2493 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2494 charRecvBuffer(count,recvBuffer,rcp(&serializer,false));
2495 return comm.receive(
2496 sourceRank
2497 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
2498 );
2499}
2500
2501template<typename Ordinal, typename Packet>
2503 const Comm<Ordinal>& comm,
2504 const ArrayView<const Packet> &sendBuffer,
2505 const int destRank
2506 )
2507{
2509 "Teuchos::CommHelpers: readySend<"
2510 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2511 <<">( value type )"
2512 );
2513 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2514 charSendBuffer(sendBuffer.size(), sendBuffer.getRawPtr());
2515 comm.readySend( charSendBuffer.getCharBufferView(), destRank );
2516}
2517
2518template<typename Ordinal, typename Packet>
2519void
2520Teuchos::readySend (const Packet sendBuffer[],
2521 const Ordinal count,
2522 const int destRank,
2523 const int tag,
2524 const Comm<Ordinal>& comm)
2525{
2527 "Teuchos::CommHelpers: readySend<"
2529 <<">( value type )"
2530 );
2532 buf_type charSendBuffer (count, sendBuffer);
2533 comm.readySend (charSendBuffer.getBytes (),
2534 charSendBuffer.getCharBuffer (),
2535 destRank, tag);
2536}
2537
2538template<typename Ordinal, typename Packet>
2540 const Comm<Ordinal>& comm,
2541 const Packet &send,
2542 const int destRank
2543 )
2544{
2545 readySend<Ordinal, Packet>( comm, arrayView(&send,1), destRank );
2546}
2547
2548template<typename Ordinal, typename Packet, typename Serializer>
2550 const Comm<Ordinal>& comm,
2551 const Serializer& serializer,
2552 const ArrayView<const Packet> &sendBuffer,
2553 const int destRank
2554 )
2555{
2557 "Teuchos::CommHelpers: readySend<"
2558 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2559 <<">( value type )"
2560 );
2561 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2562 charSendBuffer(sendBuffer.size(), sendBuffer.getRawPtr(), serializer);
2563 comm.readySend( charSendBuffer.getCharBufferView(), destRank );
2564}
2565
2566template<typename Ordinal, typename Packet>
2569 const Comm<Ordinal>& comm,
2570 const ArrayRCP<const Packet> &sendBuffer,
2571 const int destRank
2572 )
2573{
2575 "Teuchos::CommHelpers: isend<"
2576 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2577 <<">( value type )"
2578 );
2579 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2580 charSendBuffer(sendBuffer.size(), sendBuffer.getRawPtr());
2581 RCP<CommRequest<Ordinal> > commRequest = comm.isend(
2582 charSendBuffer.getCharBufferView(), destRank );
2583 set_extra_data( sendBuffer, "buffer", inOutArg(commRequest) );
2584 return commRequest;
2585}
2586
2587template<typename Ordinal, typename Packet>
2589Teuchos::isend (const ArrayRCP<const Packet> &sendBuffer,
2590 const int destRank,
2591 const int tag,
2592 const Comm<Ordinal>& comm)
2593{
2595 "Teuchos::isend<" << OrdinalTraits<Ordinal>::name () << ","
2596 << TypeNameTraits<Packet>::name () << ">");
2597 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2598 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
2599 RCP<CommRequest<Ordinal> > commRequest =
2600 comm.isend (charSendBuffer.getCharBufferView (), destRank, tag);
2601 set_extra_data (sendBuffer, "buffer", inOutArg (commRequest));
2602 return commRequest;
2603}
2604
2605template<typename Ordinal, typename Packet>
2608 const Comm<Ordinal>& comm,
2609 const RCP<const Packet> &send,
2610 const int destRank
2611 )
2612{
2613 const ArrayRCP<const Packet> sendBuffer =
2614 arcpWithEmbeddedObj( send.get(), 0, 1, send, false );
2615 // 2008/07/29: rabartl: Above: I need to write a helper function to create
2616 // new ArrayRCP object given a single object to copy.
2617 return isend<Ordinal, Packet>( comm, sendBuffer, destRank );
2618}
2619
2620template<typename Ordinal, typename Packet, typename Serializer>
2623 const Comm<Ordinal>& comm,
2624 const Serializer& serializer,
2625 const ArrayRCP<const Packet> &sendBuffer,
2626 const int destRank
2627 )
2628{
2630 "Teuchos::CommHelpers: isend<"
2631 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2632 <<">( value type )"
2633 );
2634 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2635 charSendBuffer(sendBuffer.size(), sendBuffer.getRawPtr(), serializer);
2636 RCP<CommRequest<Ordinal> > commRequest = comm.isend(
2637 charSendBuffer.getCharBufferView(), destRank );
2638 set_extra_data( sendBuffer, "buffer", inOutArg(commRequest) );
2639 return commRequest;
2640}
2641
2642template<typename Ordinal, typename Packet>
2645 const Comm<Ordinal>& comm,
2646 const ArrayRCP<Packet> &recvBuffer,
2647 const int sourceRank
2648 )
2649{
2651 "Teuchos::ireceive<int, " << "," << TypeNameTraits<Packet>::name () << ">");
2652 ValueTypeSerializationBuffer<Ordinal,Packet>
2653 charRecvBuffer(recvBuffer.size(), recvBuffer.getRawPtr());
2654 RCP<CommRequest<Ordinal> > commRequest = comm.ireceive(
2655 charRecvBuffer.getCharBufferView(), sourceRank );
2656 set_extra_data( recvBuffer, "buffer", inOutArg(commRequest) );
2657 return commRequest;
2658}
2659
2660template<typename Ordinal, typename Packet>
2663 const int sourceRank,
2664 const int tag,
2665 const Teuchos::Comm<Ordinal>& comm)
2666{
2668 "Teuchos::ireceive<int, " << "," << TypeNameTraits<Packet>::name () << ">");
2669 ValueTypeSerializationBuffer<int, Packet>
2670 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
2671 RCP<CommRequest<int> > commRequest =
2672 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank, tag);
2673 set_extra_data (recvBuffer, "buffer", inOutArg (commRequest));
2674 return commRequest;
2675}
2676
2677template<typename Ordinal, typename Packet>
2680 const Comm<Ordinal>& comm,
2681 const RCP<Packet> &recv,
2682 const int sourceRank
2683 )
2684{
2685 const ArrayRCP<Packet> recvBuffer =
2686 arcpWithEmbeddedObj( recv.get(), 0, 1, recv, false );
2687 // 2008/07/29: rabartl: Above: I need to write a helper function to create
2688 // new ArrayRCP object given a single object to copy.
2689 return ireceive<Ordinal, Packet>( comm, recvBuffer, sourceRank );
2690}
2691
2692template<typename Ordinal, typename Packet, typename Serializer>
2695 const Comm<Ordinal>& comm,
2696 const Serializer& serializer,
2697 const ArrayRCP<Packet> &recvBuffer,
2698 const int sourceRank
2699 )
2700{
2702 "Teuchos::CommHelpers: ireceive<"
2703 <<OrdinalTraits<Ordinal>::name()<<","<<TypeNameTraits<Packet>::name()
2704 <<">( value type )"
2705 );
2706 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2707 charRecvBuffer(recvBuffer.size(), recvBuffer.getRawPtr(), serializer);
2708 RCP<CommRequest<Ordinal> > commRequest = comm.ireceive(
2709 charRecvBuffer.getCharBufferView(), sourceRank );
2710 set_extra_data( recvBuffer, "buffer", inOutArg(commRequest) );
2711 return commRequest;
2712}
2713
2714template<typename Ordinal>
2715void Teuchos::waitAll(
2716 const Comm<Ordinal>& comm,
2717 const ArrayView<RCP<CommRequest<Ordinal> > > &requests
2718 )
2719{
2720 comm.waitAll(requests);
2721}
2722
2723
2724template<typename Ordinal>
2725void
2726Teuchos::waitAll (const Comm<Ordinal>& comm,
2727 const ArrayView<RCP<CommRequest<Ordinal> > >& requests,
2728 const ArrayView<RCP<CommStatus<Ordinal> > >& statuses)
2729{
2730 comm.waitAll (requests, statuses);
2731}
2732
2733
2734template<typename Ordinal>
2736Teuchos::wait (const Comm<Ordinal>& comm,
2737 const Ptr<RCP<CommRequest<Ordinal> > > &request)
2738{
2739 return comm.wait (request);
2740}
2741
2742
2743#endif // TEUCHOS_COMM_HELPERS_HPP
Templated array class derived from the STL std::vector.
#define TEUCHOS_COMM_TIME_MONITOR(FUNCNAME)
#define TEUCHOS_MIN(x, y)
#define TEUCHOS_MAX(x, y)
#define TEUCHOSCOMM_LIB_DLL_EXPORT
Implementation of Teuchos wrappers for MPI.
Declaration of Teuchos::EReductionType enum, and related functions.
Defines basic traits for the ordinal field type.
Defines basic traits for the scalar field type.
Defines basic traits returning the name of a type in a portable and readable way.
Definition of Teuchos::as, for conversions between types.
Standard logical AND operator for booleans.
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
Reference-counted smart pointer for managing arrays.
size_type size() const
The total number of entries in the array.
T * getRawPtr() const
Get the raw C++ pointer to the underlying object.
Nonowning array view.
Encapsulation of a pending nonblocking communication operation.
Encapsulation of the result of a receive (blocking or nonblocking).
Abstract interface for distributed-memory communication.
void ssend(const Comm< Ordinal > &comm, const Packet &send, const int destRank)
Synchronously send a single object that use values semantics to another process.
RCP< CommRequest< Ordinal > > ireceive(const Comm< Ordinal > &comm, const ArrayRCP< Packet > &recvBuffer, const int sourceRank)
Receive one or more objects (that use values semantics) from another process.
void scan(const Comm< Ordinal > &comm, const Serializer &serializer, const EReductionType reductType, const Ordinal count, const Packet sendBuffer[], Packet scanReducts[])
Scan/Reduce array of objects using value semantics using a predefined reduction type and customized s...
void scan(const Comm< Ordinal > &comm, const ValueTypeReductionOp< Ordinal, Packet > &reductOp, const Ordinal count, const Packet sendBuffer[], Packet scanReducts[])
Scan/Reduce array of objects that use value semantics using a user-defined reduction operator.
virtual void readySend(const ArrayView< const char > &sendBuffer, const int destRank) const =0
Ready send of data from this process to another process.
void waitAll(const Comm< Ordinal > &comm, const ArrayView< RCP< CommRequest< Ordinal > > > &requests)
Wait for an array of Teuchos::CommRequest objects.
void reduceAll(const Comm< Ordinal > &comm, const ValueTypeReductionOp< Ordinal, Packet > &reductOp, const Ordinal count, const Packet sendBuffer[], Packet globalReducts[])
Wrapper for MPI_Allreduce that takes a custom reduction operator.
int receive(const Comm< Ordinal > &comm, const int sourceRank, Packet *recv)
Receive a single object that use values semantics from another process.
void gatherv(const Packet sendBuf[], const Ordinal sendCount, Packet recvBuf[], const Ordinal recvCounts[], const Ordinal displs[], const int root, const Comm< Ordinal > &comm)
Gather arrays of possibly different lengths from each process to the root process.
virtual RCP< CommRequest< Ordinal > > ireceive(const ArrayView< char > &recvBuffer, const int sourceRank) const =0
Non-blocking receive.
void scan(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, const Ptr< Packet > &scanReduct)
Scan/Reduce single object using value semantics using a predefined reduction type.
int receive(const Comm< Ordinal > &comm, const Serializer< Ordinal, Packet > &serializer, const int sourceRank, const Ordinal count, Packet *const recvBuffer[])
Receive objects that use reference semantics from another process.
void readySend(const Comm< Ordinal > &comm, const Serializer &serializer, const ArrayView< const Packet > &sendBuffer, const int destRank)
Ready-Send an array of objects that use values semantics to another process using customized serializ...
void reduceAll(const Comm< Ordinal > &comm, const Serializer &serializer, const ValueTypeReductionOp< Ordinal, Packet > &reductOp, const Ordinal count, const Packet sendBuffer[], Packet globalReducts[])
Collective reduce all of array of objects using value semantics using a user-defined reduction operat...
void gatherAll(const Comm< Ordinal > &comm, const Serializer &serializer, const Ordinal sendCount, const Packet sendBuffer[], const Ordinal recvCount, Packet recvBuffer[])
Gather array of objects that use value semantics from every process to every process using customized...
int size(const Comm< Ordinal > &comm)
Get the number of processes in the communicator.
int rank(const Comm< Ordinal > &comm)
Get the process rank.
void reduce(const Packet sendBuf[], Packet recvBuf[], const Ordinal count, const EReductionType reductType, const Ordinal root, const Comm< Ordinal > &comm)
Wrapper for MPI_Reduce; reduction to one process, using a built-in reduction operator selected by enu...
void reduceAll(const Comm< Ordinal > &comm, const Serializer &serializer, const EReductionType reductType, const Ordinal count, const Packet sendBuffer[], Packet globalReducts[])
Collective reduce all of array of objects using value semantics using a pre-defined reduction type an...
int receive(const Comm< Ordinal > &comm, const Serializer &serializer, const int sourceRank, const Ordinal count, Packet recvBuffer[])
Receive objects that use values semantics from another process using customized serializer.
void gatherAll(const Comm< Ordinal > &comm, const Ordinal sendCount, const Packet sendBuffer[], const Ordinal recvCount, Packet recvBuffer[])
Gather array of objects that use value semantics from every process to every process.
void broadcast(const Comm< Ordinal > &comm, const int rootRank, Packet *object)
Broadcast single object that use value semantics.
void send(const Comm< Ordinal > &comm, const Ordinal count, const Packet sendBuffer[], const int destRank)
Send objects that use values semantics to another process.
virtual void send(const Ordinal bytes, const char sendBuffer[], const int destRank) const =0
Possibly blocking send of data from this process to another process.
void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, const Ptr< Packet > &globalReduct)
Collective reduce all for single object using value semantics using a pre-defined reduction type.
void broadcast(const Comm< Ordinal > &comm, const int rootRank, const Ordinal count, Packet buffer[])
Broadcast array of objects that use value semantics.
void waitAll(const Comm< Ordinal > &comm, const ArrayView< RCP< CommRequest< Ordinal > > > &requests, const ArrayView< RCP< CommStatus< Ordinal > > > &statuses)
Wait on one or more communication requests, and return their statuses.
void ssend(const Comm< Ordinal > &comm, const Ordinal count, const Packet sendBuffer[], const int destRank)
Synchronously send objects that use values semantics to another process.
void barrier(const Comm< Ordinal > &comm)
Barrier.
void send(const Comm< Ordinal > &comm, const Serializer &serializer, const Ordinal count, const Packet sendBuffer[], const int destRank)
Send objects that use values semantics to another process using customized serializer.
void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Ordinal count, const Packet sendBuffer[], Packet globalReducts[])
Collective reduce all of array of objects using value semantics using a pre-defined reduction type.
void gather(const Packet sendBuf[], const Ordinal sendCount, Packet recvBuf[], const Ordinal recvCount, const int root, const Comm< Ordinal > &comm)
Gather values from each process to the root process.
void broadcast(const Comm< Ordinal > &comm, const Serializer< Ordinal, Packet > &serializer, const int rootRank, const Ordinal count, Packet *const buffer[])
Broadcast array of objects that use reference semantics.
RCP< CommStatus< Ordinal > > wait(const Comm< Ordinal > &comm, const Ptr< RCP< CommRequest< Ordinal > > > &request)
Wait on a single communication request, and return its status.
void readySend(const Comm< Ordinal > &comm, const ArrayView< const Packet > &sendBuffer, const int destRank)
Ready-Send an array of objects that use values semantics to another process.
void scatter(const Packet sendBuf[], const Ordinal sendCount, Packet recvBuf[], const Ordinal recvCount, const Ordinal root, const Comm< Ordinal > &comm)
Wrapper for MPI_Scatter; scatter collective.
void gatherAll(const Comm< Ordinal > &comm, const Serializer< Ordinal, Packet > &serializer, const Ordinal sendCount, const Packet *const sendBuffer[], const Ordinal recvCount, Packet *const recvBuffer[])
Gather array of objects that use reference semantics from every process to every process.
virtual void ssend(const Ordinal bytes, const char sendBuffer[], const int destRank) const =0
Always blocking send of data from this process to another process.
RCP< CommRequest< Ordinal > > ireceive(const Comm< Ordinal > &comm, const RCP< Packet > &recv, const int sourceRank)
Receive one object (that uses values semantics) from another process.
RCP< CommRequest< Ordinal > > isend(const Comm< Ordinal > &comm, const Serializer &serializer, const ArrayRCP< const Packet > &sendBuffer, const int destRank)
Send objects that use values semantics to another process using customized serializer.
void scan(const Comm< Ordinal > &comm, const EReductionType reductType, const Ordinal count, const Packet sendBuffer[], Packet scanReducts[])
Scan/Reduce array of objects using value semantics using a predefined reduction type.
void broadcast(const Comm< Ordinal > &comm, const Serializer &serializer, const int rootRank, const Ordinal count, Packet buffer[])
Broadcast array of objects that use value semantics using customized serializer.
RCP< CommRequest< Ordinal > > isend(const Comm< Ordinal > &comm, const RCP< const Packet > &send, const int destRank)
Send a single object that use values semantics to another process.
void reduceAll(const Comm< Ordinal > &comm, const Serializer< Ordinal, Packet > &serializer, const ReferenceTypeReductionOp< Ordinal, Packet > &reductOp, const Ordinal count, const Packet *const sendBuffer[], Packet *const globalReducts[])
Collective reduce all for array of objects using reference semantics.
void broadcast(const Comm< Ordinal > &comm, const Serializer< Ordinal, Packet > &serializer, const int rootRank, const ArrayView< const Ptr< Packet > > &buffer)
Broadcast array of objects that use reference semantics.
RCP< CommRequest< Ordinal > > isend(const Comm< Ordinal > &comm, const ArrayRCP< const Packet > &sendBuffer, const int destRank)
Send objects that use values semantics to another process.
RCP< CommRequest< Ordinal > > ireceive(const Comm< Ordinal > &comm, const Serializer &serializer, const ArrayRCP< Packet > &recvBuffer, const int sourceRank)
Send objects that use values semantics to another process using customized serializer.
void scan(const Comm< Ordinal > &comm, const Serializer &serializer, const ValueTypeReductionOp< Ordinal, Packet > &reductOp, const Ordinal count, const Packet sendBuffer[], Packet scanReducts[])
Scan/Reduce array of objects that use value semantics using a user-defined reduction operator and cus...
void broadcast(const Comm< Ordinal > &comm, const int rootRank, const ArrayView< Packet > &buffer)
Broadcast array of objects that use value semantics.
void broadcast(const Comm< Ordinal > &comm, const int rootRank, const Ptr< Packet > &object)
Broadcast single object that use value semantics.
EReductionType
Predefined reduction operations that Teuchos::Comm understands.
void send(const Comm< Ordinal > &comm, const Serializer< Ordinal, Packet > &serializer, const Ordinal count, const Packet *const sendBuffer[], const int destRank)
Send objects that use reference semantics to another process.
int receive(const Comm< Ordinal > &comm, const int sourceRank, const Ordinal count, Packet recvBuffer[])
Receive objects that use values semantics from another process.
void scan(const Comm< Ordinal > &comm, const Serializer< Ordinal, Packet > &serializer, const ReferenceTypeReductionOp< Ordinal, Packet > &reductOp, const Ordinal count, const Packet *const sendBuffer[], Packet *const scanReducts[])
Scan/Reduce array of objects that use reference semantics using a user-defined reduction operator.
void readySend(const Comm< Ordinal > &comm, const Packet &send, const int destRank)
Ready-Send a single object that use values semantics to another process.
void send(const Comm< Ordinal > &comm, const Packet &send, const int destRank)
Send a single object that use values semantics to another process.
Encapsulate how an array of const objects with value sematics is serialized into a const char[] array...
Standard Max operator for types with value semantics.
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
Standard min operator for types with value semantics.
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
static void andOp(const Ordinal, const Packet[], Packet[])
static void andOp(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[])
static void max(const Ordinal, const Packet[], Packet[])
static void max(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[])
static void min(const Ordinal, const Packet[], Packet[])
static void min(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[])
Simple wrapper class for raw pointers to single objects where no persisting relationship exists.
Smart reference counting pointer class for automatic garbage collection.
Base interface class for user-defined reduction operations for objects that use reference semantics.
Strategy interface for the indirect serializing and deserializing objects of a given type handled usi...
Standard summation operator for types with value semantics.
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
Default traits class that just returns typeid(T).name().
Base interface class for user-defined reduction operations for objects that use value semantics.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
This macro is designed to be a short version of TEUCHOS_TEST_FOR_EXCEPTION() that is easier to call.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
Namespace of implementation details.
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)
void send< int, unsigned long long >(const Comm< int > &comm, const int count, const unsigned long long sendBuffer[], const int destRank)
void reduceAll< int, unsigned int >(const Comm< int > &comm, const EReductionType reductType, const int count, const unsigned int sendBuffer[], unsigned int globalReducts[])
RCP< Teuchos::CommRequest< int > > ireceive< int, double >(const Comm< int > &comm, const ArrayRCP< double > &recvBuffer, const int sourceRank)
void ssend(const Packet sendBuffer[], const Ordinal count, const int destRank, const int tag, const Comm< Ordinal > &comm)
Variant of ssend() that takes a tag (and restores the correct order of arguments).
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 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 gather< int, int >(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void send< int, double >(const Comm< int > &comm, const int count, const double 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)
void send< int, float >(const Comm< int > &comm, const int count, const float sendBuffer[], const int destRank)
void reduceAll< int, unsigned long >(const Comm< int > &comm, const EReductionType reductType, const int count, const unsigned long sendBuffer[], unsigned long globalReducts[])
TEUCHOSCOMM_LIB_DLL_EXPORT RCP< CommRequest< int > > isend< int, float >(const ArrayRCP< const float > &sendBuffer, const int destRank, const int tag, 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 reduceAll< int, double >(const Comm< int > &comm, const EReductionType reductType, const int count, const double sendBuffer[], double globalReducts[])
void readySend(const Packet sendBuffer[], const Ordinal count, const int destRank, const int tag, const Comm< Ordinal > &comm)
Variant of readySend() that accepts a message tag.
TEUCHOSCOMM_LIB_DLL_EXPORT RCP< CommRequest< int > > isend< int, double >(const ArrayRCP< const double > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
RCP< Teuchos::CommRequest< int > > isend(const ArrayRCP< const double > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
void send< int, unsigned int >(const Comm< int > &comm, const int count, const unsigned int sendBuffer[], const int destRank)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
void reduce< int, int >(const int sendBuf[], int recvBuf[], const int count, const EReductionType reductType, 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)
TEUCHOSCOMM_LIB_DLL_EXPORT void scatter(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCount, 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)
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[])
TEUCHOSCOMM_LIB_DLL_EXPORT RCP< CommRequest< int > > isend< int, unsigned long long >(const ArrayRCP< const unsigned long long > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
RCP< CommRequest< Ordinal > > ireceive(const ArrayRCP< Packet > &recvBuffer, const int sourceRank, const int tag, const Comm< Ordinal > &comm)
Variant of ireceive that takes a tag argument (and restores the correct order of arguments).
void reduceAll< int, long >(const Comm< int > &comm, const EReductionType reductType, const int count, const long sendBuffer[], long globalReducts[])
RawPointerConversionTraits< Container >::Ptr_t getRawPtr(const Container &c)
void send< int, long >(const Comm< int > &comm, const int count, const long sendBuffer[], const int destRank)
void reduceAll< int, float >(const Comm< int > &comm, const EReductionType reductType, const int count, const float sendBuffer[], float globalReducts[])
RCP< Teuchos::CommRequest< int > > ireceive< int, unsigned long >(const Comm< int > &comm, const ArrayRCP< unsigned long > &recvBuffer, const int sourceRank)
RCP< Teuchos::CommRequest< int > > ireceive< int, long >(const Comm< int > &comm, const ArrayRCP< long > &recvBuffer, const int sourceRank)
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)
@ REDUCE_AND
Logical AND.
void reduceAll< int, int >(const Comm< int > &comm, const EReductionType reductType, const int count, const int sendBuffer[], int globalReducts[])
RCP< Teuchos::CommRequest< int > > ireceive< int, unsigned long long >(const Comm< int > &comm, const ArrayRCP< unsigned long long > &recvBuffer, const int sourceRank)
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)
TEUCHOSCOMM_LIB_DLL_EXPORT RCP< CommRequest< int > > isend< int, unsigned long >(const ArrayRCP< const unsigned long > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
void reduceAll< int, short >(const Comm< int > &comm, const EReductionType reductType, const int count, const short sendBuffer[], short globalReducts[])
void reduce< int, double >(const double sendBuf[], double recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
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)
TEUCHOSCOMM_LIB_DLL_EXPORT RCP< CommRequest< int > > isend< int, long >(const ArrayRCP< const long > &sendBuffer, const int destRank, const int tag, 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)
TEUCHOSCOMM_LIB_DLL_EXPORT RCP< CommRequest< int > > isend< int, unsigned int >(const ArrayRCP< const unsigned int > &sendBuffer, const int destRank, const int tag, 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 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 gather< int, short >(const short sendBuf[], const int sendCount, short recvBuf[], const int recvCount, 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, short >(const Comm< int > &comm, const ArrayRCP< short > &recvBuffer, const int sourceRank)
void send< int, unsigned long >(const Comm< int > &comm, const int count, const unsigned long sendBuffer[], const int destRank)
ValueTypeReductionOp< Ordinal, Packet > * createOp(const EReductionType reductType)
void send< int, int >(const Comm< int > &comm, const int count, const int sendBuffer[], const int destRank)
void send< int, short >(const Comm< int > &comm, const int count, const short sendBuffer[], const int destRank)
TEUCHOSCOMM_LIB_DLL_EXPORT RCP< CommRequest< int > > isend< int, long long >(const ArrayRCP< const long long > &sendBuffer, const int destRank, const int tag, 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(const Packet sendBuffer[], const Ordinal count, const int destRank, const int tag, const Comm< Ordinal > &comm)
Variant of send() that takes a tag (and restores the correct order of arguments).
RCP< Teuchos::CommRequest< int > > ireceive< int, float >(const Comm< int > &comm, const ArrayRCP< float > &recvBuffer, const int sourceRank)
void send< int, long long >(const Comm< int > &comm, const int count, const long long sendBuffer[], const int destRank)
TEUCHOSCOMM_LIB_DLL_EXPORT RCP< CommRequest< int > > isend< int, short >(const ArrayRCP< const short > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
TEUCHOSCOMM_LIB_DLL_EXPORT RCP< CommRequest< int > > isend< int, int >(const ArrayRCP< const int > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
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 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, int >(const Comm< int > &comm, const ArrayRCP< int > &recvBuffer, const int sourceRank)
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)
This structure defines some basic traits for the ordinal field type.
This structure defines some basic traits for a scalar field type.