42 #include "Tpetra_Distributor.hpp" 43 #include "Teuchos_StandardParameterEntryValidators.hpp" 44 #include "Teuchos_VerboseObjectParameterListHelpers.hpp" 50 DistributorSendTypeEnumToString (EDistributorSendType sendType)
52 if (sendType == DISTRIBUTOR_ISEND) {
55 else if (sendType == DISTRIBUTOR_RSEND) {
58 else if (sendType == DISTRIBUTOR_SEND) {
61 else if (sendType == DISTRIBUTOR_SSEND) {
66 "EDistributorSendType enum value " << sendType <<
".");
88 const bool tpetraDistributorDebugDefault =
false;
90 const bool barrierBetween_default =
false;
92 const bool useDistinctTags_default =
true;
95 int Distributor::getTag (
const int pathTag)
const {
96 return useDistinctTags_ ? pathTag : comm_->getTag ();
100 #ifdef TPETRA_DISTRIBUTOR_TIMERS 101 void Distributor::makeTimers () {
102 const std::string name_doPosts3 =
"Tpetra::Distributor: doPosts(3)";
103 const std::string name_doPosts4 =
"Tpetra::Distributor: doPosts(4)";
104 const std::string name_doWaits =
"Tpetra::Distributor: doWaits";
105 const std::string name_doPosts3_recvs =
"Tpetra::Distributor: doPosts(3): recvs";
106 const std::string name_doPosts4_recvs =
"Tpetra::Distributor: doPosts(4): recvs";
107 const std::string name_doPosts3_barrier =
"Tpetra::Distributor: doPosts(3): barrier";
108 const std::string name_doPosts4_barrier =
"Tpetra::Distributor: doPosts(4): barrier";
109 const std::string name_doPosts3_sends =
"Tpetra::Distributor: doPosts(3): sends";
110 const std::string name_doPosts4_sends =
"Tpetra::Distributor: doPosts(4): sends";
122 #endif // TPETRA_DISTRIBUTOR_TIMERS 129 this->setOStream (out_);
133 this->setParameterList (plist);
136 #ifdef TPETRA_DISTRIBUTOR_TIMERS 138 #endif // TPETRA_DISTRIBUTOR_TIMERS 142 std::ostringstream os;
143 os << comm_->getRank ()
144 <<
": Distributor ctor done" << std::endl;
151 , out_ (
Teuchos::getFancyOStream (
Teuchos::rcpFromRef (std::cerr)))
152 , sendType_ (
Details::DISTRIBUTOR_SEND)
153 , barrierBetween_ (barrierBetween_default)
154 , debug_ (tpetraDistributorDebugDefault)
156 , selfMessage_ (false)
160 , totalReceiveLength_ (0)
161 , useDistinctTags_ (useDistinctTags_default)
163 init (comm, Teuchos::null);
170 , sendType_ (
Details::DISTRIBUTOR_SEND)
171 , barrierBetween_ (barrierBetween_default)
172 , debug_ (tpetraDistributorDebugDefault)
174 , selfMessage_ (false)
178 , totalReceiveLength_ (0)
179 , useDistinctTags_ (useDistinctTags_default)
181 init (comm, Teuchos::null);
187 , out_ (
Teuchos::getFancyOStream (
Teuchos::rcpFromRef (std::cerr)))
188 , sendType_ (
Details::DISTRIBUTOR_SEND)
189 , barrierBetween_ (barrierBetween_default)
190 , debug_ (tpetraDistributorDebugDefault)
192 , selfMessage_ (false)
196 , totalReceiveLength_ (0)
197 , useDistinctTags_ (useDistinctTags_default)
207 , sendType_ (
Details::DISTRIBUTOR_SEND)
208 , barrierBetween_ (barrierBetween_default)
209 , debug_ (tpetraDistributorDebugDefault)
211 , selfMessage_ (false)
215 , totalReceiveLength_ (0)
216 , useDistinctTags_ (useDistinctTags_default)
222 : comm_ (distributor.comm_)
223 , out_ (distributor.out_)
224 , sendType_ (distributor.sendType_)
225 , barrierBetween_ (distributor.barrierBetween_)
226 , debug_ (distributor.debug_)
227 , numExports_ (distributor.numExports_)
228 , selfMessage_ (distributor.selfMessage_)
229 , numSends_ (distributor.numSends_)
230 , imagesTo_ (distributor.imagesTo_)
231 , startsTo_ (distributor.startsTo_)
232 , lengthsTo_ (distributor.lengthsTo_)
233 , maxSendLength_ (distributor.maxSendLength_)
234 , indicesTo_ (distributor.indicesTo_)
235 , numReceives_ (distributor.numReceives_)
236 , totalReceiveLength_ (distributor.totalReceiveLength_)
237 , lengthsFrom_ (distributor.lengthsFrom_)
238 , imagesFrom_ (distributor.imagesFrom_)
239 , startsFrom_ (distributor.startsFrom_)
240 , indicesFrom_ (distributor.indicesFrom_)
241 , reverseDistributor_ (distributor.reverseDistributor_)
242 , useDistinctTags_ (distributor.useDistinctTags_)
245 using Teuchos::parameterList;
265 #ifdef TPETRA_DISTRIBUTOR_TIMERS 267 #endif // TPETRA_DISTRIBUTOR_TIMERS 271 std::ostringstream os;
272 os << comm_->getRank ()
273 <<
": Distributor copy ctor done" << std::endl;
280 using Teuchos::parameterList;
283 std::swap (comm_, rhs.comm_);
284 std::swap (out_, rhs.out_);
285 std::swap (sendType_, rhs.sendType_);
286 std::swap (barrierBetween_, rhs.barrierBetween_);
287 std::swap (debug_, rhs.debug_);
288 std::swap (numExports_, rhs.numExports_);
289 std::swap (selfMessage_, rhs.selfMessage_);
290 std::swap (numSends_, rhs.numSends_);
291 std::swap (imagesTo_, rhs.imagesTo_);
292 std::swap (startsTo_, rhs.startsTo_);
293 std::swap (lengthsTo_, rhs.lengthsTo_);
294 std::swap (maxSendLength_, rhs.maxSendLength_);
295 std::swap (indicesTo_, rhs.indicesTo_);
296 std::swap (numReceives_, rhs.numReceives_);
297 std::swap (totalReceiveLength_, rhs.totalReceiveLength_);
298 std::swap (lengthsFrom_, rhs.lengthsFrom_);
299 std::swap (imagesFrom_, rhs.imagesFrom_);
300 std::swap (startsFrom_, rhs.startsFrom_);
301 std::swap (indicesFrom_, rhs.indicesFrom_);
302 std::swap (reverseDistributor_, rhs.reverseDistributor_);
303 std::swap (useDistinctTags_, rhs.useDistinctTags_);
321 rhsList = parameterList (*rhsList);
339 "Tpetra::Distributor: Destructor called with " << requests_.size()
340 <<
" outstanding posts (unfulfilled communication requests). There " 341 "should be none at this point. Please report this bug to the Tpetra " 349 using Teuchos::getIntegralValue;
353 using Teuchos::parameterList;
360 const bool barrierBetween =
361 plist->
get<
bool> (
"Barrier between receives and sends");
362 const Details::EDistributorSendType sendType =
363 getIntegralValue<Details::EDistributorSendType> (*plist,
"Send type");
364 const bool useDistinctTags = plist->get<
bool> (
"Use distinct tags");
365 const bool debug = plist->get<
bool> (
"Debug");
372 ! barrierBetween && sendType == Details::DISTRIBUTOR_RSEND,
373 std::invalid_argument,
"Tpetra::Distributor::setParameterList: " << endl
374 <<
"You specified \"Send type\"=\"Rsend\", but turned off the barrier " 375 "between receives and sends." << endl <<
"This is invalid; you must " 376 "include the barrier if you use ready sends." << endl <<
"Ready sends " 377 "require that their corresponding receives have already been posted, " 378 "and the only way to guarantee that in general is with a barrier.");
380 if (plist->isSublist (
"VerboseObject")) {
384 Teuchos::readVerboseObjectSublist (&*plist,
this);
388 sendType_ = sendType;
389 barrierBetween_ = barrierBetween;
390 useDistinctTags_ = useDistinctTags;
403 using Teuchos::parameterList;
405 using Teuchos::setStringToIntegralParameter;
407 const bool barrierBetween = barrierBetween_default;
408 const bool useDistinctTags = useDistinctTags_default;
409 const bool debug = tpetraDistributorDebugDefault;
412 const std::string defaultSendType (
"Send");
414 sendTypeEnums.
push_back (Details::DISTRIBUTOR_ISEND);
415 sendTypeEnums.
push_back (Details::DISTRIBUTOR_RSEND);
416 sendTypeEnums.
push_back (Details::DISTRIBUTOR_SEND);
417 sendTypeEnums.
push_back (Details::DISTRIBUTOR_SSEND);
420 plist->set (
"Barrier between receives and sends", barrierBetween,
421 "Whether to execute a barrier between receives and sends in do" 422 "[Reverse]Posts(). Required for correctness when \"Send type\"" 423 "=\"Rsend\", otherwise correct but not recommended.");
424 setStringToIntegralParameter<Details::EDistributorSendType> (
"Send type",
425 defaultSendType,
"When using MPI, the variant of send to use in " 426 "do[Reverse]Posts()", sendTypes(), sendTypeEnums(), plist.
getRawPtr());
427 plist->set (
"Use distinct tags", useDistinctTags,
"Whether to use distinct " 428 "MPI message tags for different code paths.");
429 plist->set (
"Debug", debug,
"Whether to print copious debugging output on " 432 Teuchos::setupVerboseObjectSublist (&*plist);
438 {
return totalReceiveLength_; }
441 {
return numReceives_; }
444 {
return selfMessage_; }
447 {
return numSends_; }
450 {
return maxSendLength_; }
453 {
return imagesFrom_; }
456 {
return lengthsFrom_; }
459 {
return imagesTo_; }
462 {
return lengthsTo_; }
466 if (reverseDistributor_ == Teuchos::null) {
468 createReverseDistributor();
470 return reverseDistributor_;
475 Distributor::createReverseDistributor()
const 482 size_t totalSendLength =
483 std::accumulate (lengthsTo_.
begin(), lengthsTo_.
end(), 0);
488 size_t maxReceiveLength = 0;
489 const int myImageID = comm_->getRank();
490 for (
size_t i=0; i < numReceives_; ++i) {
491 if (imagesFrom_[i] != myImageID) {
493 if (lengthsFrom_[i] > maxReceiveLength) {
494 maxReceiveLength = lengthsFrom_[i];
502 reverseDistributor_->lengthsTo_ = lengthsFrom_;
503 reverseDistributor_->imagesTo_ = imagesFrom_;
504 reverseDistributor_->indicesTo_ = indicesFrom_;
505 reverseDistributor_->startsTo_ = startsFrom_;
506 reverseDistributor_->lengthsFrom_ = lengthsTo_;
507 reverseDistributor_->imagesFrom_ = imagesTo_;
508 reverseDistributor_->indicesFrom_ = indicesTo_;
509 reverseDistributor_->startsFrom_ = startsTo_;
510 reverseDistributor_->numSends_ = numReceives_;
511 reverseDistributor_->numReceives_ = numSends_;
512 reverseDistributor_->selfMessage_ = selfMessage_;
513 reverseDistributor_->maxSendLength_ = maxReceiveLength;
514 reverseDistributor_->totalReceiveLength_ = totalSendLength;
530 using Teuchos::waitAll;
535 #ifdef TPETRA_DISTRIBUTOR_TIMERS 537 #endif // TPETRA_DISTRIBUTOR_TIMERS 539 const int myRank = comm_->getRank ();
542 std::ostringstream os;
543 os << myRank <<
": doWaits: # reqs = " 544 << requests_.size () << endl;
548 if (requests_.size() > 0) {
549 waitAll (*comm_, requests_());
551 #ifdef HAVE_TEUCHOS_DEBUG 554 it != requests_.end(); ++it)
558 "should all be null aftr calling Teuchos::waitAll() on them, but " 559 "at least one request is not null.");
561 #endif // HAVE_TEUCHOS_DEBUG 564 requests_.resize (0);
567 #ifdef HAVE_TEUCHOS_DEBUG 569 const int localSizeNonzero = (requests_.size () != 0) ? 1 : 0;
570 int globalSizeNonzero = 0;
571 Teuchos::reduceAll<int, int> (*comm_, Teuchos::REDUCE_MAX,
573 Teuchos::outArg (globalSizeNonzero));
575 globalSizeNonzero != 0, std::runtime_error,
576 "Tpetra::Distributor::doWaits: After waitAll, at least one process has " 577 "a nonzero number of outstanding posts. There should be none at this " 578 "point. Please report this bug to the Tpetra developers.");
580 #endif // HAVE_TEUCHOS_DEBUG 583 std::ostringstream os;
584 os << myRank <<
": doWaits done" << endl;
591 if (! reverseDistributor_.is_null()) {
592 reverseDistributor_->doWaits();
597 std::ostringstream oss;
616 const int myImageID = comm_->getRank();
617 const int numImages = comm_->getSize();
623 if (myImageID == 0) {
627 out <<
"\"Tpetra::Distributor\":" << endl;
631 out <<
"Label: " << label << endl;
633 out <<
"Parameters: " << endl;
636 out <<
"\"Send type\": " 637 << DistributorSendTypeEnumToString (sendType_) << endl
638 <<
"\"Barrier between receives and sends\": " 639 << (barrierBetween_ ?
"true" :
"false") << endl;
640 out <<
"\"Use distinct tags\": " 641 << (useDistinctTags_ ?
"true" :
"false") << endl;
642 out <<
"\"Debug\": " << (debug_ ?
"true" :
"false") << endl;
653 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
654 if (myImageID == imageCtr) {
655 if (myImageID == 0) {
656 out <<
"Number of processes: " << numImages << endl;
658 out <<
"Process: " << myImageID << endl;
663 out <<
"imagesTo: " <<
toString (imagesTo_) << endl;
664 out <<
"lengthsTo: " <<
toString (lengthsTo_) << endl;
668 out <<
"startsTo: " <<
toString (startsTo_) << endl;
669 out <<
"indicesTo: " <<
toString (indicesTo_) << endl;
674 out <<
"lengthsFrom: " <<
toString (lengthsFrom_) << endl;
675 out <<
"startsFrom: " <<
toString (startsFrom_) << endl;
676 out <<
"imagesFrom: " <<
toString (imagesFrom_) << endl;
693 Distributor::computeReceives ()
702 using Teuchos::REDUCE_SUM;
703 using Teuchos::receive;
704 using Teuchos::reduceAllAndScatter;
706 using Teuchos::waitAll;
710 const int myRank = comm_->getRank();
711 const int numProcs = comm_->getSize();
714 const int pathTag = 2;
715 const int tag = this->getTag (pathTag);
718 std::ostringstream os;
719 os << myRank <<
": computeReceives: " 720 "{selfMessage_: " << (selfMessage_ ?
"true" :
"false")
721 <<
", tag: " << tag <<
"}" << endl;
732 #ifdef HAVE_TEUCHOS_DEBUG 733 bool counting_error =
false;
734 #endif // HAVE_TEUCHOS_DEBUG 735 for (
size_t i = 0; i < (numSends_ + (selfMessage_ ? 1 : 0)); ++i) {
736 #ifdef HAVE_TEUCHOS_DEBUG 737 if (toNodesFromMe[imagesTo_[i]] != 0) {
738 counting_error =
true;
740 #endif // HAVE_TEUCHOS_DEBUG 741 toNodesFromMe[imagesTo_[i]] = 1;
743 #ifdef HAVE_TEUCHOS_DEBUG 745 "Tpetra::Distributor::computeReceives: There was an error on at least " 746 "one process in counting the number of messages send by that process to " 747 "the other processs. Please report this bug to the Tpetra developers.",
749 #endif // HAVE_TEUCHOS_DEBUG 752 std::ostringstream os;
753 os << myRank <<
": computeReceives: " 754 "Calling reduceAllAndScatter" << endl;
802 int numReceivesAsInt = 0;
803 reduceAllAndScatter<int, int> (*comm_, REDUCE_SUM, numProcs,
807 numReceives_ = Teuchos::as<size_t> (numReceivesAsInt);
813 lengthsFrom_.
assign (numReceives_, 0);
814 imagesFrom_.
assign (numReceives_, 0);
830 const size_t actualNumReceives = numReceives_ - (selfMessage_ ? 1 : 0);
842 const int anySourceProc = -1;
845 std::ostringstream os;
846 os << myRank <<
": computeReceives: Posting " 847 << actualNumReceives <<
" irecvs" << endl;
852 for (
size_t i = 0; i < actualNumReceives; ++i) {
857 lengthsFromBuffers[i].
resize (1);
858 lengthsFromBuffers[i][0] = as<size_t> (0);
859 requests[i] = ireceive<int, size_t> (lengthsFromBuffers[i], anySourceProc, tag, *comm_);
861 std::ostringstream os;
862 os << myRank <<
": computeReceives: " 863 "Posted any-proc irecv w/ specified tag " << tag << endl;
869 std::ostringstream os;
870 os << myRank <<
": computeReceives: " 871 "posting " << numSends_ <<
" sends" << endl;
882 for (
size_t i = 0; i < numSends_ + (selfMessage_ ? 1 : 0); ++i) {
883 if (imagesTo_[i] != myRank) {
887 const size_t*
const lengthsTo_i = &lengthsTo_[i];
888 send<int, size_t> (lengthsTo_i, 1, as<int> (imagesTo_[i]), tag, *comm_);
890 std::ostringstream os;
891 os << myRank <<
": computeReceives: " 892 "Posted send to Proc " << imagesTo_[i] <<
" w/ specified tag " 904 lengthsFrom_[numReceives_-1] = lengthsTo_[i];
905 imagesFrom_[numReceives_-1] = myRank;
910 std::ostringstream os;
911 os << myRank <<
": computeReceives: waitAll on " 912 << requests.
size () <<
" requests" << endl;
921 waitAll (*comm_, requests (), statuses ());
922 for (
size_t i = 0; i < actualNumReceives; ++i) {
923 lengthsFrom_[i] = *lengthsFromBuffers[i];
924 imagesFrom_[i] = statuses[i]->getSourceRank ();
933 totalReceiveLength_ = std::accumulate (lengthsFrom_.
begin(), lengthsFrom_.
end(), 0);
934 indicesFrom_.
clear ();
935 indicesFrom_.
reserve (totalReceiveLength_);
936 for (
size_t i = 0; i < totalReceiveLength_; ++i) {
940 startsFrom_.
clear ();
941 startsFrom_.
reserve (numReceives_);
942 for (
size_t i = 0, j = 0; i < numReceives_; ++i) {
944 j += lengthsFrom_[i];
952 std::ostringstream os;
953 os << myRank <<
": computeReceives: done" << endl;
961 using Teuchos::outArg;
962 using Teuchos::REDUCE_MAX;
968 numExports_ = exportNodeIDs.
size();
970 const int myImageID = comm_->getRank();
971 const int numImages = comm_->getSize();
973 std::ostringstream os;
974 os << myImageID <<
": createFromSends" << endl;
1019 size_t numActive = 0;
1020 int needSendBuff = 0;
1023 for (
size_t i = 0; i < numExports_; ++i) {
1024 int exportID = exportNodeIDs[i];
1025 if (exportID >= numImages) {
1029 else if (exportID >= 0) {
1043 if (needSendBuff==0 && starts[exportID] > 1 && exportID != exportNodeIDs[i-1]) {
1050 #ifdef HAVE_TPETRA_DEBUG 1057 reduceAll<int, int> (*comm_, REDUCE_MAX, badID, outArg (gbl_badID));
1060 <<
", perhaps among other processes, got a bad send process ID.");
1078 #endif // HAVE_TPETRA_DEBUG 1080 #if defined(HAVE_TPETRA_THROW_EFFICIENCY_WARNINGS) || defined(HAVE_TPETRA_PRINT_EFFICIENCY_WARNINGS) 1082 int global_needSendBuff;
1083 reduceAll<int, int> (*comm_, REDUCE_MAX, needSendBuff,
1084 outArg (global_needSendBuff));
1086 global_needSendBuff != 0, std::runtime_error,
1087 "::createFromSends: Grouping export IDs together by process rank often " 1088 "improves performance.");
1094 if (starts[myImageID] != 0) {
1095 selfMessage_ =
true;
1098 selfMessage_ =
false;
1101 #ifdef HAVE_TEUCHOS_DEBUG 1102 bool index_neq_numActive =
false;
1103 bool send_neq_numSends =
false;
1105 if (! needSendBuff) {
1110 for (
int i = 0; i < numImages; ++i) {
1121 imagesTo_.
assign(numSends_,0);
1122 startsTo_.
assign(numSends_,0);
1123 lengthsTo_.
assign(numSends_,0);
1130 size_t index = 0, nodeIndex = 0;
1131 for (
size_t i = 0; i < numSends_; ++i) {
1132 while (exportNodeIDs[nodeIndex] < 0) {
1135 startsTo_[i] = nodeIndex;
1136 int imageID = exportNodeIDs[nodeIndex];
1137 imagesTo_[i] = imageID;
1138 index += starts[imageID];
1139 nodeIndex += starts[imageID];
1141 #ifdef HAVE_TEUCHOS_DEBUG 1142 if (index != numActive) {
1143 index_neq_numActive =
true;
1149 if (numSends_ > 0) {
1154 for (
size_t i = 0; i < numSends_; ++i) {
1155 int imageID = imagesTo_[i];
1156 lengthsTo_[i] = starts[imageID];
1157 if ((imageID != myImageID) && (lengthsTo_[i] > maxSendLength_)) {
1158 maxSendLength_ = lengthsTo_[i];
1169 if (starts[0] == 0 ) {
1177 i != starts.
end(); ++i)
1179 if (*i != 0) ++numSends_;
1187 i != starts.
rend(); ++i)
1196 indicesTo_.
resize(numActive);
1198 for (
size_t i = 0; i < numExports_; ++i) {
1199 if (exportNodeIDs[i] >= 0) {
1201 indicesTo_[starts[exportNodeIDs[i]]] = i;
1203 ++starts[exportNodeIDs[i]];
1215 for (
int node = numImages-1; node != 0; --node) {
1216 starts[node] = starts[node-1];
1219 starts[numImages] = numActive;
1226 imagesTo_.
resize(numSends_);
1227 startsTo_.
resize(numSends_);
1228 lengthsTo_.
resize(numSends_);
1235 for (
int node = 0; node < numImages; ++node ) {
1236 if (starts[node+1] != starts[node]) {
1237 lengthsTo_[snd] = starts[node+1] - starts[node];
1238 startsTo_[snd] = starts[node];
1240 if ((node != myImageID) && (lengthsTo_[snd] > maxSendLength_)) {
1241 maxSendLength_ = lengthsTo_[snd];
1243 imagesTo_[snd] = node;
1247 #ifdef HAVE_TEUCHOS_DEBUG 1248 if (snd != numSends_) {
1249 send_neq_numSends =
true;
1253 #ifdef HAVE_TEUCHOS_DEBUG 1255 "Tpetra::Distributor::createFromSends: logic error. Please notify the Tpetra team.",*comm_);
1257 "Tpetra::Distributor::createFromSends: logic error. Please notify the Tpetra team.",*comm_);
1260 if (selfMessage_) --numSends_;
1266 std::ostringstream os;
1267 os << myImageID <<
": createFromSends: done" << endl;
1270 return totalReceiveLength_;
Namespace Tpetra contains the class and methods constituting the Tpetra library.
void reserve(size_type n)
virtual std::string getObjectLabel() const
size_t getNumReceives() const
The number of processes from which we will receive data.
bool is_null(const boost::shared_ptr< T > &p)
std::string description() const
A simple one-line description of this object.
basic_OSTab< char > OSTab
ArrayView< const int > getImagesTo() const
Ranks of the processes to which this process will send values.
T & get(const std::string &name, T def_value)
basic_FancyOStream< char > FancyOStream
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
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.
static RCP< Time > getNewTimer(const std::string &name)
Implementation details of Tpetra.
virtual const VerboseObjectBase & setOStream(const RCP< FancyOStream > &oStream) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
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.
virtual std::string description() const
TEUCHOSCORE_LIB_DLL_EXPORT std::string toString(const EVerbosityLevel verbLevel)
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &plist)
Set Distributor parameters.
void setMyParamList(const RCP< ParameterList > ¶mList)
void validateParametersAndSetDefaults(ParameterList const &validParamList, int const depth=1000)
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())
virtual const VerboseObject & setVerbLevel(const EVerbosityLevel verbLevel) const
TEUCHOSCORE_LIB_DLL_EXPORT bool includesVerbLevel(const EVerbosityLevel verbLevel, const EVerbosityLevel requestedVerbLevel, const bool isDefaultLevel=false)
#define TPETRA_EFFICIENCY_WARNING(throw_exception_test, Exception, msg)
Print or throw an efficency warning.
RCP< ParameterList > getNonconstParameterList()
reverse_iterator rbegin()
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 push_back(const value_type &x)
void sort2(const IT1 &first1, const IT1 &last1, const IT2 &first2)
Sort the first array, and apply the resulting permutation to the second array.
TypeTo as(const TypeFrom &t)
ArrayView< const int > getImagesFrom() const
Ranks of the processes sending values to this process.
size_t getNumSends() const
The number of processes to which we will send data.
void assign(size_type n, const value_type &val)
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.
#define SHARED_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg, comm)
Test for exception, with reduction over the given communicator.
Array< std::string > distributorSendTypes()
Valid values for Distributor's "Send type" parameter.
std::vector< T >::iterator iterator
virtual EVerbosityLevel getVerbLevel() const
RCP< const ParameterList > getParameterList() const
std::vector< T >::reverse_iterator reverse_iterator
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.