42 #ifndef TEUCHOS_COMM_HELPERS_HPP
43 #define TEUCHOS_COMM_HELPERS_HPP
57 #ifdef HAVE_TEUCHOS_MPI
59 #endif // HAVE_TEUCHOS_MPI
69 #ifdef HAVE_TEUCHOS_MPI
78 std::string getMpiErrorString (
const int errCode);
81 #endif // HAVE_TEUCHOS_MPI
87 template<
typename Ordinal>
88 int rank(
const Comm<Ordinal>& comm);
94 template<
typename Ordinal>
95 int size(
const Comm<Ordinal>& comm);
101 template<
typename Ordinal>
102 void barrier(
const Comm<Ordinal>& comm);
108 template<
typename Ordinal,
typename Packet>
110 const Comm<Ordinal>& comm,
112 const Ordinal count, Packet buffer[]
119 template<
typename Ordinal,
typename Packet>
121 const Comm<Ordinal>& comm,
123 const ArrayView<Packet> &buffer
130 template<
typename Ordinal,
typename Packet>
132 const Comm<Ordinal>& comm,
133 const int rootRank, Packet *
object
140 template<
typename Ordinal,
typename Packet>
142 const Comm<Ordinal>& comm,
143 const int rootRank,
const Ptr<Packet> &
object
150 template<
typename Ordinal,
typename Packet>
152 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
153 const int rootRank,
const Ordinal count, Packet*
const buffer[]
160 template<
typename Ordinal,
typename Packet>
162 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
163 const int rootRank,
const ArrayView<
const Ptr<Packet> > &buffer
171 template<
typename Ordinal,
typename Packet,
typename Serializer>
173 const Comm<Ordinal>& comm,
174 const Serializer& serializer,
176 const Ordinal count, Packet buffer[]
183 template<
typename Ordinal,
typename Packet>
185 gather (
const Packet sendBuf[],
186 const Ordinal sendCount,
188 const Ordinal recvCount,
190 const Comm<Ordinal>& comm);
196 template<
typename Ordinal,
typename Packet>
198 gatherv (
const Packet sendBuf[],
199 const Ordinal sendCount,
201 const Ordinal recvCounts[],
202 const Ordinal displs[],
204 const Comm<Ordinal>& comm);
211 template<
typename Ordinal,
typename Packet>
213 const Comm<Ordinal>& comm,
214 const Ordinal sendCount,
const Packet sendBuffer[],
215 const Ordinal recvCount, Packet recvBuffer[]
223 template<
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[]
235 template<
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[]
269 template<
typename Ordinal,
typename Packet>
272 const Ordinal sendCount,
274 const Ordinal recvCount,
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.");
316 template<
typename Ordinal,
typename Packet>
318 reduce (
const Packet sendBuf[],
347 template<
typename Ordinal,
typename Packet>
350 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
358 template<
typename Ordinal,
typename Packet>
361 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
369 template<
typename Ordinal,
typename Packet>
376 template<
typename Ordinal,
typename Packet>
379 const Packet &
send, Packet *globalReduct
382 reduceAll<Ordinal,Packet>(comm, reductType,
send, ptr(globalReduct));
390 template<
typename Ordinal,
typename Packet>
392 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
393 const ReferenceTypeReductionOp<Ordinal,Packet> &reductOp,
394 const Ordinal count,
const Packet*
const sendBuffer[], Packet*
const globalReducts[]
402 template<
typename Ordinal,
typename Packet,
typename Serializer>
404 const Comm<Ordinal>& comm,
405 const Serializer& serializer,
406 const ValueTypeReductionOp<Ordinal,Packet> &reductOp,
407 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
415 template<
typename Ordinal,
typename Packet,
typename Serializer>
417 const Comm<Ordinal>& comm,
418 const Serializer& serializer,
419 const EReductionType reductType,
420 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
428 template<
typename Ordinal,
typename Packet>
430 const Comm<Ordinal>& comm,
const ValueTypeReductionOp<Ordinal,Packet> &reductOp,
431 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
439 template<
typename Ordinal,
typename Packet>
441 const Comm<Ordinal>& comm,
const EReductionType reductType,
442 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
450 template<
typename Ordinal,
typename Packet>
452 const Comm<Ordinal>& comm,
const EReductionType reductType,
453 const Packet &
send,
const Ptr<Packet> &scanReduct
457 template<
typename Ordinal,
typename Packet>
460 const Packet &
send, Packet *scanReduct
463 scan(comm, reductType, send, ptr(scanReduct));
471 template<
typename Ordinal,
typename Packet>
473 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
474 const ReferenceTypeReductionOp<Ordinal,Packet> &reductOp,
475 const Ordinal count,
const Packet*
const sendBuffer[], Packet*
const scanReducts[]
483 template<
typename Ordinal,
typename Packet,
typename Serializer>
485 const Comm<Ordinal>& comm,
486 const Serializer& serializer,
487 const ValueTypeReductionOp<Ordinal,Packet> &reductOp,
488 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
496 template<
typename Ordinal,
typename Packet,
typename Serializer>
498 const Comm<Ordinal>& comm,
499 const Serializer& serializer,
500 const EReductionType reductType,
501 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
508 template<
typename Ordinal,
typename Packet>
510 const Comm<Ordinal>& comm,
511 const Ordinal count,
const Packet sendBuffer[],
const int destRank
515 template<
typename Ordinal,
typename Packet>
517 send (
const Packet sendBuffer[],
521 const Comm<Ordinal>& comm);
527 template<
typename Ordinal,
typename Packet>
529 const Comm<Ordinal>& comm,
530 const Ordinal count,
const Packet sendBuffer[],
const int destRank
534 template<
typename Ordinal,
typename Packet>
536 ssend (
const Packet sendBuffer[],
540 const Comm<Ordinal>& comm);
546 template<
typename Ordinal,
typename Packet>
548 const Comm<Ordinal>& comm,
549 const Packet &
send,
const int destRank
556 template<
typename Ordinal,
typename Packet>
558 const Comm<Ordinal>& comm,
559 const Packet &
send,
const int destRank
568 template<
typename Ordinal,
typename Packet>
570 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
571 const Ordinal count,
const Packet*
const sendBuffer[],
const int destRank
579 template<
typename Ordinal,
typename Packet,
typename Serializer>
581 const Comm<Ordinal>& comm,
582 const Serializer& serializer,
583 const Ordinal count,
const Packet sendBuffer[],
const int destRank
590 template<
typename Ordinal,
typename Packet>
592 const Comm<Ordinal>& comm,
593 const int sourceRank,
const Ordinal count, Packet recvBuffer[]
600 template<
typename Ordinal,
typename Packet>
602 const Comm<Ordinal>& comm,
603 const int sourceRank, Packet *recv
610 template<
typename Ordinal,
typename Packet>
612 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
613 const int sourceRank,
const Ordinal count, Packet*
const recvBuffer[]
621 template<
typename Ordinal,
typename Packet,
typename Serializer>
623 const Comm<Ordinal>& comm,
624 const Serializer& serializer,
625 const int sourceRank,
const Ordinal count, Packet recvBuffer[]
633 template<
typename Ordinal,
typename Packet>
635 const Comm<Ordinal>& comm,
636 const ArrayView<const Packet> &sendBuffer,
641 template<
typename Ordinal,
typename Packet>
647 const Comm<Ordinal>& comm);
653 template<
typename Ordinal,
typename Packet>
655 const Comm<Ordinal>& comm,
665 template<
typename Ordinal,
typename Packet,
typename Serializer>
667 const Comm<Ordinal>& comm,
668 const Serializer& serializer,
669 const ArrayView<const Packet> &sendBuffer,
677 template<
typename Ordinal,
typename Packet>
678 RCP<CommRequest<Ordinal> >
isend(
679 const Comm<Ordinal>& comm,
680 const ArrayRCP<const Packet> &sendBuffer,
685 template<
typename Ordinal,
typename Packet>
686 RCP<CommRequest<Ordinal> >
687 isend (
const ArrayRCP<const Packet>& sendBuffer,
690 const Comm<Ordinal>& comm);
696 template<
typename Ordinal,
typename Packet>
697 RCP<CommRequest<Ordinal> >
isend(
698 const Comm<Ordinal>& comm,
699 const RCP<const Packet> &
send,
708 template<
typename Ordinal,
typename Packet,
typename Serializer>
709 RCP<CommRequest<Ordinal> >
isend(
710 const Comm<Ordinal>& comm,
711 const Serializer& serializer,
712 const ArrayRCP<const Packet> &sendBuffer,
729 template<
typename Ordinal,
typename Packet>
730 RCP<CommRequest<Ordinal> >
ireceive(
731 const Comm<Ordinal>& comm,
732 const ArrayRCP<Packet> &recvBuffer,
737 template<
typename Ordinal,
typename Packet>
738 RCP<CommRequest<Ordinal> >
739 ireceive (
const ArrayRCP<Packet> &recvBuffer,
740 const int sourceRank,
742 const Comm<Ordinal>& comm);
755 template<
typename Ordinal,
typename Packet>
756 RCP<CommRequest<Ordinal> >
ireceive(
757 const Comm<Ordinal>& comm,
758 const RCP<Packet> &recv,
767 template<
typename Ordinal,
typename Packet,
typename Serializer>
768 RCP<CommRequest<Ordinal> >
ireceive(
769 const Comm<Ordinal>& comm,
770 const Serializer& serializer,
771 const ArrayRCP<Packet> &recvBuffer,
786 template<
typename Ordinal>
788 const Comm<Ordinal>& comm,
789 const ArrayView<RCP<CommRequest<Ordinal> > > &requests
821 template<
typename Ordinal>
823 waitAll (
const Comm<Ordinal>& comm,
824 const ArrayView<RCP<CommRequest<Ordinal> > >& requests,
825 const ArrayView<RCP<CommStatus<Ordinal> > >& statuses);
850 template<
typename Ordinal>
851 RCP<CommStatus<Ordinal> >
852 wait (
const Comm<Ordinal>& comm,
const Ptr<RCP<CommRequest<Ordinal> > >& request);
863 template<
typename Ordinal,
typename Packet>
870 const Packet inBuffer[],
884 template<
typename Ordinal,
typename Packet>
891 const Packet inBuffer[],
905 template<
typename Ordinal,
typename Packet>
912 const Packet inBuffer[],
922 template<
typename Ordinal,
typename Packet>
929 const Packet inBuffer[],
944 namespace MixMaxUtilities {
947 template<
bool isComparable,
typename Ordinal,
typename Packet>
951 template<
typename Ordinal,
typename Packet>
952 class Min<true,Ordinal,Packet> {
956 const Packet inBuffer[],
960 for(
int i = 0; i < count; ++i )
961 inoutBuffer[i] =
TEUCHOS_MIN(inoutBuffer[i],inBuffer[i]);
966 template<
typename Ordinal,
typename Packet>
967 class Min<false,Ordinal,Packet> {
976 true,std::logic_error,
978 <<
" does not support comparison operations!"
984 template<
bool isComparable,
typename Ordinal,
typename Packet>
988 template<
typename Ordinal,
typename Packet>
989 class Max<true,Ordinal,Packet> {
993 const Packet inBuffer[],
997 for(
int i = 0; i < count; ++i )
998 inoutBuffer[i] =
TEUCHOS_MAX(inoutBuffer[i],inBuffer[i]);
1003 template<
typename Ordinal,
typename Packet>
1004 class Max<false,Ordinal,Packet> {
1013 true,std::logic_error,
1015 <<
" does not support comparison operations!"
1021 template<
bool isComparable,
typename Ordinal,
typename Packet>
1025 template<
typename Ordinal,
typename Packet>
1026 class AND<true,Ordinal,Packet> {
1029 const Ordinal count,
1030 const Packet inBuffer[],
1031 Packet inoutBuffer[]
1034 for(
int i = 0; i < count; ++i )
1035 inoutBuffer[i] = inoutBuffer[i] && inBuffer[i];
1040 template<
typename Ordinal,
typename Packet>
1041 class AND<false,Ordinal,Packet> {
1050 true,std::logic_error,
1052 <<
" does not support logical AND operations!"
1061 template<
typename Ordinal,
typename Packet>
1063 const Ordinal count,
1064 const Packet inBuffer[],
1065 Packet inoutBuffer[]
1068 for(
int i = 0; i < count; ++i )
1069 inoutBuffer[i] += inBuffer[i];
1073 template<
typename Ordinal,
typename Packet>
1075 const Ordinal count,
1076 const Packet inBuffer[],
1077 Packet inoutBuffer[]
1081 min_type::min (count, inBuffer, inoutBuffer);
1085 template<
typename Ordinal,
typename Packet>
1087 const Ordinal count,
1088 const Packet inBuffer[],
1089 Packet inoutBuffer[]
1093 max_type::max (count,inBuffer,inoutBuffer);
1097 template<
typename Ordinal,
typename Packet>
1099 const Ordinal count,
1100 const Packet inBuffer[],
1101 Packet inoutBuffer[]
1105 and_type::andOp (count, inBuffer, inoutBuffer);
1135 template<
typename Ordinal,
typename Packet>
1136 ValueTypeReductionOp<Ordinal,Packet>*
1140 switch (reductType) {
1145 if (ST::isComparable) {
1150 (! ST::isComparable, std::invalid_argument,
"Teuchos::createOp"
1152 <<
" is not less-than comparable, so it does not make sense to do a "
1153 "MIN reduction with it.");
1157 if (ST::isComparable) {
1162 (! ST::isComparable, std::invalid_argument,
"Teuchos::createOp"
1164 <<
" is not less-than comparable, so it does not make sense to do a "
1165 "MAX reduction with it.");
1173 true, std::invalid_argument,
"Teuchos::createOp(EReductionType): "
1174 "Invalid EReductionType value " << reductType <<
". Valid values "
1175 "include REDUCE_SUM, REDUCE_MIN, REDUCE_MAX, and REDUCE_AND.");
1188 template<
typename Ordinal>
1189 int Teuchos::rank(
const Comm<Ordinal>& comm)
1191 return comm.getRank();
1195 template<
typename Ordinal>
1196 int Teuchos::size(
const Comm<Ordinal>& comm)
1198 return comm.getSize();
1202 template<
typename Ordinal>
1203 void Teuchos::barrier(
const Comm<Ordinal>& comm)
1206 "Teuchos::CommHelpers: barrier<"
1207 <<OrdinalTraits<Ordinal>::name()
1214 template<
typename Ordinal,
typename Packet>
1215 void Teuchos::broadcast(
1216 const Comm<Ordinal>& comm,
1217 const int rootRank,
const Ordinal count, Packet buffer[]
1221 "Teuchos::CommHelpers: broadcast<"
1222 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
1225 ValueTypeSerializationBuffer<Ordinal,Packet>
1226 charBuffer(count,buffer);
1228 rootRank,charBuffer.getBytes(),charBuffer.getCharBuffer()
1233 template<
typename Ordinal,
typename Packet>
1234 void Teuchos::broadcast(
1235 const Comm<Ordinal>& comm,
1237 const ArrayView<Packet> &buffer
1240 broadcast<Ordinal, Packet>(comm, rootRank, buffer.size(), buffer.getRawPtr() );
1244 template<
typename Ordinal,
typename Packet>
1245 void Teuchos::broadcast(
1246 const Comm<Ordinal>& comm,
1247 const int rootRank, Packet *
object
1250 broadcast<Ordinal,Packet>(comm,rootRank,1,object);
1254 template<
typename Ordinal,
typename Packet>
1255 void Teuchos::broadcast(
1256 const Comm<Ordinal>& comm,
1257 const int rootRank,
const Ptr<Packet> &
object
1260 broadcast<Ordinal,Packet>(comm,rootRank,1,
object.getRawPtr());
1264 template<
typename Ordinal,
typename Packet>
1265 void Teuchos::broadcast(
1266 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
1267 const int rootRank,
const Ordinal count, Packet*
const buffer[]
1271 "Teuchos::CommHelpers: broadcast<"
1272 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
1273 <<
">( reference type )"
1275 ReferenceTypeSerializationBuffer<Ordinal,Packet>
1276 charBuffer(serializer, count, buffer);
1278 rootRank,charBuffer.getBytes(),charBuffer.getCharBuffer()
1283 template<
typename Ordinal,
typename Packet>
1284 void Teuchos::broadcast(
1285 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
1286 const int rootRank,
const ArrayView<
const Ptr<Packet> > &buffer
1289 Array<Packet*> bufferPtrArray;
1290 for (
int i = 0; i < buffer.size(); ++i) {
1291 bufferPtrArray.push_back(buffer[i].
getRawPtr());
1293 broadcast<Ordinal,Packet>(comm, serializer, rootRank,
1294 buffer.size(), bufferPtrArray.getRawPtr());
1297 template<
typename Ordinal,
typename Packet,
typename Serializer>
1298 void Teuchos::broadcast(
1299 const Comm<Ordinal>& comm,
1300 const Serializer& serializer,
1301 const int rootRank,
const Ordinal count, Packet buffer[]
1305 "Teuchos::CommHelpers: broadcast<"
1306 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
1309 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
1310 charBuffer(count,buffer,
rcp(&serializer,
false));
1312 rootRank,charBuffer.getBytes(),charBuffer.getCharBuffer()
1317 template<
typename Ordinal,
typename Packet>
1318 void Teuchos::gatherAll(
1319 const Comm<Ordinal>& comm,
1320 const Ordinal sendCount,
const Packet sendBuffer[],
1321 const Ordinal recvCount, Packet recvBuffer[]
1325 "Teuchos::CommHelpers: gatherAll<"
1326 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
1329 ConstValueTypeSerializationBuffer<Ordinal,Packet>
1330 charSendBuffer(sendCount,sendBuffer);
1331 ValueTypeSerializationBuffer<Ordinal,Packet>
1332 charRecvBuffer(recvCount,recvBuffer);
1334 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
1335 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
1339 template<
typename Ordinal,
typename Packet>
1341 Teuchos::gather (
const Packet sendBuf[],
1342 const Ordinal sendCount,
1344 const Ordinal recvCount,
1346 const Comm<Ordinal>& comm)
1349 "Teuchos::CommHelpers: gather<"
1350 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
1353 ConstValueTypeSerializationBuffer<Ordinal,Packet>
1354 charSendBuffer (sendCount, sendBuf);
1355 ValueTypeSerializationBuffer<Ordinal,Packet>
1356 charRecvBuffer (recvCount, recvBuf);
1357 comm.gather (charSendBuffer.getBytes (),
1358 charSendBuffer.getCharBuffer (),
1359 charRecvBuffer.getBytes (),
1360 charRecvBuffer.getCharBuffer (),
1364 template<
typename Ordinal,
typename Packet>
1366 Teuchos::gatherv (
const Packet sendBuf[],
1367 const Ordinal sendCount,
1369 const Ordinal recvCounts[],
1370 const Ordinal displs[],
1372 const Comm<Ordinal>& comm)
1395 "Teuchos::gatherv: The general case is not implemented.");
1398 template<
typename Ordinal,
typename Packet>
1399 void Teuchos::gatherAll(
1400 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
1401 const Ordinal sendCount,
const Packet*
const sendBuffer[],
1402 const Ordinal recvCount, Packet*
const recvBuffer[]
1408 template<
typename Ordinal,
typename Packet,
typename Serializer>
1409 void Teuchos::gatherAll(
1410 const Comm<Ordinal>& comm,
1411 const Serializer& serializer,
1412 const Ordinal sendCount,
const Packet sendBuffer[],
1413 const Ordinal recvCount, Packet recvBuffer[]
1417 "Teuchos::CommHelpers: gatherAll<"
1418 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
1421 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
1422 charSendBuffer(sendCount,sendBuffer,
rcp(&serializer,
false));
1423 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
1424 charRecvBuffer(recvCount,recvBuffer,
rcp(&serializer,
false));
1426 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
1427 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
1432 template<
typename Ordinal,
typename Packet>
1434 Teuchos::reduce (
const Packet sendBuf[],
1436 const Ordinal count,
1439 const Comm<Ordinal>& comm)
1445 (
true, std::logic_error,
"Teuchos::reduce<" <<
1446 TypeNameTraits<Ordinal>::name () <<
"," << TypeNameTraits<Packet>::name ()
1447 <<
">: Generic version not implemented. We only implement this function "
1448 "for Ordinal = int and Packet = specific types.");
1452 template<
typename Ordinal,
typename Packet>
1454 const Comm<Ordinal>& comm,
const ValueTypeReductionOp<Ordinal,Packet> &reductOp
1455 ,
const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
1459 "Teuchos::CommHelpers: reduceAll<"
1460 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
1461 <<
">( value type, user-defined op )"
1463 ConstValueTypeSerializationBuffer<Ordinal,Packet>
1464 charSendBuffer(count,sendBuffer);
1465 ValueTypeSerializationBuffer<Ordinal,Packet>
1466 charGlobalReducts(count,globalReducts);
1467 CharToValueTypeReductionOp<Ordinal,Packet>
1468 charReductOp(
rcp(&reductOp,
false));
1470 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
1471 ,charGlobalReducts.getCharBuffer()
1476 template<
typename Ordinal,
typename Packet>
1479 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
1483 "Teuchos::CommHelpers: reduceAll<"
1484 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
1485 <<
">( value type, "<<
toString(reductType)<<
" )"
1488 ValueTypeReductionOp<Ordinal,Packet>* reductOp =
1489 createOp<Ordinal, Packet> (reductType);
1491 reduceAll(comm,*reductOp,count,sendBuffer,globalReducts);
1493 catch (std::exception& e) {
1509 #ifdef HAVE_TEUCHOS_COMPLEX
1513 reduceAll<int, std::complex<double> > (
const Comm<int>& comm,
1514 const EReductionType reductType,
1516 const std::complex<double> sendBuffer[],
1517 std::complex<double> globalReducts[]);
1520 ireceive<int, std::complex<double> > (
const Comm<int>& comm,
1521 const ArrayRCP<std::complex<double> >& recvBuffer,
1522 const int sourceRank);
1525 ireceive<int, std::complex<double> > (
const ArrayRCP<std::complex<double> > &recvBuffer,
1526 const int sourceRank,
1528 const Comm<int>& comm);
1531 send<int, std::complex<double> > (
const Comm<int>& comm,
1533 const std::complex<double> sendBuffer[],
1534 const int destRank);
1537 send<int, std::complex<double> > (
const std::complex<double> sendBuffer[],
1541 const Comm<int>& comm);
1544 isend<int, std::complex<double> > (
const ArrayRCP<const std::complex<double> >& sendBuffer,
1547 const Comm<int>& comm);
1552 reduceAll<int, std::complex<float> > (
const Comm<int>& comm,
1553 const EReductionType reductType,
1555 const std::complex<float> sendBuffer[],
1556 std::complex<float> globalReducts[]);
1559 ireceive<int, std::complex<float> > (
const Comm<int>& comm,
1560 const ArrayRCP<std::complex<float> >& recvBuffer,
1561 const int sourceRank);
1564 ireceive<int, std::complex<float> > (
const ArrayRCP<std::complex<float> > &recvBuffer,
1565 const int sourceRank,
1567 const Comm<int>& comm);
1570 send<int, std::complex<float> > (
const Comm<int>& comm,
1572 const std::complex<float> sendBuffer[],
1573 const int destRank);
1576 send<int, std::complex<float> > (
const std::complex<float> sendBuffer[],
1580 const Comm<int>& comm);
1583 isend<int, std::complex<float> > (
const ArrayRCP<const std::complex<float> >& sendBuffer,
1586 const Comm<int>& comm);
1587 #endif // HAVE_TEUCHOS_COMPLEX
1594 const EReductionType reductType,
1596 const double sendBuffer[],
1597 double globalReducts[]);
1601 const ArrayRCP<double>& recvBuffer,
1602 const int sourceRank);
1606 const int sourceRank,
1608 const Comm<int>& comm);
1613 const double sendBuffer[],
1614 const int destRank);
1621 const Comm<int>& comm);
1627 const Comm<int>& comm);
1633 const EReductionType reductType,
1635 const float sendBuffer[],
1636 float globalReducts[]);
1640 const ArrayRCP<float>& recvBuffer,
1641 const int sourceRank);
1645 const int sourceRank,
1647 const Comm<int>& comm);
1652 const float sendBuffer[],
1653 const int destRank);
1660 const Comm<int>& comm);
1666 const Comm<int>& comm);
1672 const int sendCount,
1673 long long recvBuf[],
1674 const int recvCount,
1676 const Comm<int>& comm);
1680 const int sendCount,
1681 long long recvBuf[],
1682 const int recvCounts[],
1685 const Comm<int>& comm);
1689 const EReductionType reductType,
1691 const long long sendBuffer[],
1692 long long globalReducts[]);
1696 const ArrayRCP<long long>& recvBuffer,
1697 const int sourceRank);
1701 const int sourceRank,
1703 const Comm<int>& comm);
1708 const long long sendBuffer[],
1709 const int destRank);
1716 const Comm<int>& comm);
1722 const Comm<int>& comm);
1728 const int sendCount,
1729 unsigned long long recvBuf[],
1730 const int recvCount,
1732 const Comm<int>& comm);
1736 const int sendCount,
1737 unsigned long long recvBuf[],
1738 const int recvCounts[],
1741 const Comm<int>& comm);
1745 const EReductionType reductType,
1747 const unsigned long long sendBuffer[],
1748 unsigned long long globalReducts[]);
1752 const ArrayRCP<unsigned long long>& recvBuffer,
1753 const int sourceRank);
1757 const int sourceRank,
1759 const Comm<int>& comm);
1764 const unsigned long long sendBuffer[],
1765 const int destRank);
1772 const Comm<int>& comm);
1778 const Comm<int>& comm);
1784 const int sendCount,
1786 const int recvCount,
1788 const Comm<int>& comm);
1792 const int sendCount,
1794 const int recvCounts[],
1797 const Comm<int>& comm);
1801 const EReductionType reductType,
1803 const long sendBuffer[],
1804 long globalReducts[]);
1808 const ArrayRCP<long>& recvBuffer,
1809 const int sourceRank);
1813 const int sourceRank,
1815 const Comm<int>& comm);
1820 const long sendBuffer[],
1821 const int destRank);
1828 const Comm<int>& comm);
1834 const Comm<int>& comm);
1840 const int sendCount,
1841 unsigned long recvBuf[],
1842 const int recvCount,
1844 const Comm<int>& comm);
1848 const int sendCount,
1849 unsigned long recvBuf[],
1850 const int recvCounts[],
1853 const Comm<int>& comm);
1857 const EReductionType reductType,
1859 const unsigned long sendBuffer[],
1860 unsigned long globalReducts[]);
1864 const ArrayRCP<unsigned long>& recvBuffer,
1865 const int sourceRank);
1869 const int sourceRank,
1871 const Comm<int>& comm);
1876 const unsigned long sendBuffer[],
1877 const int destRank);
1884 const Comm<int>& comm);
1890 const Comm<int>& comm);
1896 const int sendCount,
1898 const int recvCount,
1900 const Comm<int>& comm);
1904 const int sendCount,
1906 const int recvCounts[],
1909 const Comm<int>& comm);
1913 const int sendCount,
1915 const int recvCount,
1917 const Comm<int>& comm);
1923 const EReductionType reductType,
1925 const Comm<int>& comm);
1931 const EReductionType reductType,
1933 const Comm<int>& comm);
1937 unsigned long recvBuf[],
1939 const EReductionType reductType,
1941 const Comm<int>& comm);
1945 unsigned long long recvBuf[],
1947 const EReductionType reductType,
1949 const Comm<int>& comm);
1955 const EReductionType reductType,
1957 const Comm<int>& comm);
1961 const EReductionType reductType,
1963 const int sendBuffer[],
1964 int globalReducts[]);
1969 const ArrayRCP<int>& recvBuffer,
1970 const int sourceRank);
1974 const int sourceRank,
1976 const Comm<int>& comm);
1981 const int sendBuffer[],
1982 const int destRank);
1989 const Comm<int>& comm);
1995 const Comm<int>& comm);
2001 const int sendCount,
2002 unsigned int recvBuf[],
2003 const int recvCount,
2005 const Comm<int>& comm);
2009 const int sendCount,
2010 unsigned int recvBuf[],
2011 const int recvCounts[],
2014 const Comm<int>& comm);
2018 const EReductionType reductType,
2020 const unsigned int sendBuffer[],
2021 unsigned int globalReducts[]);
2025 const ArrayRCP<unsigned int>& recvBuffer,
2026 const int sourceRank);
2030 const int sourceRank,
2032 const Comm<int>& comm);
2037 const unsigned int sendBuffer[],
2038 const int destRank);
2045 const Comm<int>& comm);
2051 const Comm<int>& comm);
2057 const int sendCount,
2059 const int recvCount,
2061 const Comm<int>& comm);
2065 const int sendCount,
2067 const int recvCounts[],
2070 const Comm<int>& comm);
2074 const EReductionType reductType,
2076 const short sendBuffer[],
2077 short globalReducts[]);
2081 const ArrayRCP<short>& recvBuffer,
2082 const int sourceRank);
2086 const int sourceRank,
2088 const Comm<int>& comm);
2093 const short sendBuffer[],
2094 const int destRank);
2101 const Comm<int>& comm);
2107 const Comm<int>& comm);
2121 reduceAll<int, char> (
const Comm<int>& comm,
2122 const EReductionType reductType,
2124 const char sendBuffer[],
2125 char globalReducts[]);
2130 template<
typename Ordinal,
typename Packet>
2133 ,
const Packet &
send,
const Ptr<Packet> &globalReduct
2138 reduceAll<Ordinal,Packet>(comm, reductType, 1, &
send, &*globalReduct);
2142 template<
typename Ordinal,
typename Packet>
2144 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
2145 const ReferenceTypeReductionOp<Ordinal,Packet> &reductOp,
2146 const Ordinal count,
const Packet*
const sendBuffer[], Packet*
const globalReducts[]
2150 "Teuchos::CommHelpers: reduceAll<"
2151 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2152 <<
">( reference type )"
2154 ConstReferenceTypeSerializationBuffer<Ordinal,Packet>
2155 charSendBuffer(serializer,count,sendBuffer);
2156 ReferenceTypeSerializationBuffer<Ordinal,Packet>
2157 charGlobalReducts(serializer,count,globalReducts);
2158 CharToReferenceTypeReductionOp<Ordinal,Packet>
2159 charReductOp(
rcp(&serializer,
false),
rcp(&reductOp,
false));
2161 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2162 ,charGlobalReducts.getCharBuffer()
2166 template<
typename Ordinal,
typename Packet,
typename Serializer>
2168 const Comm<Ordinal>& comm,
2169 const Serializer& serializer,
2170 const ValueTypeReductionOp<Ordinal,Packet> &reductOp,
2171 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
2175 "Teuchos::CommHelpers: reduceAll<"
2176 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2177 <<
">( value type, user-defined op )"
2179 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2180 charSendBuffer(count,sendBuffer,
rcp(&serializer,
false));
2181 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2182 charGlobalReducts(count,globalReducts,
rcp(&serializer,
false));
2183 CharToValueTypeReductionOp<Ordinal,Packet,Serializer>
2184 charReductOp(
rcp(&reductOp,
false),
rcp(&serializer,
false));
2186 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2187 ,charGlobalReducts.getCharBuffer()
2192 template<
typename Ordinal,
typename Packet,
typename Serializer>
2194 const Comm<Ordinal>& comm,
2195 const Serializer& serializer,
2197 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
2201 "Teuchos::CommHelpers: reduceAll<"
2202 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2203 <<
">( value type, "<<
toString(reductType)<<
" )"
2206 ValueTypeReductionOp<Ordinal,Packet>* reductOp =
2207 createOp<Ordinal, Packet> (reductType);
2209 reduceAll(comm,serializer,*reductOp,count,sendBuffer,globalReducts);
2211 catch (std::exception& e) {
2219 template<
typename Ordinal,
typename Packet>
2221 const Comm<Ordinal>& comm,
const ValueTypeReductionOp<Ordinal,Packet> &reductOp,
2222 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
2226 "Teuchos::CommHelpers: scan<"
2227 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2228 <<
">( value type, user-defined op )"
2230 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2231 charSendBuffer(count,sendBuffer);
2232 ValueTypeSerializationBuffer<Ordinal,Packet>
2233 charScanReducts(count,scanReducts);
2234 CharToValueTypeReductionOp<Ordinal,Packet>
2235 charReductOp(
rcp(&reductOp,
false));
2237 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2238 ,charScanReducts.getCharBuffer()
2243 template<
typename Ordinal,
typename Packet>
2246 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
2250 "Teuchos::CommHelpers: scan<"
2251 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2252 <<
">( value type, "<<
toString(reductType)<<
" )"
2255 ValueTypeReductionOp<Ordinal,Packet>* reductOp =
2256 createOp<Ordinal, Packet> (reductType);
2258 scan(comm,*reductOp,count,sendBuffer,scanReducts);
2260 catch (std::exception& e) {
2268 template<
typename Ordinal,
typename Packet>
2271 const Packet &
send,
const Ptr<Packet> &scanReduct
2274 scan<Ordinal,Packet>(comm, reductType, 1, &
send, &*scanReduct);
2278 template<
typename Ordinal,
typename Packet>
2280 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
2281 const ReferenceTypeReductionOp<Ordinal,Packet> &reductOp,
2282 const Ordinal count,
const Packet*
const sendBuffer[], Packet*
const scanReducts[]
2288 template<
typename Ordinal,
typename Packet,
typename Serializer>
2290 const Comm<Ordinal>& comm,
2291 const Serializer& serializer,
2292 const ValueTypeReductionOp<Ordinal,Packet> &reductOp,
2293 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
2297 "Teuchos::CommHelpers: scan<"
2298 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2299 <<
">( value type, user-defined op )"
2301 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2302 charSendBuffer(count,sendBuffer,
rcp(&serializer,
false));
2303 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2304 charScanReducts(count,scanReducts,
rcp(&serializer,
false));
2305 CharToValueTypeReductionOp<Ordinal,Packet,Serializer>
2306 charReductOp(
rcp(&reductOp,
false),
rcp(&serializer,
false));
2308 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2309 ,charScanReducts.getCharBuffer()
2314 template<
typename Ordinal,
typename Packet,
typename Serializer>
2316 const Comm<Ordinal>& comm,
2317 const Serializer& serializer,
2319 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
2323 "Teuchos::CommHelpers: scan<"
2324 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2325 <<
">( value type, "<<
toString(reductType)<<
" )"
2328 ValueTypeReductionOp<Ordinal,Packet>* reductOp =
2329 createOp<Ordinal, Packet> (reductType);
2331 scan(comm,serializer,*reductOp,count,sendBuffer,scanReducts);
2333 catch (std::exception& e) {
2340 template<
typename Ordinal,
typename Packet>
2342 const Comm<Ordinal>& comm,
2343 const Ordinal count,
const Packet sendBuffer[],
const int destRank
2347 "Teuchos::CommHelpers: send<"
2348 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2351 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2352 charSendBuffer(count,sendBuffer);
2354 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2359 template<
typename Ordinal,
typename Packet>
2362 const Ordinal count,
2368 "Teuchos::CommHelpers: send<"
2373 comm.
send (charSendBuffer.getBytes (), charSendBuffer.getCharBuffer (), destRank, tag);
2376 template<
typename Ordinal,
typename Packet>
2378 const Comm<Ordinal>& comm,
2379 const Ordinal count,
const Packet sendBuffer[],
const int destRank
2383 "Teuchos::CommHelpers: ssend<"
2384 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2387 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2388 charSendBuffer(count,sendBuffer);
2390 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2395 template<
typename Ordinal,
typename Packet>
2398 const Ordinal count,
2404 "Teuchos::CommHelpers: ssend<"
2409 buf_type charSendBuffer (count, sendBuffer);
2410 comm.
ssend (charSendBuffer.getBytes (),
2411 charSendBuffer.getCharBuffer (),
2415 template<
typename Ordinal,
typename Packet>
2417 const Comm<Ordinal>& comm,
2418 const Packet &
send,
const int destRank
2421 Teuchos::send<Ordinal,Packet>(comm,1,&
send,destRank);
2424 template<
typename Ordinal,
typename Packet>
2426 const Comm<Ordinal>& comm,
2427 const Packet &
send,
const int destRank
2430 Teuchos::ssend<Ordinal,Packet>(comm,1,&
send,destRank);
2433 template<
typename Ordinal,
typename Packet>
2435 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
2436 const Ordinal count,
const Packet*
const sendBuffer[],
const int destRank
2442 template<
typename Ordinal,
typename Packet,
typename Serializer>
2444 const Comm<Ordinal>& comm,
2445 const Serializer& serializer,
2446 const Ordinal count,
const Packet sendBuffer[],
const int destRank
2450 "Teuchos::CommHelpers: send<"
2451 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2454 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2455 charSendBuffer(count,sendBuffer,
rcp(&serializer,
false));
2457 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2462 template<
typename Ordinal,
typename Packet>
2463 int Teuchos::receive(
2464 const Comm<Ordinal>& comm,
2465 const int sourceRank,
const Ordinal count, Packet recvBuffer[]
2469 "Teuchos::CommHelpers: receive<"
2470 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2473 ValueTypeSerializationBuffer<Ordinal,Packet>
2474 charRecvBuffer(count,recvBuffer);
2475 return comm.receive(
2477 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
2482 template<
typename Ordinal,
typename Packet>
2483 int Teuchos::receive(
2484 const Comm<Ordinal>& comm,
2485 const int sourceRank, Packet *recv
2488 return Teuchos::receive<Ordinal,Packet>(comm,sourceRank,1,recv);
2492 template<
typename Ordinal,
typename Packet>
2493 int Teuchos::receive(
2494 const Comm<Ordinal>& comm,
const Serializer<Ordinal,Packet> &serializer,
2495 const int sourceRank,
const Ordinal count, Packet*
const recvBuffer[]
2501 template<
typename Ordinal,
typename Packet,
typename Serializer>
2502 int Teuchos::receive(
2503 const Comm<Ordinal>& comm,
2504 const Serializer& serializer,
2505 const int sourceRank,
const Ordinal count, Packet recvBuffer[]
2509 "Teuchos::CommHelpers: receive<"
2510 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2513 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2514 charRecvBuffer(count,recvBuffer,
rcp(&serializer,
false));
2515 return comm.receive(
2517 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
2521 template<
typename Ordinal,
typename Packet>
2523 const Comm<Ordinal>& comm,
2524 const ArrayView<const Packet> &sendBuffer,
2529 "Teuchos::CommHelpers: readySend<"
2530 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2533 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2534 charSendBuffer(sendBuffer.size(), sendBuffer.getRawPtr());
2535 comm.readySend( charSendBuffer.getCharBufferView(), destRank );
2538 template<
typename Ordinal,
typename Packet>
2541 const Ordinal count,
2547 "Teuchos::CommHelpers: readySend<"
2552 buf_type charSendBuffer (count, sendBuffer);
2553 comm.
readySend (charSendBuffer.getBytes (),
2554 charSendBuffer.getCharBuffer (),
2558 template<
typename Ordinal,
typename Packet>
2560 const Comm<Ordinal>& comm,
2565 readySend<Ordinal, Packet>( comm,
arrayView(&send,1), destRank );
2568 template<
typename Ordinal,
typename Packet,
typename Serializer>
2570 const Comm<Ordinal>& comm,
2571 const Serializer& serializer,
2572 const ArrayView<const Packet> &sendBuffer,
2577 "Teuchos::CommHelpers: readySend<"
2578 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2581 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2582 charSendBuffer(sendBuffer.size(), sendBuffer.getRawPtr(), serializer);
2583 comm.readySend( charSendBuffer.getCharBufferView(), destRank );
2586 template<
typename Ordinal,
typename Packet>
2589 const Comm<Ordinal>& comm,
2590 const ArrayRCP<const Packet> &sendBuffer,
2595 "Teuchos::CommHelpers: isend<"
2596 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2599 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2600 charSendBuffer(sendBuffer.size(), sendBuffer.getRawPtr());
2601 RCP<CommRequest<Ordinal> > commRequest = comm.isend(
2602 charSendBuffer.getCharBufferView(), destRank );
2607 template<
typename Ordinal,
typename Packet>
2612 const Comm<Ordinal>& comm)
2615 "Teuchos::isend<" << OrdinalTraits<Ordinal>::name () <<
","
2616 << TypeNameTraits<Packet>::name () <<
">");
2617 ConstValueTypeSerializationBuffer<Ordinal,Packet>
2618 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
2619 RCP<CommRequest<Ordinal> > commRequest =
2620 comm.isend (charSendBuffer.getCharBufferView (), destRank, tag);
2625 template<
typename Ordinal,
typename Packet>
2628 const Comm<Ordinal>& comm,
2629 const RCP<const Packet> &
send,
2633 const ArrayRCP<const Packet> sendBuffer =
2637 return isend<Ordinal, Packet>( comm, sendBuffer, destRank );
2640 template<
typename Ordinal,
typename Packet,
typename Serializer>
2643 const Comm<Ordinal>& comm,
2644 const Serializer& serializer,
2645 const ArrayRCP<const Packet> &sendBuffer,
2650 "Teuchos::CommHelpers: isend<"
2651 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2654 ConstValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2655 charSendBuffer(sendBuffer.size(), sendBuffer.getRawPtr(), serializer);
2656 RCP<CommRequest<Ordinal> > commRequest = comm.isend(
2657 charSendBuffer.getCharBufferView(), destRank );
2662 template<
typename Ordinal,
typename Packet>
2665 const Comm<Ordinal>& comm,
2666 const ArrayRCP<Packet> &recvBuffer,
2667 const int sourceRank
2671 "Teuchos::ireceive<int, " <<
"," << TypeNameTraits<Packet>::name () <<
">");
2672 ValueTypeSerializationBuffer<Ordinal,Packet>
2673 charRecvBuffer(recvBuffer.size(), recvBuffer.getRawPtr());
2674 RCP<CommRequest<Ordinal> > commRequest = comm.ireceive(
2675 charRecvBuffer.getCharBufferView(), sourceRank );
2680 template<
typename Ordinal,
typename Packet>
2683 const int sourceRank,
2688 "Teuchos::ireceive<int, " <<
"," << TypeNameTraits<Packet>::name () <<
">");
2689 ValueTypeSerializationBuffer<int, Packet>
2690 charRecvBuffer (recvBuffer.
size (), recvBuffer.
getRawPtr ());
2691 RCP<CommRequest<int> > commRequest =
2692 comm.
ireceive (charRecvBuffer.getCharBufferView (), sourceRank, tag);
2697 template<
typename Ordinal,
typename Packet>
2700 const Comm<Ordinal>& comm,
2701 const RCP<Packet> &recv,
2702 const int sourceRank
2705 const ArrayRCP<Packet> recvBuffer =
2709 return ireceive<Ordinal, Packet>( comm, recvBuffer, sourceRank );
2712 template<
typename Ordinal,
typename Packet,
typename Serializer>
2715 const Comm<Ordinal>& comm,
2716 const Serializer& serializer,
2717 const ArrayRCP<Packet> &recvBuffer,
2718 const int sourceRank
2722 "Teuchos::CommHelpers: ireceive<"
2723 <<OrdinalTraits<Ordinal>::name()<<
","<<TypeNameTraits<Packet>::name()
2726 ValueTypeSerializationBuffer<Ordinal,Packet,Serializer>
2727 charRecvBuffer(recvBuffer.size(), recvBuffer.getRawPtr(), serializer);
2728 RCP<CommRequest<Ordinal> > commRequest = comm.ireceive(
2729 charRecvBuffer.getCharBufferView(), sourceRank );
2734 template<
typename Ordinal>
2735 void Teuchos::waitAll(
2736 const Comm<Ordinal>& comm,
2737 const ArrayView<RCP<CommRequest<Ordinal> > > &requests
2740 comm.waitAll(requests);
2744 template<
typename Ordinal>
2746 Teuchos::waitAll (
const Comm<Ordinal>& comm,
2747 const ArrayView<RCP<CommRequest<Ordinal> > >& requests,
2748 const ArrayView<RCP<CommStatus<Ordinal> > >& statuses)
2750 comm.waitAll (requests, statuses);
2754 template<
typename Ordinal>
2756 Teuchos::wait (
const Comm<Ordinal>& comm,
2757 const Ptr<RCP<CommRequest<Ordinal> > > &request)
2759 return comm.wait (request);
2763 #endif // TEUCHOS_COMM_HELPERS_HPP
void reduce< int, unsigned long >(const unsigned long sendBuf[], unsigned long recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
void reduce< int, long >(const long sendBuf[], long recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
RCP< T > rcp(const boost::shared_ptr< T > &sptr)
Conversion function that takes in a boost::shared_ptr object and spits out a Teuchos::RCP object...
ArrayView< T > arrayView(T *p, typename ArrayView< T >::size_type size)
Construct a const or non-const view to const or non-const data.
RCP< Teuchos::CommRequest< int > > ireceive< int, unsigned long long >(const Comm< int > &comm, const ArrayRCP< unsigned long long > &recvBuffer, const int sourceRank)
void set_extra_data(const T1 &extra_data, const std::string &name, const Ptr< ArrayRCP< T2 > > &p, EPrePostDestruction destroy_when=POST_DESTROY, bool force_unique=true)
Set extra data associated with a ArrayRCP object.
Ptr< T > inOutArg(T &arg)
create a non-persisting (required or optional) input/output argument for a function call...
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
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 send< int, float >(const Comm< int > &comm, const int count, const float sendBuffer[], const int destRank)
EReductionType
Predefined reduction operations that Teuchos::Comm understands.
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)
RCP< Teuchos::CommRequest< int > > ireceive< int, float >(const Comm< int > &comm, const ArrayRCP< float > &recvBuffer, const int sourceRank)
static void max(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[])
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)
void gatherv< int, short >(const short sendBuf[], const int sendCount, short recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
void gather< int, unsigned long long >(const unsigned long long sendBuf[], const int sendCount, unsigned long long recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
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)
void reduceAll< int, long >(const Comm< int > &comm, const EReductionType reductType, const int count, const long sendBuffer[], long globalReducts[])
void send< int, unsigned long long >(const Comm< int > &comm, const int count, const unsigned long long sendBuffer[], const int destRank)
RCP< Teuchos::CommRequest< int > > ireceive< int, double >(const Comm< int > &comm, const ArrayRCP< double > &recvBuffer, const int sourceRank)
RCP< Teuchos::CommRequest< int > > ireceive< int, short >(const Comm< int > &comm, const ArrayRCP< short > &recvBuffer, const int sourceRank)
void send< int, long >(const Comm< int > &comm, const int count, const long sendBuffer[], const int destRank)
void gather< int, unsigned int >(const unsigned int sendBuf[], const int sendCount, unsigned int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
static void andOp(const Ordinal, const Packet[], Packet[])
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
void reduce< int, double >(const double sendBuf[], double recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
T * getRawPtr() const
Get the raw C++ pointer to the underlying object.
RawPointerConversionTraits< Container >::Ptr_t getRawPtr(const Container &c)
void gatherv< int, int >(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
TEUCHOSCOMM_LIB_DLL_EXPORT RCP< CommRequest< int > > isend< int, double >(const ArrayRCP< const double > &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 gather< int, long >(const long sendBuf[], const int sendCount, long recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
RCP< Teuchos::CommRequest< int > > ireceive< int, long long >(const Comm< int > &comm, const ArrayRCP< long long > &recvBuffer, const int sourceRank)
void send< int, int >(const Comm< int > &comm, const int count, const int sendBuffer[], const int destRank)
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
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 send< int, double >(const Comm< int > &comm, const int count, const double sendBuffer[], const int destRank)
void gather< int, int >(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
size_type size() const
The total number of entries in the array.
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)
Standard logical AND operator for booleans.
#define TEUCHOS_COMM_TIME_MONITOR(FUNCNAME)
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.
Standard min operator for types with value semantics.
This structure defines some basic traits for a scalar field type.
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.
std::string toString(const any &rhs)
Converts the value in any to a std::string.
Standard summation operator for types with value semantics.
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)
static void andOp(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[])
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
void reduceAll< int, unsigned int >(const Comm< int > &comm, const EReductionType reductType, const int count, const unsigned int sendBuffer[], unsigned int globalReducts[])
void send< int, long long >(const Comm< int > &comm, const int count, const long long sendBuffer[], const int destRank)
void reduceAll< int, short >(const Comm< int > &comm, const EReductionType reductType, const int count, const short sendBuffer[], short globalReducts[])
void reduce< int, unsigned long long >(const unsigned long long sendBuf[], unsigned long long recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
static void min(const Ordinal, const Packet[], Packet[])
void reduce< int, int >(const int sendBuf[], int recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
virtual RCP< CommRequest< Ordinal > > ireceive(const ArrayView< char > &recvBuffer, const int sourceRank) const =0
Non-blocking receive.
void send(const Comm< Ordinal > &comm, const Ordinal count, const Packet sendBuffer[], const int destRank)
Send objects that use values semantics to another process.
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)
void reduceAll< int, double >(const Comm< int > &comm, const EReductionType reductType, const int count, const double sendBuffer[], double globalReducts[])
TEUCHOS_DEPRECATED void scan(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *scanReduct)
Deprecated.
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 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)
Standard Max operator for types with value semantics.
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)
Implementation of Teuchos wrappers for MPI.
Declaration of Teuchos::EReductionType enum, and related functions.
This structure defines some basic traits for the ordinal field type.
TEUCHOS_DEPRECATED void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *globalReduct)
Deprecated .
#define TEUCHOS_MAX(x, y)
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). ...
void reduceAll< int, int >(const Comm< int > &comm, const EReductionType reductType, const int count, const int sendBuffer[], int globalReducts[])
void reduceAll< int, unsigned long long >(const Comm< int > &comm, const EReductionType reductType, const int count, const unsigned long long sendBuffer[], unsigned long long globalReducts[])
void gatherv< int, unsigned int >(const unsigned int sendBuf[], const int sendCount, unsigned int recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
virtual void readySend(const ArrayView< const char > &sendBuffer, const int destRank) const =0
Ready send of data from this process to another process.
RCP< Teuchos::CommRequest< int > > ireceive< int, unsigned int >(const Comm< int > &comm, const ArrayRCP< unsigned int > &recvBuffer, const int sourceRank)
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 reduceAll< int, unsigned long >(const Comm< int > &comm, const EReductionType reductType, const int count, const unsigned long sendBuffer[], unsigned long globalReducts[])
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).
RCP< Teuchos::CommRequest< int > > ireceive< int, int >(const Comm< int > &comm, const ArrayRCP< int > &recvBuffer, const int sourceRank)
Templated array class derived from the STL std::vector.
RCP< Teuchos::CommRequest< int > > ireceive< int, unsigned long >(const Comm< int > &comm, const ArrayRCP< unsigned long > &recvBuffer, const int sourceRank)
Defines basic traits for the ordinal field type.
Default traits class that just returns typeid(T).name().
RCP< Teuchos::CommRequest< int > > isend(const ArrayRCP< const double > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
void reduceAll< int, float >(const Comm< int > &comm, const EReductionType reductType, const int count, const float sendBuffer[], float globalReducts[])
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
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.
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.
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).
Defines basic traits for the scalar field type.
#define TEUCHOSCOMM_LIB_DLL_EXPORT
TEUCHOSCOMM_LIB_DLL_EXPORT void scatter(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
ArrayRCP< T > arcpWithEmbeddedObj(T *p, typename ArrayRCP< T >::size_type lowerOffset, typename ArrayRCP< T >::size_type size, const Embedded &embedded, bool owns_mem=true)
Create an ArrayRCP with and also put in an embedded object.
static void max(const Ordinal, const Packet[], Packet[])
Smart reference counting pointer class for automatic garbage collection.
RCP< Teuchos::CommRequest< int > > ireceive< int, long >(const Comm< int > &comm, const ArrayRCP< long > &recvBuffer, const int sourceRank)
void gather< int, short >(const short sendBuf[], const int sendCount, short recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
#define TEUCHOS_MIN(x, y)
void send< int, short >(const Comm< int > &comm, const int count, const short sendBuffer[], const int destRank)
Defines basic traits returning the name of a type in a portable and readable way. ...
Definition of Teuchos::as, for conversions between types.
ValueTypeReductionOp< Ordinal, Packet > * createOp(const EReductionType reductType)
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.
#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...
Simple wrapper class for raw pointers to single objects where no persisting relationship exists...
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...
void gather< int, unsigned long >(const unsigned long sendBuf[], const int sendCount, unsigned long recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void reduceAll< int, long long >(const Comm< int > &comm, const EReductionType reductType, const int count, const long long sendBuffer[], long long globalReducts[])
Encapsulate how an array of const objects with value sematics is serialized into a const char[] array...
void send< int, unsigned long >(const Comm< int > &comm, const int count, const unsigned long sendBuffer[], const int destRank)
static void min(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[])
Reference-counted smart pointer for managing arrays.
void send< int, unsigned int >(const Comm< int > &comm, const int count, const unsigned int sendBuffer[], const int destRank)