42 #ifndef TPETRA_DISTRIBUTOR_HPP
43 #define TPETRA_DISTRIBUTOR_HPP
47 #include <Teuchos_Describable.hpp>
48 #include <Teuchos_ParameterListAcceptorDefaultBase.hpp>
49 #include <Teuchos_VerboseObject.hpp>
60 #ifdef TPETRA_DISTRIBUTOR_TIMERS
61 # undef TPETRA_DISTRIBUTOR_TIMERS
62 #endif // TPETRA_DISTRIBUTOR_TIMERS
72 enum EDistributorSendType {
84 DistributorSendTypeEnumToString (EDistributorSendType sendType);
312 template <
class Ordinal>
412 template <
class Packet>
439 template <
class Packet>
470 template <
class Packet>
494 template <
class Packet>
513 template <
class Packet>
523 template <
class Packet>
534 template <
class Packet>
544 template <
class Packet>
582 Details::EDistributorSendType sendType_;
585 bool barrierBetween_;
641 size_t maxSendLength_;
677 size_t totalReceiveLength_;
722 #ifdef TPETRA_DISTRIBUTOR_TIMERS
735 #endif // TPETRA_DISTRIBUTOR_TIMERS
748 bool useDistinctTags_;
754 int getTag (
const int pathTag)
const;
783 void computeReceives ();
797 template <
class Ordinal>
804 void createReverseDistributor()
const;
809 template <
class Packet>
821 << requests_.size() <<
" outstanding nonblocking messages pending. It is "
822 "incorrect to call doPostsAndWaits with posts outstanding.");
835 exports.
size(),
false);
850 arcp<Packet> (imports.
getRawPtr(), 0, imports.
size(),
false));
854 template <
class Packet>
867 << requests_.size() <<
" outstanding nonblocking messages pending. It is "
868 "incorrect to call doPostsAndWaits with posts outstanding.");
883 exports.
size(),
false);
889 numExportPacketsPerLID,
890 arcp<Packet> (imports.
getRawPtr(), 0, imports.
size(),
false),
891 numImportPacketsPerLID);
896 template <
class Packet>
919 #ifdef TPETRA_DISTRIBUTOR_TIMERS
921 #endif // TPETRA_DISTRIBUTOR_TIMERS
925 const Details::EDistributorSendType sendType = sendType_;
926 const bool doBarrier = barrierBetween_;
955 sendType == Details::DISTRIBUTOR_RSEND && ! doBarrier,
956 std::logic_error,
"Ready send implementation requires a barrier between "
957 "posting receives and posting ready sends. This should have been checked "
958 "before. Please report this bug to the Tpetra developers.");
960 const int myImageID = comm_->getRank();
961 size_t selfReceiveOffset = 0;
963 #ifdef HAVE_TEUCHOS_DEBUG
965 const size_t totalNumImportPackets = totalReceiveLength_ * numPackets;
967 std::runtime_error,
typeName (*
this) <<
"::doPosts(): imports must be "
968 "large enough to store the imported data. imports.size() = "
969 << imports.
size() <<
", but total number of import packets = "
970 << totalNumImportPackets <<
".");
971 #endif // HAVE_TEUCHOS_DEBUG
978 const int pathTag = 0;
979 const int tag = this->getTag (pathTag);
983 requests_.size () != 0, std::logic_error,
"doPosts(3): Process "
984 << myImageID <<
": requests_.size() = " << requests_.size ()
986 std::ostringstream os;
987 os << myImageID <<
": doPosts(3,"
988 << (indicesTo_.
empty () ?
"fast" :
"slow") <<
")" << endl;
1005 const size_type actualNumReceives = as<size_type> (numReceives_) +
1006 as<size_type> (selfMessage_ ? 1 : 0);
1007 requests_.resize (0);
1015 #ifdef TPETRA_DISTRIBUTOR_TIMERS
1017 #endif // TPETRA_DISTRIBUTOR_TIMERS
1019 size_t curBufferOffset = 0;
1020 for (size_type i = 0; i < actualNumReceives; ++i) {
1021 if (imagesFrom_[i] != myImageID) {
1030 imports.
persistingView (curBufferOffset, lengthsFrom_[i]*numPackets);
1031 requests_.push_back (ireceive<int, Packet> (recvBuf, imagesFrom_[i],
1034 std::ostringstream os;
1035 os << myImageID <<
": doPosts(3,"
1036 << (indicesTo_.
empty () ?
"fast" :
"slow") <<
"): "
1037 <<
"Posted irecv from Proc " << imagesFrom_[i] <<
" with "
1038 "specified tag " << tag << endl;
1043 selfReceiveOffset = curBufferOffset;
1045 curBufferOffset += lengthsFrom_[i]*numPackets;
1050 #ifdef TPETRA_DISTRIBUTOR_TIMERS
1052 #endif // TPETRA_DISTRIBUTOR_TIMERS
1061 #ifdef TPETRA_DISTRIBUTOR_TIMERS
1063 #endif // TPETRA_DISTRIBUTOR_TIMERS
1070 size_t numBlocks = numSends_ + selfMessage_;
1071 size_t imageIndex = 0;
1072 while ((imageIndex < numBlocks) && (imagesTo_[imageIndex] < myImageID)) {
1075 if (imageIndex == numBlocks) {
1080 size_t selfIndex = 0;
1082 if (indicesTo_.
empty()) {
1084 std::ostringstream os;
1085 os << myImageID <<
": doPosts(3,fast): posting sends" << endl;
1091 for (
size_t i = 0; i < numBlocks; ++i) {
1092 size_t p = i + imageIndex;
1093 if (p > (numBlocks - 1)) {
1097 if (imagesTo_[p] != myImageID) {
1099 exports.
view (startsTo_[p]*numPackets, lengthsTo_[p]*numPackets);
1101 if (sendType == Details::DISTRIBUTOR_SEND) {
1102 send<int, Packet> (tmpSend.
getRawPtr (),
1103 as<int> (tmpSend.
size ()),
1104 imagesTo_[p], tag, *comm_);
1106 else if (sendType == Details::DISTRIBUTOR_ISEND) {
1109 lengthsTo_[p] * numPackets);
1110 requests_.push_back (isend<int, Packet> (tmpSendBuf, imagesTo_[p],
1113 else if (sendType == Details::DISTRIBUTOR_RSEND) {
1114 readySend<int, Packet> (tmpSend.
getRawPtr (),
1115 as<int> (tmpSend.
size ()),
1116 imagesTo_[p], tag, *comm_);
1118 else if (sendType == Details::DISTRIBUTOR_SSEND) {
1119 ssend<int, Packet> (tmpSend.
getRawPtr (),
1120 as<int> (tmpSend.
size ()),
1121 imagesTo_[p], tag, *comm_);
1124 "Distributor (3 args): Invalid send type. We should never get "
1125 "here. Please report this bug to the Tpetra developers.");
1129 std::ostringstream os;
1130 os << myImageID <<
": doPosts(3,fast): "
1131 <<
"Posted send to Proc " << imagesTo_[i]
1132 <<
" w/ specified tag " << tag << endl;
1149 std::copy (exports.
begin()+startsTo_[selfNum]*numPackets,
1150 exports.
begin()+startsTo_[selfNum]*numPackets+lengthsTo_[selfNum]*numPackets,
1151 imports.
begin()+selfReceiveOffset);
1154 std::ostringstream os;
1155 os << myImageID <<
": doPosts(3,fast) done" << endl;
1161 std::ostringstream os;
1162 os << myImageID <<
": doPosts(3,slow): posting sends" << endl;
1171 sendType == Details::DISTRIBUTOR_ISEND, std::logic_error,
1172 "Tpetra::Distributor::doPosts<" << TypeNameTraits<Packet>::name()
1173 <<
"> (3-argument version):" << endl
1174 <<
"The \"send buffer\" code path doesn't currently work with nonblocking sends.");
1176 for (
size_t i = 0; i < numBlocks; ++i) {
1177 size_t p = i + imageIndex;
1178 if (p > (numBlocks - 1)) {
1182 if (imagesTo_[p] != myImageID) {
1184 size_t sendArrayOffset = 0;
1185 size_t j = startsTo_[p];
1186 for (
size_t k = 0; k < lengthsTo_[p]; ++k, ++j) {
1187 srcBegin = exports.
begin() + indicesTo_[j]*numPackets;
1188 srcEnd = srcBegin + numPackets;
1189 std::copy (srcBegin, srcEnd, sendArray.
begin()+sendArrayOffset);
1190 sendArrayOffset += numPackets;
1193 sendArray.
view (0, lengthsTo_[p]*numPackets);
1195 if (sendType == Details::DISTRIBUTOR_SEND) {
1196 send<int, Packet> (tmpSend.
getRawPtr (),
1197 as<int> (tmpSend.
size ()),
1198 imagesTo_[p], tag, *comm_);
1200 else if (sendType == Details::DISTRIBUTOR_ISEND) {
1203 requests_.push_back (isend<int, Packet> (tmpSendBuf, imagesTo_[p],
1206 else if (sendType == Details::DISTRIBUTOR_RSEND) {
1207 readySend<int, Packet> (tmpSend.
getRawPtr (),
1208 as<int> (tmpSend.
size ()),
1209 imagesTo_[p], tag, *comm_);
1211 else if (sendType == Details::DISTRIBUTOR_SSEND) {
1212 ssend<int, Packet> (tmpSend.
getRawPtr (),
1213 as<int> (tmpSend.
size ()),
1214 imagesTo_[p], tag, *comm_);
1218 "Distributor (3 args): Invalid send type. We should never get "
1219 "here. Please report this bug to the Tpetra developers.");
1223 std::ostringstream os;
1224 os << myImageID <<
": doPosts(3,slow): "
1225 <<
"Posted send to Proc " << imagesTo_[i]
1226 <<
" w/ specified tag " << tag << endl;
1232 selfIndex = startsTo_[p];
1237 for (
size_t k = 0; k < lengthsTo_[selfNum]; ++k) {
1238 std::copy (exports.
begin()+indicesTo_[selfIndex]*numPackets,
1239 exports.
begin()+indicesTo_[selfIndex]*numPackets + numPackets,
1240 imports.
begin() + selfReceiveOffset);
1242 selfReceiveOffset += numPackets;
1246 std::ostringstream os;
1247 os << myImageID <<
": doPosts(3,slow) done" << endl;
1253 template <
class Packet>
1268 #ifdef HAVE_TEUCHOS_DEBUG
1270 #endif // HAVE_TEUCHOS_DEBUG
1276 #ifdef TPETRA_DISTRIBUTOR_TIMERS
1278 #endif // TPETRA_DISTRIBUTOR_TIMERS
1282 const Details::EDistributorSendType sendType = sendType_;
1283 const bool doBarrier = barrierBetween_;
1310 std::logic_error,
"Ready send implementation requires a barrier between "
1311 "posting receives and posting ready sends. This should have been checked "
1312 "before. Please report this bug to the Tpetra developers.");
1314 const int myImageID = comm_->getRank();
1315 size_t selfReceiveOffset = 0;
1317 #ifdef HAVE_TEUCHOS_DEBUG
1319 size_t totalNumImportPackets = 0;
1320 for (
int ii = 0; ii < numImportPacketsPerLID.
size(); ++ii) {
1321 totalNumImportPackets += numImportPacketsPerLID[ii];
1325 "imports array argument must be large enough to store the imported "
1326 "data. imports.size() = " << imports.
size() <<
", but the total number "
1327 "of packets is " << totalNumImportPackets <<
".");
1328 #endif // HAVE_TEUCHOS_DEBUG
1335 const int pathTag = 1;
1336 const int tag = this->getTag (pathTag);
1340 requests_.size () != 0, std::logic_error,
"doPosts(4): Process "
1341 << myImageID <<
": requests_.size() = " << requests_.size ()
1343 std::ostringstream os;
1344 os << myImageID <<
": doPosts(4,"
1345 << (indicesTo_.
empty () ?
"fast" :
"slow") <<
")" << endl;
1362 const size_type actualNumReceives = as<size_type> (numReceives_) +
1363 as<size_type> (selfMessage_ ? 1 : 0);
1364 requests_.resize (0);
1372 #ifdef TPETRA_DISTRIBUTOR_TIMERS
1374 #endif // TPETRA_DISTRIBUTOR_TIMERS
1376 size_t curBufferOffset = 0;
1377 size_t curLIDoffset = 0;
1378 for (size_type i = 0; i < actualNumReceives; ++i) {
1379 size_t totalPacketsFrom_i = 0;
1380 for (
size_t j = 0; j < lengthsFrom_[i]; ++j) {
1381 totalPacketsFrom_i += numImportPacketsPerLID[curLIDoffset+j];
1383 curLIDoffset += lengthsFrom_[i];
1384 if (imagesFrom_[i] != myImageID && totalPacketsFrom_i) {
1395 requests_.push_back (ireceive<int, Packet> (recvBuf, imagesFrom_[i],
1399 selfReceiveOffset = curBufferOffset;
1401 curBufferOffset += totalPacketsFrom_i;
1406 #ifdef TPETRA_DISTRIBUTOR_TIMERS
1408 #endif // TPETRA_DISTRIBUTOR_TIMERS
1417 #ifdef TPETRA_DISTRIBUTOR_TIMERS
1419 #endif // TPETRA_DISTRIBUTOR_TIMERS
1423 Array<size_t> sendPacketOffsets(numSends_,0), packetsPerSend(numSends_,0);
1424 size_t maxNumPackets = 0;
1425 size_t curPKToffset = 0;
1426 for (
size_t pp=0; pp<numSends_; ++pp) {
1427 sendPacketOffsets[pp] = curPKToffset;
1428 size_t numPackets = 0;
1429 for (
size_t j=startsTo_[pp]; j<startsTo_[pp]+lengthsTo_[pp]; ++j) {
1430 numPackets += numExportPacketsPerLID[j];
1432 if (numPackets > maxNumPackets) maxNumPackets = numPackets;
1433 packetsPerSend[pp] = numPackets;
1434 curPKToffset += numPackets;
1439 size_t numBlocks = numSends_+ selfMessage_;
1440 size_t imageIndex = 0;
1441 while ((imageIndex < numBlocks) && (imagesTo_[imageIndex] < myImageID)) {
1444 if (imageIndex == numBlocks) {
1449 size_t selfIndex = 0;
1451 if (indicesTo_.
empty()) {
1453 std::ostringstream os;
1454 os << myImageID <<
": doPosts(4,fast): posting sends" << endl;
1460 for (
size_t i = 0; i < numBlocks; ++i) {
1461 size_t p = i + imageIndex;
1462 if (p > (numBlocks - 1)) {
1466 if (imagesTo_[p] != myImageID && packetsPerSend[p] > 0) {
1468 exports.
view (sendPacketOffsets[p], packetsPerSend[p]);
1470 if (sendType == Details::DISTRIBUTOR_SEND) {
1471 send<int, Packet> (tmpSend.
getRawPtr (),
1472 as<int> (tmpSend.
size ()),
1473 imagesTo_[p], tag, *comm_);
1475 else if (sendType == Details::DISTRIBUTOR_RSEND) {
1476 readySend<int, Packet> (tmpSend.
getRawPtr (),
1477 as<int> (tmpSend.
size ()),
1478 imagesTo_[p], tag, *comm_);
1480 else if (sendType == Details::DISTRIBUTOR_ISEND) {
1482 exports.
persistingView (sendPacketOffsets[p], packetsPerSend[p]);
1483 requests_.push_back (isend<int, Packet> (tmpSendBuf, imagesTo_[p],
1486 else if (sendType == Details::DISTRIBUTOR_SSEND) {
1487 ssend<int, Packet> (tmpSend.
getRawPtr (),
1488 as<int> (tmpSend.
size ()),
1489 imagesTo_[p], tag, *comm_);
1493 "Distributor (4 args): Invalid send type. We should never get "
1494 "here. Please report this bug to the Tpetra developers.");
1503 std::copy (exports.
begin()+sendPacketOffsets[selfNum],
1504 exports.
begin()+sendPacketOffsets[selfNum]+packetsPerSend[selfNum],
1505 imports.
begin()+selfReceiveOffset);
1508 std::ostringstream os;
1509 os << myImageID <<
": doPosts(4,fast) done" << endl;
1515 std::ostringstream os;
1516 os << myImageID <<
": doPosts(4,slow): posting sends" << endl;
1524 sendType == Details::DISTRIBUTOR_ISEND, std::logic_error,
1525 "Tpetra::Distributor::doPosts<" << TypeNameTraits<Packet>::name()
1526 <<
"> (3-argument version):" << endl
1527 <<
"The \"send buffer\" code path may not necessarily work with nonblocking sends.");
1531 for (
int j=0; j<numExportPacketsPerLID.
size(); ++j) {
1532 indicesOffsets[j] = ioffset;
1533 ioffset += numExportPacketsPerLID[j];
1536 for (
size_t i = 0; i < numBlocks; ++i) {
1537 size_t p = i + imageIndex;
1538 if (p > (numBlocks - 1)) {
1542 if (imagesTo_[p] != myImageID) {
1544 size_t sendArrayOffset = 0;
1545 size_t j = startsTo_[p];
1546 size_t numPacketsTo_p = 0;
1547 for (
size_t k = 0; k < lengthsTo_[p]; ++k, ++j) {
1548 srcBegin = exports.
begin() + indicesOffsets[j];
1549 srcEnd = srcBegin + numExportPacketsPerLID[j];
1550 numPacketsTo_p += numExportPacketsPerLID[j];
1551 std::copy (srcBegin, srcEnd, sendArray.
begin()+sendArrayOffset);
1552 sendArrayOffset += numExportPacketsPerLID[j];
1554 if (numPacketsTo_p > 0) {
1556 sendArray.
view (0, numPacketsTo_p);
1558 if (sendType == Details::DISTRIBUTOR_RSEND) {
1559 readySend<int, Packet> (tmpSend.
getRawPtr (),
1560 as<int> (tmpSend.
size ()),
1561 imagesTo_[p], tag, *comm_);
1563 else if (sendType == Details::DISTRIBUTOR_ISEND) {
1566 requests_.push_back (isend<int, Packet> (tmpSendBuf, imagesTo_[p],
1569 else if (sendType == Details::DISTRIBUTOR_SSEND) {
1570 ssend<int, Packet> (tmpSend.
getRawPtr (),
1571 as<int> (tmpSend.
size ()),
1572 imagesTo_[p], tag, *comm_);
1575 send<int, Packet> (tmpSend.
getRawPtr (),
1576 as<int> (tmpSend.
size ()),
1577 imagesTo_[p], tag, *comm_);
1583 selfIndex = startsTo_[p];
1588 for (
size_t k = 0; k < lengthsTo_[selfNum]; ++k) {
1589 std::copy (exports.
begin()+indicesOffsets[selfIndex],
1590 exports.
begin()+indicesOffsets[selfIndex]+numExportPacketsPerLID[selfIndex],
1591 imports.
begin() + selfReceiveOffset);
1592 selfReceiveOffset += numExportPacketsPerLID[selfIndex];
1597 std::ostringstream os;
1598 os << myImageID <<
": doPosts(4,slow) done" << endl;
1604 template <
class Packet>
1624 exports.
size(),
false);
1631 arcp<Packet> (imports.
getRawPtr (), 0, imports.
size (),
false));
1635 template <
class Packet>
1643 using Teuchos::arcp;
1648 << requests_.size() <<
" outstanding nonblocking messages pending. It is "
1649 "incorrect to call doReversePostsAndWaits with posts outstanding.");
1664 exports.
size (),
false);
1666 numExportPacketsPerLID,
1667 arcp<Packet> (imports.
getRawPtr (), 0, imports.
size (),
false),
1668 numImportPacketsPerLID);
1672 template <
class Packet>
1681 "communication when original data are blocked by process.");
1682 if (reverseDistributor_.is_null ()) {
1683 createReverseDistributor ();
1685 reverseDistributor_->doPosts (exports, numPackets, imports);
1688 template <
class Packet>
1698 "communication when original data are blocked by process.");
1699 if (reverseDistributor_.is_null ()) {
1700 createReverseDistributor ();
1702 reverseDistributor_->doPosts (exports, numExportPacketsPerLID,
1703 imports, numImportPacketsPerLID);
1706 template <
class OrdinalType>
1725 const int myRank = comm_->getRank();
1727 std::ostringstream os;
1728 os << myRank <<
": computeSends" << endl;
1732 const size_t numImports = importNodeIDs.
size();
1734 std::invalid_argument,
"Tpetra::Distributor::computeSends: importNodeIDs."
1735 "size() = " << importNodeIDs.
size () <<
" != importIDs.size() = "
1736 << importIDs.
size () <<
".");
1738 Array<size_t> importObjs (2*numImports);
1740 for (
size_t i = 0; i < numImports; ++i ) {
1741 importObjs[2*i] = as<size_t> (importIDs[i]);
1742 importObjs[2*i+1] = as<size_t> (myRank);
1751 std::ostringstream os;
1752 os << myRank <<
": computeSends: tempPlan.createFromSends" << endl;
1755 numExports = tempPlan.createFromSends (importNodeIDs);
1756 if (numExports > 0) {
1757 exportIDs.
resize(numExports);
1758 exportNodeIDs.
resize(numExports);
1760 Array<size_t> exportObjs (tempPlan.getTotalReceiveLength () * 2);
1762 std::ostringstream os;
1763 os << myRank <<
": computeSends: tempPlan.doPostsAndWaits" << endl;
1766 tempPlan.doPostsAndWaits<
size_t> (importObjs (), 2, exportObjs ());
1769 for (
size_t i = 0; i < numExports; ++i) {
1770 exportIDs[i] = as<OrdinalType>(exportObjs[2*i]);
1771 exportNodeIDs[i] = exportObjs[2*i+1];
1775 std::ostringstream os;
1776 os << myRank <<
": computeSends done" << endl;
1781 template <
class OrdinalType>
1784 const ArrayView<const int> &remoteImageIDs,
1785 Array<OrdinalType> &exportGIDs,
1786 Array<int> &exportNodeIDs)
1791 const int myRank = comm_->getRank();
1794 *out_ << myRank <<
": createFromRecvs" << endl;
1797 #ifdef HAVE_TPETRA_DEBUG
1798 using Teuchos::outArg;
1802 (remoteIDs.size () != remoteImageIDs.size ()) ? myRank : -1;
1803 int maxErrProc = -1;
1807 "and remote process IDs must have the same size on all participating "
1808 "processes. Maximum process ID with error: " << maxErrProc <<
".");
1809 #endif // HAVE_TPETRA_DEBUG
1811 computeSends (remoteIDs, remoteImageIDs, exportGIDs, exportNodeIDs);
1815 *out_ << myRank <<
": createFromRecvs done" << endl;
1821 #endif // TPETRA_DISTRIBUTOR_HPP
size_t getNumReceives() const
The number of processes from which we will receive data.
std::string description() const
A simple one-line description of this object.
ArrayRCP< T > persistingView(size_type lowerOffset, size_type size) const
basic_OSTab< char > OSTab
ArrayView< const int > getImagesTo() const
Ranks of the processes to which this process will send values.
basic_FancyOStream< char > FancyOStream
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void doPosts(const ArrayRCP< const Packet > &exports, size_t numPackets, const ArrayRCP< Packet > &imports)
Post the data for a forward plan, but do not execute the waits yet.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
List of valid Distributor parameters.
void swap(Distributor &rhs)
Swap the contents of rhs with those of *this.
ArrayView< const size_t > getLengthsFrom() const
Number of values this process will receive from each process.
void doPostsAndWaits(const ArrayView< const Packet > &exports, size_t numPackets, const ArrayView< Packet > &imports)
Execute the (forward) communication plan.
bool hasSelfMessage() const
Whether the calling process will send or receive messages to itself.
Sets up and executes a communication plan for a Tpetra DistObject.
size_t getTotalReceiveLength() const
Total number of values this process will receive from other processes.
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &plist)
Set Distributor parameters.
size_t createFromSends(const ArrayView< const int > &exportNodeIDs)
Set up Distributor using list of process ranks to which this process will send.
TEUCHOS_DEPRECATED void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *globalReduct)
void send(const Packet sendBuffer[], const Ordinal count, const int destRank, const int tag, const Comm< Ordinal > &comm)
void resize(size_type new_size, const value_type &x=value_type())
void doReversePosts(const ArrayRCP< const Packet > &exports, size_t numPackets, const ArrayRCP< Packet > &imports)
Post the data for a reverse plan, but do not execute the waits yet.
TEUCHOSCORE_LIB_DLL_EXPORT bool includesVerbLevel(const EVerbosityLevel verbLevel, const EVerbosityLevel requestedVerbLevel, const bool isDefaultLevel=false)
static const EVerbosityLevel verbLevel_default
RCP< CommRequest< Ordinal > > ireceive(const ArrayRCP< Packet > &recvBuffer, const int sourceRank, const int tag, const Comm< Ordinal > &comm)
ArrayView< const size_t > getLengthsTo() const
Number of values this process will send to each process.
virtual ~Distributor()
Destructor (virtual for memory safety).
void doReversePostsAndWaits(const ArrayView< const Packet > &exports, size_t numPackets, const ArrayView< Packet > &imports)
Execute the reverse communication plan.
TypeTo as(const TypeFrom &t)
Stand-alone utility functions and macros.
void ssend(const Packet sendBuffer[], const Ordinal count, const int destRank, const int tag, const Comm< Ordinal > &comm)
ArrayView< const int > getImagesFrom() const
Ranks of the processes sending values to this process.
RCP< CommRequest< Ordinal > > isend(const ArrayRCP< const Packet > &sendBuffer, const int destRank, const int tag, const Comm< Ordinal > &comm)
size_t getNumSends() const
The number of processes to which we will send data.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream.
size_t getMaxSendLength() const
Maximum number of values this process will send to another single process.
Array< std::string > distributorSendTypes()
Valid values for Distributor's "Send type" parameter.
void createFromRecvs(const ArrayView< const Ordinal > &remoteIDs, const ArrayView< const int > &remoteNodeIDs, Array< Ordinal > &exportIDs, Array< int > &exportNodeIDs)
Set up Distributor using list of process ranks from which to receive.
void readySend(const Packet sendBuffer[], const Ordinal count, const int destRank, const int tag, const Comm< Ordinal > &comm)
std::string typeName(const T &t)
const RCP< Distributor > & getReverse() const
A reverse communication plan Distributor.
Distributor(const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Construct using the specified communicator and default parameters.
ArrayView< T > view(size_type lowerOffset, size_type size) const