42 #ifndef TEUCHOS_COMM_HELPERS_HPP 43 #define TEUCHOS_COMM_HELPERS_HPP 45 #include "Teuchos_Comm.hpp" 46 #include "Teuchos_CommUtilities.hpp" 47 #include "Teuchos_SerializationTraitsHelpers.hpp" 48 #include "Teuchos_ReductionOpHelpers.hpp" 49 #include "Teuchos_SerializerHelpers.hpp" 54 #include "Teuchos_Workspace.hpp" 60 #include "Teuchos_DefaultSerialComm.hpp" 86 const char* toString (
const EReductionType reductType);
92 template<
typename Ordinal>
99 template<
typename Ordinal>
106 template<
typename Ordinal>
113 template<
typename Ordinal,
typename Packet>
117 const Ordinal count, Packet buffer[]
124 template<
typename Ordinal,
typename Packet>
135 template<
typename Ordinal,
typename Packet>
138 const int rootRank, Packet *
object 145 template<
typename Ordinal,
typename Packet>
155 template<
typename Ordinal,
typename Packet>
158 const int rootRank,
const Ordinal count, Packet*
const buffer[]
165 template<
typename Ordinal,
typename Packet>
176 template<
typename Ordinal,
typename Packet,
typename Serializer>
181 const Ordinal count, Packet buffer[]
188 template<
typename Ordinal,
typename Packet>
190 gather (
const Packet sendBuf[],
191 const Ordinal sendCount,
193 const Ordinal recvCount,
201 template<
typename Ordinal,
typename Packet>
203 gatherv (
const Packet sendBuf[],
204 const Ordinal sendCount,
206 const Ordinal recvCounts[],
207 const Ordinal displs[],
216 template<
typename Ordinal,
typename Packet>
219 const Ordinal sendCount,
const Packet sendBuffer[],
220 const Ordinal recvCount, Packet recvBuffer[]
228 template<
typename Ordinal,
typename Packet>
231 const Ordinal sendCount,
const Packet*
const sendBuffer[],
232 const Ordinal recvCount, Packet*
const recvBuffer[]
240 template<
typename Ordinal,
typename Packet,
typename Serializer>
244 const Ordinal sendCount,
const Packet sendBuffer[],
245 const Ordinal recvCount, Packet recvBuffer[]
274 template<
typename Ordinal,
typename Packet>
277 const Ordinal sendCount,
279 const Ordinal recvCount,
287 (
true, std::logic_error,
"Teuchos::scatter<" <<
289 <<
">: Generic version is not yet implemented. This function currently " 290 "only has an implementtion for Ordinal = int and Packet = int. " 291 "See Bug 6375 and Bug 6336.");
321 template<
typename Ordinal,
typename Packet>
323 reduce (
const Packet sendBuf[],
352 template<
typename Ordinal,
typename Packet>
355 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
363 template<
typename Ordinal,
typename Packet>
366 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
374 template<
typename Ordinal,
typename Packet>
381 template<
typename Ordinal,
typename Packet>
384 const Packet &send, Packet *globalReduct
387 reduceAll<Ordinal,Packet>(comm, reductType,
send, ptr(globalReduct));
395 template<
typename Ordinal,
typename Packet>
399 const Ordinal count,
const Packet*
const sendBuffer[], Packet*
const globalReducts[]
407 template<
typename Ordinal,
typename Packet,
typename Serializer>
412 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
420 template<
typename Ordinal,
typename Packet,
typename Serializer>
424 const EReductionType reductType,
425 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
436 template<
typename Ordinal,
typename Packet>
437 TEUCHOS_DEPRECATED
void 438 reduceAllAndScatter (
440 const Ordinal sendCount,
const Packet sendBuffer[] ,
441 const Ordinal recvCounts[], Packet myGlobalReducts[]
453 template<
typename Ordinal,
typename Packet>
454 TEUCHOS_DEPRECATED
void 457 const Ordinal sendCount,
const Packet sendBuffer[] ,
458 const Ordinal recvCounts[], Packet myGlobalReducts[]
471 template<
typename Ordinal,
typename Packet>
472 TEUCHOS_DEPRECATED
void 476 const Ordinal sendCount,
const Packet*
const sendBuffer[] ,
477 const Ordinal recvCounts[], Packet*
const myGlobalReducts[]
489 template<
typename Ordinal,
typename Packet,
typename Serializer>
490 TEUCHOS_DEPRECATED
void 495 const Ordinal sendCount,
const Packet sendBuffer[],
496 const Ordinal recvCounts[], Packet myGlobalReducts[]
508 template<
typename Ordinal,
typename Packet,
typename Serializer>
509 TEUCHOS_DEPRECATED
void 513 const EReductionType reductType,
514 const Ordinal sendCount,
const Packet sendBuffer[] ,
515 const Ordinal recvCounts[], Packet myGlobalReducts[]
523 template<
typename Ordinal,
typename Packet>
526 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
534 template<
typename Ordinal,
typename Packet>
537 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
545 template<
typename Ordinal,
typename Packet>
552 template<
typename Ordinal,
typename Packet>
555 const Packet &send, Packet *scanReduct
558 scan(comm, reductType, send, ptr(scanReduct));
566 template<
typename Ordinal,
typename Packet>
570 const Ordinal count,
const Packet*
const sendBuffer[], Packet*
const scanReducts[]
578 template<
typename Ordinal,
typename Packet,
typename Serializer>
583 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
591 template<
typename Ordinal,
typename Packet,
typename Serializer>
595 const EReductionType reductType,
596 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
603 template<
typename Ordinal,
typename Packet>
606 const Ordinal count,
const Packet sendBuffer[],
const int destRank
610 template<
typename Ordinal,
typename Packet>
612 send (
const Packet sendBuffer[],
622 template<
typename Ordinal,
typename Packet>
625 const Ordinal count,
const Packet sendBuffer[],
const int destRank
629 template<
typename Ordinal,
typename Packet>
631 ssend (
const Packet sendBuffer[],
641 template<
typename Ordinal,
typename Packet>
644 const Packet &send,
const int destRank
651 template<
typename Ordinal,
typename Packet>
654 const Packet &send,
const int destRank
663 template<
typename Ordinal,
typename Packet>
666 const Ordinal count,
const Packet*
const sendBuffer[],
const int destRank
674 template<
typename Ordinal,
typename Packet,
typename Serializer>
678 const Ordinal count,
const Packet sendBuffer[],
const int destRank
685 template<
typename Ordinal,
typename Packet>
688 const int sourceRank,
const Ordinal count, Packet recvBuffer[]
695 template<
typename Ordinal,
typename Packet>
698 const int sourceRank, Packet *recv
705 template<
typename Ordinal,
typename Packet>
708 const int sourceRank,
const Ordinal count, Packet*
const recvBuffer[]
716 template<
typename Ordinal,
typename Packet,
typename Serializer>
720 const int sourceRank,
const Ordinal count, Packet recvBuffer[]
728 template<
typename Ordinal,
typename Packet>
736 template<
typename Ordinal,
typename Packet>
748 template<
typename Ordinal,
typename Packet>
760 template<
typename Ordinal,
typename Packet,
typename Serializer>
772 template<
typename Ordinal,
typename Packet>
780 template<
typename Ordinal,
typename Packet>
791 template<
typename Ordinal,
typename Packet>
803 template<
typename Ordinal,
typename Packet,
typename Serializer>
824 template<
typename Ordinal,
typename Packet>
832 template<
typename Ordinal,
typename Packet>
835 const int sourceRank,
850 template<
typename Ordinal,
typename Packet>
862 template<
typename Ordinal,
typename Packet,
typename Serializer>
881 template<
typename Ordinal>
916 template<
typename Ordinal>
945 template<
typename Ordinal>
958 template<
typename Ordinal,
typename Packet>
965 const Packet inBuffer[],
979 template<
typename Ordinal,
typename Packet>
986 const Packet inBuffer[],
1000 template<
typename Ordinal,
typename Packet>
1006 const Ordinal count,
1007 const Packet inBuffer[],
1008 Packet inoutBuffer[]
1017 template<
typename Ordinal,
typename Packet>
1023 const Ordinal count,
1024 const Packet inBuffer[],
1025 Packet inoutBuffer[]
1039 namespace MixMaxUtilities {
1042 template<
bool isComparable,
typename Ordinal,
typename Packet>
1046 template<
typename Ordinal,
typename Packet>
1047 class Min<true,Ordinal,Packet> {
1050 const Ordinal count,
1051 const Packet inBuffer[],
1052 Packet inoutBuffer[]
1055 for(
int i = 0; i < count; ++i )
1056 inoutBuffer[i] = TEUCHOS_MIN(inoutBuffer[i],inBuffer[i]);
1061 template<
typename Ordinal,
typename Packet>
1062 class Min<false,Ordinal,Packet> {
1071 true,std::logic_error,
1073 <<
" does not support comparison operations!" 1079 template<
bool isComparable,
typename Ordinal,
typename Packet>
1083 template<
typename Ordinal,
typename Packet>
1084 class Max<true,Ordinal,Packet> {
1087 const Ordinal count,
1088 const Packet inBuffer[],
1089 Packet inoutBuffer[]
1092 for(
int i = 0; i < count; ++i )
1093 inoutBuffer[i] = TEUCHOS_MAX(inoutBuffer[i],inBuffer[i]);
1098 template<
typename Ordinal,
typename Packet>
1099 class Max<false,Ordinal,Packet> {
1108 true,std::logic_error,
1110 <<
" does not support comparison operations!" 1116 template<
bool isComparable,
typename Ordinal,
typename Packet>
1120 template<
typename Ordinal,
typename Packet>
1121 class AND<true,Ordinal,Packet> {
1124 const Ordinal count,
1125 const Packet inBuffer[],
1126 Packet inoutBuffer[]
1129 for(
int i = 0; i < count; ++i )
1130 inoutBuffer[i] = inoutBuffer[i] && inBuffer[i];
1135 template<
typename Ordinal,
typename Packet>
1136 class AND<false,Ordinal,Packet> {
1145 true,std::logic_error,
1147 <<
" does not support logical AND operations!" 1156 template<
typename Ordinal,
typename Packet>
1158 const Ordinal count,
1159 const Packet inBuffer[],
1160 Packet inoutBuffer[]
1163 for(
int i = 0; i < count; ++i )
1164 inoutBuffer[i] += inBuffer[i];
1168 template<
typename Ordinal,
typename Packet>
1170 const Ordinal count,
1171 const Packet inBuffer[],
1172 Packet inoutBuffer[]
1175 typedef MixMaxUtilities::Min<ScalarTraits<Packet>::isComparable, Ordinal, Packet> min_type;
1176 min_type::min (count, inBuffer, inoutBuffer);
1180 template<
typename Ordinal,
typename Packet>
1182 const Ordinal count,
1183 const Packet inBuffer[],
1184 Packet inoutBuffer[]
1187 typedef MixMaxUtilities::Max<ScalarTraits<Packet>::isComparable, Ordinal, Packet> max_type;
1188 max_type::max (count,inBuffer,inoutBuffer);
1192 template<
typename Ordinal,
typename Packet>
1194 const Ordinal count,
1195 const Packet inBuffer[],
1196 Packet inoutBuffer[]
1199 typedef MixMaxUtilities::AND<ScalarTraits<Packet>::isComparable, Ordinal, Packet> and_type;
1200 and_type::andOp (count, inBuffer, inoutBuffer);
1230 template<
typename Ordinal,
typename Packet>
1232 createOp (
const EReductionType reductType)
1235 switch (reductType) {
1241 ! ST::isComparable, std::invalid_argument,
"Teuchos::createOp" 1243 <<
" is not less-than comparable, so it does not make sense to do a " 1244 "MIN reduction with it.");
1249 ! ST::isComparable, std::invalid_argument,
"Teuchos::createOp" 1251 <<
" is not less-than comparable, so it does not make sense to do a " 1252 "MAX reduction with it.");
1260 true, std::invalid_argument,
"Teuchos::createOp(EReductionType): " 1261 "Invalid EReductionType value " << reductType <<
". Valid values " 1262 "include REDUCE_SUM, REDUCE_MIN, REDUCE_MAX, and REDUCE_AND.");
1275 template<
typename Ordinal>
1282 template<
typename Ordinal>
1289 template<
typename Ordinal>
1292 TEUCHOS_COMM_TIME_MONITOR(
1293 "Teuchos::CommHelpers: barrier<" 1301 template<
typename Ordinal,
typename Packet>
1302 void Teuchos::broadcast(
1304 const int rootRank,
const Ordinal count, Packet buffer[]
1307 TEUCHOS_COMM_TIME_MONITOR(
1308 "Teuchos::CommHelpers: broadcast<" 1313 charBuffer(count,buffer);
1315 rootRank,charBuffer.getBytes(),charBuffer.getCharBuffer()
1320 template<
typename Ordinal,
typename Packet>
1321 void Teuchos::broadcast(
1327 broadcast<Ordinal, Packet>(comm, rootRank, buffer.
size(), buffer.
getRawPtr() );
1331 template<
typename Ordinal,
typename Packet>
1332 void Teuchos::broadcast(
1334 const int rootRank, Packet *
object 1337 broadcast<Ordinal,Packet>(comm,rootRank,1,object);
1341 template<
typename Ordinal,
typename Packet>
1342 void Teuchos::broadcast(
1347 broadcast<Ordinal,Packet>(comm,rootRank,1,
object.getRawPtr());
1351 template<
typename Ordinal,
typename Packet>
1352 void Teuchos::broadcast(
1354 const int rootRank,
const Ordinal count, Packet*
const buffer[]
1357 TEUCHOS_COMM_TIME_MONITOR(
1358 "Teuchos::CommHelpers: broadcast<" 1360 <<
">( reference type )" 1363 charBuffer(serializer, count, buffer);
1370 template<
typename Ordinal,
typename Packet>
1371 void Teuchos::broadcast(
1377 for (
int i = 0; i < buffer.
size(); ++i) {
1378 bufferPtrArray.
push_back(buffer[i].getRawPtr());
1380 broadcast<Ordinal,Packet>(comm, serializer, rootRank,
1384 template<
typename Ordinal,
typename Packet,
typename Serializer>
1385 void Teuchos::broadcast(
1388 const int rootRank,
const Ordinal count, Packet buffer[]
1391 TEUCHOS_COMM_TIME_MONITOR(
1392 "Teuchos::CommHelpers: broadcast<" 1397 charBuffer(count,buffer,
rcp(&serializer,
false));
1399 rootRank,charBuffer.getBytes(),charBuffer.getCharBuffer()
1404 template<
typename Ordinal,
typename Packet>
1405 void Teuchos::gatherAll(
1407 const Ordinal sendCount,
const Packet sendBuffer[],
1408 const Ordinal recvCount, Packet recvBuffer[]
1411 TEUCHOS_COMM_TIME_MONITOR(
1412 "Teuchos::CommHelpers: gatherAll<" 1417 charSendBuffer(sendCount,sendBuffer);
1419 charRecvBuffer(recvCount,recvBuffer);
1421 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
1422 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
1426 template<
typename Ordinal,
typename Packet>
1428 Teuchos::gather (
const Packet sendBuf[],
1429 const Ordinal sendCount,
1431 const Ordinal recvCount,
1435 TEUCHOS_COMM_TIME_MONITOR(
1436 "Teuchos::CommHelpers: gather<" 1441 charSendBuffer (sendCount, sendBuf);
1443 charRecvBuffer (recvCount, recvBuf);
1444 comm.
gather (charSendBuffer.getBytes (),
1445 charSendBuffer.getCharBuffer (),
1446 charRecvBuffer.getBytes (),
1447 charRecvBuffer.getCharBuffer (),
1451 template<
typename Ordinal,
typename Packet>
1453 Teuchos::gatherv (
const Packet sendBuf[],
1454 const Ordinal sendCount,
1456 const Ordinal recvCounts[],
1457 const Ordinal displs[],
1482 "Teuchos::gatherv: The general case is not implemented.");
1485 template<
typename Ordinal,
typename Packet>
1486 void Teuchos::gatherAll(
1488 const Ordinal sendCount,
const Packet*
const sendBuffer[],
1489 const Ordinal recvCount, Packet*
const recvBuffer[]
1495 template<
typename Ordinal,
typename Packet,
typename Serializer>
1496 void Teuchos::gatherAll(
1499 const Ordinal sendCount,
const Packet sendBuffer[],
1500 const Ordinal recvCount, Packet recvBuffer[]
1503 TEUCHOS_COMM_TIME_MONITOR(
1504 "Teuchos::CommHelpers: gatherAll<" 1509 charSendBuffer(sendCount,sendBuffer,
rcp(&serializer,
false));
1511 charRecvBuffer(recvCount,recvBuffer,
rcp(&serializer,
false));
1513 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
1514 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
1519 template<
typename Ordinal,
typename Packet>
1521 Teuchos::reduce (
const Packet sendBuf[],
1523 const Ordinal count,
1524 const EReductionType reductType,
1532 (
true, std::logic_error,
"Teuchos::reduce<" <<
1534 <<
">: Generic version not implemented. We only implement this function " 1535 "for Ordinal = int and Packet = specific types.");
1539 template<
typename Ordinal,
typename Packet>
1542 ,
const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
1545 TEUCHOS_COMM_TIME_MONITOR(
1546 "Teuchos::CommHelpers: reduceAll<" 1548 <<
">( value type, user-defined op )" 1551 charSendBuffer(count,sendBuffer);
1553 charGlobalReducts(count,globalReducts);
1555 charReductOp(
rcp(&reductOp,
false));
1557 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
1558 ,charGlobalReducts.getCharBuffer()
1563 template<
typename Ordinal,
typename Packet>
1566 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
1569 TEUCHOS_COMM_TIME_MONITOR(
1570 "Teuchos::CommHelpers: reduceAll<" 1572 <<
">( value type, "<<toString(reductType)<<
" )" 1576 createOp<Ordinal, Packet> (reductType);
1578 reduceAll(comm,*reductOp,count,sendBuffer,globalReducts);
1580 catch (std::exception& e) {
1596 #ifdef HAVE_TEUCHOS_COMPLEX 1599 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1600 reduceAll<int, std::complex<double> > (
const Comm<int>& comm,
1601 const EReductionType reductType,
1603 const std::complex<double> sendBuffer[],
1604 std::complex<double> globalReducts[]);
1607 ireceive<int, std::complex<double> > (
const Comm<int>& comm,
1609 const int sourceRank);
1613 const int sourceRank,
1617 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1618 send<int, std::complex<double> > (
const Comm<int>& comm,
1620 const std::complex<double> sendBuffer[],
1621 const int destRank);
1623 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1624 send<int, std::complex<double> > (
const std::complex<double> sendBuffer[],
1638 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1639 reduceAll<int, std::complex<float> > (
const Comm<int>& comm,
1640 const EReductionType reductType,
1642 const std::complex<float> sendBuffer[],
1643 std::complex<float> globalReducts[]);
1646 ireceive<int, std::complex<float> > (
const Comm<int>& comm,
1648 const int sourceRank);
1652 const int sourceRank,
1656 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1657 send<int, std::complex<float> > (
const Comm<int>& comm,
1659 const std::complex<float> sendBuffer[],
1660 const int destRank);
1662 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1663 send<int, std::complex<float> > (
const std::complex<float> sendBuffer[],
1674 #endif // HAVE_TEUCHOS_COMPLEX 1679 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1680 reduceAll<int, double> (
const Comm<int>& comm,
1681 const EReductionType reductType,
1683 const double sendBuffer[],
1684 double globalReducts[]);
1687 ireceive<int, double> (
const Comm<int>& comm,
1689 const int sourceRank);
1693 const int sourceRank,
1697 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1698 send<int, double> (
const Comm<int>& comm,
1700 const double sendBuffer[],
1701 const int destRank);
1703 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1704 send<int, double> (
const double sendBuffer[],
1718 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1719 reduceAll<int, float> (
const Comm<int>& comm,
1720 const EReductionType reductType,
1722 const float sendBuffer[],
1723 float globalReducts[]);
1726 ireceive<int, float> (
const Comm<int>& comm,
1728 const int sourceRank);
1732 const int sourceRank,
1736 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1737 send<int, float> (
const Comm<int>& comm,
1739 const float sendBuffer[],
1740 const int destRank);
1742 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1743 send<int, float> (
const float sendBuffer[],
1755 #ifdef HAVE_TEUCHOS_LONG_LONG_INT 1758 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1759 gather<int, long long> (
const long long sendBuf[],
1760 const int sendCount,
1761 long long recvBuf[],
1762 const int recvCount,
1766 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1767 gatherv<int, long long> (
const long long sendBuf[],
1768 const int sendCount,
1769 long long recvBuf[],
1770 const int recvCounts[],
1775 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1776 reduceAll<int, long long> (
const Comm<int>& comm,
1777 const EReductionType reductType,
1779 const long long sendBuffer[],
1780 long long globalReducts[]);
1783 ireceive<int, long long> (
const Comm<int>& comm,
1785 const int sourceRank);
1789 const int sourceRank,
1793 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1794 send<int, long long> (
const Comm<int>& comm,
1796 const long long sendBuffer[],
1797 const int destRank);
1799 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1800 send<int, long long> (
const long long sendBuffer[],
1814 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1815 gather<int, unsigned long long> (
const unsigned long long sendBuf[],
1816 const int sendCount,
1817 unsigned long long recvBuf[],
1818 const int recvCount,
1822 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1823 gatherv<int, unsigned long long> (
const unsigned long long sendBuf[],
1824 const int sendCount,
1825 unsigned long long recvBuf[],
1826 const int recvCounts[],
1831 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1832 reduceAll<int, unsigned long long> (
const Comm<int>& comm,
1833 const EReductionType reductType,
1835 const unsigned long long sendBuffer[],
1836 unsigned long long globalReducts[]);
1839 ireceive<int, unsigned long long> (
const Comm<int>& comm,
1841 const int sourceRank);
1845 const int sourceRank,
1849 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1850 send<int, unsigned long long> (
const Comm<int>& comm,
1852 const unsigned long long sendBuffer[],
1853 const int destRank);
1855 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1856 send<int, unsigned long long> (
const unsigned long long sendBuffer[],
1867 #endif // HAVE_TEUCHOS_LONG_LONG_INT 1871 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1872 gather<int, long> (
const long sendBuf[],
1873 const int sendCount,
1875 const int recvCount,
1879 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1880 gatherv<int, long> (
const long sendBuf[],
1881 const int sendCount,
1883 const int recvCounts[],
1888 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1889 reduceAll<int, long> (
const Comm<int>& comm,
1890 const EReductionType reductType,
1892 const long sendBuffer[],
1893 long globalReducts[]);
1896 ireceive<int, long> (
const Comm<int>& comm,
1898 const int sourceRank);
1902 const int sourceRank,
1906 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1909 const long sendBuffer[],
1910 const int destRank);
1912 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1913 send<int, long> (
const long sendBuffer[],
1927 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1928 gather<int, unsigned long> (
const unsigned long sendBuf[],
1929 const int sendCount,
1930 unsigned long recvBuf[],
1931 const int recvCount,
1935 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1936 gatherv<int, unsigned long> (
const unsigned long sendBuf[],
1937 const int sendCount,
1938 unsigned long recvBuf[],
1939 const int recvCounts[],
1944 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1945 reduceAll<int, unsigned long> (
const Comm<int>& comm,
1946 const EReductionType reductType,
1948 const unsigned long sendBuffer[],
1949 unsigned long globalReducts[]);
1952 ireceive<int, unsigned long> (
const Comm<int>& comm,
1954 const int sourceRank);
1958 const int sourceRank,
1962 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1963 send<int, unsigned long> (
const Comm<int>& comm,
1965 const unsigned long sendBuffer[],
1966 const int destRank);
1968 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1969 send<int, unsigned long> (
const unsigned long sendBuffer[],
1983 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1984 gather<int, int> (
const int sendBuf[],
1985 const int sendCount,
1987 const int recvCount,
1991 TEUCHOSCOMM_LIB_DLL_EXPORT
void 1992 gatherv<int, int> (
const int sendBuf[],
1993 const int sendCount,
1995 const int recvCounts[],
2000 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2001 scatter (
const int sendBuf[],
2002 const int sendCount,
2004 const int recvCount,
2008 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2009 reduce<int, int> (
const int sendBuf[],
2012 const EReductionType reductType,
2016 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2017 reduceAll<int, int> (
const Comm<int>& comm,
2018 const EReductionType reductType,
2020 const int sendBuffer[],
2021 int globalReducts[]);
2027 TEUCHOSCOMM_LIB_DLL_EXPORT TEUCHOS_DEPRECATED
void 2028 reduceAllAndScatter<int, int> (
const Comm<int>& comm,
2029 const EReductionType reductType,
2030 const int sendCount,
2031 const int sendBuffer[],
2032 const int recvCounts[],
2033 int myGlobalReducts[]);
2036 ireceive<int, int> (
const Comm<int>& comm,
2038 const int sourceRank);
2042 const int sourceRank,
2046 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2049 const int sendBuffer[],
2050 const int destRank);
2052 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2053 send<int, int> (
const int sendBuffer[],
2067 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2068 gather<int, unsigned int> (
const unsigned int sendBuf[],
2069 const int sendCount,
2070 unsigned int recvBuf[],
2071 const int recvCount,
2075 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2076 gatherv<int, unsigned int> (
const unsigned int sendBuf[],
2077 const int sendCount,
2078 unsigned int recvBuf[],
2079 const int recvCounts[],
2084 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2085 reduceAll<int, unsigned int> (
const Comm<int>& comm,
2086 const EReductionType reductType,
2088 const unsigned int sendBuffer[],
2089 unsigned int globalReducts[]);
2092 ireceive<int, unsigned int> (
const Comm<int>& comm,
2094 const int sourceRank);
2098 const int sourceRank,
2102 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2103 send<int, unsigned int> (
const Comm<int>& comm,
2105 const unsigned int sendBuffer[],
2106 const int destRank);
2108 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2109 send<int, unsigned int> (
const unsigned int sendBuffer[],
2123 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2124 gather<int, short> (
const short sendBuf[],
2125 const int sendCount,
2127 const int recvCount,
2131 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2132 gatherv<int, short> (
const short sendBuf[],
2133 const int sendCount,
2135 const int recvCounts[],
2140 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2141 reduceAll<int, short> (
const Comm<int>& comm,
2142 const EReductionType reductType,
2144 const short sendBuffer[],
2145 short globalReducts[]);
2148 ireceive<int, short> (
const Comm<int>& comm,
2150 const int sourceRank);
2154 const int sourceRank,
2158 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2159 send<int, short> (
const Comm<int>& comm,
2161 const short sendBuffer[],
2162 const int destRank);
2164 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2165 send<int, short> (
const short sendBuffer[],
2188 TEUCHOSCOMM_LIB_DLL_EXPORT
void 2189 reduceAll<int, char> (
const Comm<int>& comm,
2190 const EReductionType reductType,
2192 const char sendBuffer[],
2193 char globalReducts[]);
2198 template<
typename Ordinal,
typename Packet>
2206 reduceAll<Ordinal,Packet>(comm, reductType, 1, &
send, &*globalReduct);
2210 template<
typename Ordinal,
typename Packet>
2214 const Ordinal count,
const Packet*
const sendBuffer[], Packet*
const globalReducts[]
2217 TEUCHOS_COMM_TIME_MONITOR(
2218 "Teuchos::CommHelpers: reduceAll<" 2220 <<
">( reference type )" 2223 charSendBuffer(serializer,count,sendBuffer);
2225 charGlobalReducts(serializer,count,globalReducts);
2227 charReductOp(
rcp(&serializer,
false),
rcp(&reductOp,
false));
2234 template<
typename Ordinal,
typename Packet,
typename Serializer>
2239 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
2242 TEUCHOS_COMM_TIME_MONITOR(
2243 "Teuchos::CommHelpers: reduceAll<" 2245 <<
">( value type, user-defined op )" 2248 charSendBuffer(count,sendBuffer,
rcp(&serializer,
false));
2250 charGlobalReducts(count,globalReducts,
rcp(&serializer,
false));
2252 charReductOp(
rcp(&reductOp,
false),
rcp(&serializer,
false));
2254 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2255 ,charGlobalReducts.getCharBuffer()
2260 template<
typename Ordinal,
typename Packet,
typename Serializer>
2264 const EReductionType reductType,
2265 const Ordinal count,
const Packet sendBuffer[], Packet globalReducts[]
2268 TEUCHOS_COMM_TIME_MONITOR(
2269 "Teuchos::CommHelpers: reduceAll<" 2271 <<
">( value type, "<<toString(reductType)<<
" )" 2275 createOp<Ordinal, Packet> (reductType);
2277 reduceAll(comm,serializer,*reductOp,count,sendBuffer,globalReducts);
2279 catch (std::exception& e) {
2287 template<
typename Ordinal,
typename Packet>
2288 TEUCHOS_DEPRECATED
void 2289 Teuchos::reduceAllAndScatter(
2291 const Ordinal sendCount,
const Packet sendBuffer[] ,
2292 const Ordinal recvCounts[], Packet myGlobalReducts[]
2296 TEUCHOS_COMM_TIME_MONITOR(
2297 "Teuchos::CommHelpers: reduceAllAndScatter<" 2299 <<
">( value type, user-defined op )" 2302 const Ordinal size = Teuchos::size(comm);
2303 const Ordinal rank = Teuchos::rank(comm);
2305 #ifdef TEUCHOS_DEBUG 2306 Ordinal sumRecvCounts = 0;
2307 for( Ordinal i = 0; i < size; ++i )
2308 sumRecvCounts += recvCounts[static_cast<ptrdiff_t>(i)];
2313 charSendBuffer(sendCount,sendBuffer);
2315 charMyGlobalReducts(recvCounts[static_cast<ptrdiff_t>(rank)], myGlobalReducts);
2317 charReductOp(
rcp(&reductOp,
false));
2320 packetSize = charSendBuffer.getBytes()/sendCount;
2324 for (Ordinal k = 0; k < size; ++k) {
2325 charRecvCounts[k] = as<Ordinal>(recvCounts[
static_cast<ptrdiff_t
>(k)] * packetSize);
2329 charReductOp, charSendBuffer.getBytes(), charSendBuffer.getCharBuffer(),
2330 &charRecvCounts[0], charMyGlobalReducts.getCharBuffer()
2336 template<
typename Ordinal,
typename Packet>
2337 TEUCHOS_DEPRECATED
void 2338 Teuchos::reduceAllAndScatter(
2340 const Ordinal sendCount,
const Packet sendBuffer[] ,
2341 const Ordinal recvCounts[], Packet myGlobalReducts[]
2344 TEUCHOS_COMM_TIME_MONITOR(
2345 "Teuchos::CommHelpers: reduceAllAndScatter<" 2347 <<
">( value type, "<<toString(reductType)<<
" )" 2350 createOp<Ordinal, Packet> (reductType);
2352 reduceAllAndScatter (comm, *reductOp, sendCount, sendBuffer,
2353 recvCounts, myGlobalReducts);
2355 catch (std::exception& e) {
2363 template<
typename Ordinal,
typename Packet>
2364 TEUCHOS_DEPRECATED
void 2365 Teuchos::reduceAllAndScatter(
2368 const Ordinal sendCount,
const Packet*
const sendBuffer[],
2369 const Ordinal recvCounts[], Packet*
const myGlobalReducts[]
2375 template<
typename Ordinal,
typename Packet,
typename Serializer>
2376 TEUCHOS_DEPRECATED
void 2377 Teuchos::reduceAllAndScatter(
2381 const Ordinal sendCount,
const Packet sendBuffer[] ,
2382 const Ordinal recvCounts[], Packet myGlobalReducts[]
2386 TEUCHOS_COMM_TIME_MONITOR(
2387 "Teuchos::CommHelpers: reduceAllAndScatter<" 2389 <<
">( value type, user-defined op )" 2392 const Ordinal size = Teuchos::size(comm);
2393 const Ordinal rank = Teuchos::rank(comm);
2395 #ifdef TEUCHOS_DEBUG 2396 Ordinal sumRecvCounts = 0;
2397 for( Ordinal i = 0; i < size; ++i )
2398 sumRecvCounts += recvCounts[static_cast<ptrdiff_t>(i)];
2403 charSendBuffer(sendCount,sendBuffer,
rcp(&serializer,
false));
2405 charMyGlobalReducts(recvCounts[static_cast<ptrdiff_t>(rank)], myGlobalReducts,
rcp(&serializer,
false));
2407 charReductOp(
rcp(&reductOp,
false),
rcp(&serializer,
false));
2410 packetSize = charSendBuffer.getBytes()/sendCount;
2414 for (Ordinal k = 0; k < size; ++k) {
2415 charRecvCounts[k] = as<Ordinal>(recvCounts[
static_cast<ptrdiff_t
>(k)] * packetSize);
2419 charReductOp, charSendBuffer.getBytes(), charSendBuffer.getCharBuffer(),
2420 &charRecvCounts[0], charMyGlobalReducts.getCharBuffer()
2425 template<
typename Ordinal,
typename Packet,
typename Serializer>
2426 TEUCHOS_DEPRECATED
void 2427 Teuchos::reduceAllAndScatter(
2430 const EReductionType reductType,
2431 const Ordinal sendCount,
const Packet sendBuffer[] ,
2432 const Ordinal recvCounts[], Packet myGlobalReducts[]
2435 TEUCHOS_COMM_TIME_MONITOR(
2436 "Teuchos::CommHelpers: reduceAllAndScatter<" 2438 <<
">( value type, "<<toString(reductType)<<
" )" 2442 createOp<Ordinal, Packet> (reductType);
2444 reduceAllAndScatter (comm, serializer, *reductOp, sendCount,
2445 sendBuffer, recvCounts, myGlobalReducts);
2447 catch (std::exception& e) {
2455 template<
typename Ordinal,
typename Packet>
2458 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
2461 TEUCHOS_COMM_TIME_MONITOR(
2462 "Teuchos::CommHelpers: scan<" 2464 <<
">( value type, user-defined op )" 2467 charSendBuffer(count,sendBuffer);
2469 charScanReducts(count,scanReducts);
2471 charReductOp(
rcp(&reductOp,
false));
2473 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2474 ,charScanReducts.getCharBuffer()
2479 template<
typename Ordinal,
typename Packet>
2482 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
2485 TEUCHOS_COMM_TIME_MONITOR(
2486 "Teuchos::CommHelpers: scan<" 2488 <<
">( value type, "<<toString(reductType)<<
" )" 2492 createOp<Ordinal, Packet> (reductType);
2494 scan(comm,*reductOp,count,sendBuffer,scanReducts);
2496 catch (std::exception& e) {
2504 template<
typename Ordinal,
typename Packet>
2510 scan<Ordinal,Packet>(comm, reductType, 1, &
send, &*scanReduct);
2514 template<
typename Ordinal,
typename Packet>
2518 const Ordinal count,
const Packet*
const sendBuffer[], Packet*
const scanReducts[]
2524 template<
typename Ordinal,
typename Packet,
typename Serializer>
2529 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
2532 TEUCHOS_COMM_TIME_MONITOR(
2533 "Teuchos::CommHelpers: scan<" 2535 <<
">( value type, user-defined op )" 2538 charSendBuffer(count,sendBuffer,
rcp(&serializer,
false));
2540 charScanReducts(count,scanReducts,
rcp(&serializer,
false));
2542 charReductOp(
rcp(&reductOp,
false),
rcp(&serializer,
false));
2544 charReductOp,charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2545 ,charScanReducts.getCharBuffer()
2550 template<
typename Ordinal,
typename Packet,
typename Serializer>
2554 const EReductionType reductType,
2555 const Ordinal count,
const Packet sendBuffer[], Packet scanReducts[]
2558 TEUCHOS_COMM_TIME_MONITOR(
2559 "Teuchos::CommHelpers: scan<" 2561 <<
">( value type, "<<toString(reductType)<<
" )" 2565 createOp<Ordinal, Packet> (reductType);
2567 scan(comm,serializer,*reductOp,count,sendBuffer,scanReducts);
2569 catch (std::exception& e) {
2576 template<
typename Ordinal,
typename Packet>
2579 const Ordinal count,
const Packet sendBuffer[],
const int destRank
2582 TEUCHOS_COMM_TIME_MONITOR(
2583 "Teuchos::CommHelpers: send<" 2588 charSendBuffer(count,sendBuffer);
2590 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2595 template<
typename Ordinal,
typename Packet>
2598 const Ordinal count,
2603 TEUCHOS_COMM_TIME_MONITOR(
2604 "Teuchos::CommHelpers: send<" 2609 comm.
send (charSendBuffer.getBytes (), charSendBuffer.getCharBuffer (), destRank, tag);
2612 template<
typename Ordinal,
typename Packet>
2615 const Ordinal count,
const Packet sendBuffer[],
const int destRank
2618 TEUCHOS_COMM_TIME_MONITOR(
2619 "Teuchos::CommHelpers: ssend<" 2624 charSendBuffer(count,sendBuffer);
2626 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2631 template<
typename Ordinal,
typename Packet>
2634 const Ordinal count,
2639 TEUCHOS_COMM_TIME_MONITOR(
2640 "Teuchos::CommHelpers: ssend<" 2645 buf_type charSendBuffer (count, sendBuffer);
2646 comm.
ssend (charSendBuffer.getBytes (),
2647 charSendBuffer.getCharBuffer (),
2651 template<
typename Ordinal,
typename Packet>
2654 const Packet &
send,
const int destRank
2657 Teuchos::send<Ordinal,Packet>(comm,1,&
send,destRank);
2660 template<
typename Ordinal,
typename Packet>
2663 const Packet &
send,
const int destRank
2666 Teuchos::ssend<Ordinal,Packet>(comm,1,&
send,destRank);
2669 template<
typename Ordinal,
typename Packet>
2672 const Ordinal count,
const Packet*
const sendBuffer[],
const int destRank
2678 template<
typename Ordinal,
typename Packet,
typename Serializer>
2682 const Ordinal count,
const Packet sendBuffer[],
const int destRank
2685 TEUCHOS_COMM_TIME_MONITOR(
2686 "Teuchos::CommHelpers: send<" 2691 charSendBuffer(count,sendBuffer,
rcp(&serializer,
false));
2693 charSendBuffer.getBytes(),charSendBuffer.getCharBuffer()
2698 template<
typename Ordinal,
typename Packet>
2699 int Teuchos::receive(
2701 const int sourceRank,
const Ordinal count, Packet recvBuffer[]
2704 TEUCHOS_COMM_TIME_MONITOR(
2705 "Teuchos::CommHelpers: receive<" 2710 charRecvBuffer(count,recvBuffer);
2713 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
2718 template<
typename Ordinal,
typename Packet>
2719 int Teuchos::receive(
2721 const int sourceRank, Packet *recv
2724 return Teuchos::receive<Ordinal,Packet>(comm,sourceRank,1,recv);
2728 template<
typename Ordinal,
typename Packet>
2729 int Teuchos::receive(
2731 const int sourceRank,
const Ordinal count, Packet*
const recvBuffer[]
2737 template<
typename Ordinal,
typename Packet,
typename Serializer>
2738 int Teuchos::receive(
2741 const int sourceRank,
const Ordinal count, Packet recvBuffer[]
2744 TEUCHOS_COMM_TIME_MONITOR(
2745 "Teuchos::CommHelpers: receive<" 2750 charRecvBuffer(count,recvBuffer,
rcp(&serializer,
false));
2753 ,charRecvBuffer.getBytes(),charRecvBuffer.getCharBuffer()
2757 template<
typename Ordinal,
typename Packet>
2764 TEUCHOS_COMM_TIME_MONITOR(
2765 "Teuchos::CommHelpers: readySend<" 2771 comm.
readySend( charSendBuffer.getCharBufferView(), destRank );
2774 template<
typename Ordinal,
typename Packet>
2777 const Ordinal count,
2782 TEUCHOS_COMM_TIME_MONITOR(
2783 "Teuchos::CommHelpers: readySend<" 2788 buf_type charSendBuffer (count, sendBuffer);
2789 comm.
readySend (charSendBuffer.getBytes (),
2790 charSendBuffer.getCharBuffer (),
2794 template<
typename Ordinal,
typename Packet>
2801 readySend<Ordinal, Packet>( comm, arrayView(&
send,1), destRank );
2804 template<
typename Ordinal,
typename Packet,
typename Serializer>
2812 TEUCHOS_COMM_TIME_MONITOR(
2813 "Teuchos::CommHelpers: readySend<" 2818 charSendBuffer(sendBuffer.
size(), sendBuffer.
getRawPtr(), serializer);
2819 comm.
readySend( charSendBuffer.getCharBufferView(), destRank );
2822 template<
typename Ordinal,
typename Packet>
2830 TEUCHOS_COMM_TIME_MONITOR(
2831 "Teuchos::CommHelpers: isend<" 2838 charSendBuffer.getCharBufferView(), destRank );
2839 set_extra_data( sendBuffer,
"buffer", inOutArg(commRequest) );
2843 template<
typename Ordinal,
typename Packet>
2850 TEUCHOS_COMM_TIME_MONITOR(
2854 charSendBuffer (sendBuffer.
size (), sendBuffer.
getRawPtr ());
2856 comm.
isend (charSendBuffer.getCharBufferView (), destRank, tag);
2857 set_extra_data (sendBuffer,
"buffer", inOutArg (commRequest));
2861 template<
typename Ordinal,
typename Packet>
2870 arcpWithEmbeddedObj( send.
get(), 0, 1,
send, false );
2873 return isend<Ordinal, Packet>( comm, sendBuffer, destRank );
2876 template<
typename Ordinal,
typename Packet,
typename Serializer>
2885 TEUCHOS_COMM_TIME_MONITOR(
2886 "Teuchos::CommHelpers: isend<" 2891 charSendBuffer(sendBuffer.
size(), sendBuffer.
getRawPtr(), serializer);
2893 charSendBuffer.getCharBufferView(), destRank );
2894 set_extra_data( sendBuffer,
"buffer", inOutArg(commRequest) );
2898 template<
typename Ordinal,
typename Packet>
2903 const int sourceRank
2906 TEUCHOS_COMM_TIME_MONITOR(
2911 charRecvBuffer.getCharBufferView(), sourceRank );
2912 set_extra_data( recvBuffer,
"buffer", inOutArg(commRequest) );
2916 template<
typename Ordinal,
typename Packet>
2919 const int sourceRank,
2923 TEUCHOS_COMM_TIME_MONITOR(
2926 charRecvBuffer (recvBuffer.
size (), recvBuffer.
getRawPtr ());
2928 comm.
ireceive (charRecvBuffer.getCharBufferView (), sourceRank, tag);
2929 set_extra_data (recvBuffer,
"buffer", inOutArg (commRequest));
2933 template<
typename Ordinal,
typename Packet>
2938 const int sourceRank
2942 arcpWithEmbeddedObj( recv.
get(), 0, 1, recv, false );
2945 return ireceive<Ordinal, Packet>( comm, recvBuffer, sourceRank );
2948 template<
typename Ordinal,
typename Packet,
typename Serializer>
2954 const int sourceRank
2957 TEUCHOS_COMM_TIME_MONITOR(
2958 "Teuchos::CommHelpers: ireceive<" 2963 charRecvBuffer(recvBuffer.
size(), recvBuffer.
getRawPtr(), serializer);
2965 charRecvBuffer.getCharBufferView(), sourceRank );
2966 set_extra_data( recvBuffer,
"buffer", inOutArg(commRequest) );
2970 template<
typename Ordinal>
2971 void Teuchos::waitAll(
2980 template<
typename Ordinal>
2986 comm.
waitAll (requests, statuses);
2990 template<
typename Ordinal>
2995 return comm.
wait (request);
2999 #endif // TEUCHOS_COMM_HELPERS_HPP virtual void reduceAll(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal bytes, const char sendBuffer[], char globalReducts[]) const =0
Global reduction.
Strategy interface for the indirect serializing and deserializing objects of a given type handled usi...
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
Encapsulate how an array of non-const objects with reference sematics is serialized into a char[] arr...
virtual void readySend(const ArrayView< const char > &sendBuffer, const int destRank) const =0
Ready send of data from this process to another process.
EReductionType
Enumeration for selecting from a set of pre-defined reduction operations.
virtual RCP< CommStatus< Ordinal > > wait(const Ptr< RCP< CommRequest< Ordinal > > > &request) const =0
Wait on a single communication request, and return its status.
Templated class for workspace creation.
virtual void scan(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal bytes, const char sendBuffer[], char scanReducts[]) const =0
Scan reduction.
virtual RCP< CommRequest< Ordinal > > ireceive(const ArrayView< char > &recvBuffer, const int sourceRank) const =0
Non-blocking receive.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
T * getRawPtr() const
Get the raw C++ pointer to the underlying object.
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.
size_type size() const
The total number of items in the managed array.
T * get() const
Get the raw C++ pointer to the underlying object.
T * getRawPtr()
Return a raw pointer to beginning of array or NULL if unsized.
const char * getCharBuffer() const
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
size_type size() const
The total number of entries in the array.
Standard logical AND operator for booleans.
Standard min operator for types with value semantics.
This structure defines some basic traits for a scalar field type.
Decorator class that uses traits to convert to and from char[] to typed buffers for objects that use ...
virtual void waitAll(const ArrayView< RCP< CommRequest< Ordinal > > > &requests) const =0
Wait on a set of communication requests.
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.
Standard summation operator for types with value semantics.
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
virtual void gather(const Ordinal sendBytes, const char sendBuffer[], const Ordinal recvBytes, char recvBuffer[], const int root) const =0
Gather values from all processes to the root process.
virtual TEUCHOS_DEPRECATED void reduceAllAndScatter(const ValueTypeReductionOp< Ordinal, char > &reductOp, const Ordinal sendBytes, const char sendBuffer[], const Ordinal recvCounts[], char myGlobalReducts[]) const =0
Global reduction combined with a scatter.
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.
TEUCHOS_DEPRECATED void scan(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *scanReduct)
Deprecated.
Encapsulate how an array of const objects with reference sematics is serialized into a char[] array...
virtual int getRank() const =0
Returns the rank of this process.
Standard Max operator for types with value semantics.
Decorator class that uses a strategy object to convert to and from char[] to typed buffers for object...
Implementation of Teuchos wrappers for MPI.
virtual RCP< CommRequest< Ordinal > > isend(const ArrayView< const char > &sendBuffer, const int destRank) const =0
Non-blocking send.
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 .
Encapsulation of the result of a receive (blocking or nonblocking).
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). ...
virtual void barrier() const =0
Pause every process in *this communicator until all the processes reach this point.
Workspace encapsulation class.
T * getRawPtr() const
Return a raw pointer to beginning of array or NULL if unsized.
char * getCharBuffer() const
Encapsulate how an array of non-const objects with value sematics is serialized into a char[] array...
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).
Templated array class derived from the STL std::vector.
Abstract interface for distributed-memory communication.
void push_back(const value_type &x)
Defines basic traits for the ordinal field type.
Default traits class that just returns typeid(T).name().
virtual void broadcast(const int rootRank, const Ordinal bytes, char buffer[]) const =0
Broadcast values from the root process to the slave processes.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos, as well as a number of utility routines.
void reduce(const Ordinal count, const Packet inBuffer[], Packet inoutBuffer[]) const
Base interface class for user-defined reduction operations for objects that use reference semantics...
virtual void gatherAll(const Ordinal sendBytes, const char sendBuffer[], const Ordinal recvBytes, char recvBuffer[]) const =0
Gather values from each process to collect on all processes.
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.
Smart reference counting pointer class for automatic garbage collection.
RCP< CommRequest< Ordinal > > isend(const ArrayRCP< const Packet > &sendBuffer, const int destRank, const int tag, const Comm< Ordinal > &comm)
Variant of isend() that takes a tag (and restores the correct order of arguments).
virtual int receive(const int sourceRank, const Ordinal bytes, char recvBuffer[]) const =0
Blocking receive of data from this process to another process.
Encapsulation of a pending nonblocking communication operation.
Defines basic traits returning the name of a type in a portable and readable way. ...
Definition of Teuchos::as, for conversions between types.
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...
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()
Get the global workspace object set by set_default_workspace_store().
virtual int getSize() const =0
Returns the number of processes that make up this communicator.
Encapsulate how an array of const objects with value sematics is serialized into a const char[] array...
Reference-counted smart pointer for managing arrays.
Replacement for std::vector that is compatible with the Teuchos Memory Management classes...