Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Details_Transfer_def.hpp
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TPETRA_DETAILS_TRANSFER_DEF_HPP
11#define TPETRA_DETAILS_TRANSFER_DEF_HPP
12
14#include "Tpetra_Distributor.hpp"
15#include "Tpetra_ImportExportData.hpp"
16#include "Tpetra_Map.hpp"
17#include "Teuchos_CommHelpers.hpp"
18#include "Teuchos_TypeNameTraits.hpp"
19#include <sstream>
20
21namespace { // (anonymous)
22
23 // Assume that dv is sync'd.
24 template<class ElementType, class DeviceType>
25 Teuchos::ArrayView<const ElementType>
26 makeConstArrayViewFromDualView (const Kokkos::DualView<ElementType*, DeviceType>& dv)
27 {
28 TEUCHOS_ASSERT( ! dv.need_sync_host () );
29 auto hostView = dv.view_host ();
30 const auto size = hostView.extent (0);
31 return Teuchos::ArrayView<const ElementType> (size == 0 ? nullptr : hostView.data (), size);
32 }
33
34 template<class DeviceType, class LocalOrdinal>
35 struct OrderedViewFunctor {
36 OrderedViewFunctor (const Kokkos::View<LocalOrdinal*, DeviceType>& viewToCheck) :
37 viewToCheck_ (viewToCheck) {}
38 KOKKOS_INLINE_FUNCTION void operator() (const size_t i, unsigned int& isUnordered) const {
39 isUnordered |= static_cast<unsigned int>(viewToCheck_(i)+1 != viewToCheck_(i+1));
40 }
41 Kokkos::View<const LocalOrdinal*, DeviceType> viewToCheck_;
42 };
43
44 template<class DeviceType, class LocalOrdinal>
45 bool
46 isViewOrdered (const Kokkos::View<LocalOrdinal*, DeviceType>& viewToCheck)
47 {
48 using Kokkos::parallel_reduce;
49 typedef DeviceType DT;
50 typedef typename DT::execution_space DES;
51 typedef Kokkos::RangePolicy<DES, size_t> range_type;
52
53 const size_t size = viewToCheck.extent (0);
54 unsigned int isUnordered = 0;
55 if (size>1)
56 parallel_reduce ("isViewOrdered",
57 range_type (0, size-1),
58 OrderedViewFunctor<DeviceType, LocalOrdinal> (viewToCheck),
59 isUnordered);
60 return isUnordered == 0;
61 }
62
63} // namespace (anonymous)
64
65namespace Tpetra {
66namespace Details {
67
68template <class LO, class GO, class NT>
69Transfer<LO, GO, NT>::
70Transfer (const Teuchos::RCP<const map_type>& source,
71 const Teuchos::RCP<const map_type>& target,
72 const Teuchos::RCP<Teuchos::FancyOStream>& out,
73 const Teuchos::RCP<Teuchos::ParameterList>& plist,
74 const std::string& className) :
75 TransferData_ (new ImportExportData<LO, GO, NT> (source, target, out, plist))
76{
77 TEUCHOS_ASSERT( ! TransferData_->out_.is_null () );
78 this->setParameterList (plist, className);
79}
80
81template <class LO, class GO, class NT>
82Transfer<LO, GO, NT>::
83Transfer (const Transfer<LO, GO, NT>& rhs, reverse_tag)
84{
85 TEUCHOS_ASSERT( ! (rhs.TransferData_).is_null () );
86 this->TransferData_ = rhs.TransferData_->reverseClone ();
87 TEUCHOS_ASSERT( ! this->TransferData_->out_.is_null () );
88}
89
90template <class LO, class GO, class NT>
91void
93setParameterList (const Teuchos::RCP<Teuchos::ParameterList>& plist,
94 const std::string& className)
95{
97
98 const bool verboseEnv = Behavior::verbose (className.c_str ()) ||
99 Behavior::verbose ((std::string ("Tpetra::") + className).c_str ());
100
101 bool verboseParam = false;
102 if (! plist.is_null ()) {
103 // FIXME (mfh 03 Feb 2019) Phase out these parameters in favor of
104 // TPETRA_VERBOSE.
105 if (plist->isType<bool> ("Verbose")) {
106 verboseParam = plist->get<bool> ("Verbose");
107 }
108 else if (plist->isType<bool> ("Debug")) { // backwards compat
109 verboseParam = plist->get<bool> ("Debug");
110 }
111 }
112 this->TransferData_->verbose_ = verboseEnv || verboseParam;
113}
114
115template <class LO, class GO, class NT>
116size_t
118getNumSameIDs () const {
119 return TransferData_->numSameIDs_;
120}
121
122template <class LO, class GO, class NT>
123size_t
125getNumPermuteIDs () const {
126 return static_cast<size_t> (TransferData_->permuteFromLIDs_.extent (0));
127}
128
129template <class LO, class GO, class NT>
130Kokkos::DualView<const LO*, typename Transfer<LO, GO, NT>::device_type>
132getPermuteFromLIDs_dv () const {
133 const auto& dv = TransferData_->permuteFromLIDs_;
134 TEUCHOS_TEST_FOR_EXCEPTION
135 (dv.need_sync_device (), std::logic_error,
136 "Tpetra::Details::Transfer::getPermuteFromLIDs_dv: "
137 "DualView needs sync to device" );
138 TEUCHOS_TEST_FOR_EXCEPTION
139 (dv.need_sync_host (), std::logic_error,
140 "Tpetra::Details::Transfer::getPermuteFromLIDs_dv: "
141 "DualView needs sync to host" );
142 return dv;
143}
144
145template <class LO, class GO, class NT>
146Teuchos::ArrayView<const LO>
148getPermuteFromLIDs () const {
149 return makeConstArrayViewFromDualView (TransferData_->permuteFromLIDs_);
150}
151
152template <class LO, class GO, class NT>
153Kokkos::DualView<const LO*, typename Transfer<LO, GO, NT>::device_type>
155getPermuteToLIDs_dv () const {
156 const auto& dv = TransferData_->permuteToLIDs_;
157 TEUCHOS_TEST_FOR_EXCEPTION
158 (dv.need_sync_device (), std::logic_error,
159 "Tpetra::Details::Transfer::getPermuteToLIDs_dv: "
160 "DualView needs sync to device" );
161 TEUCHOS_TEST_FOR_EXCEPTION
162 (dv.need_sync_host (), std::logic_error,
163 "Tpetra::Details::Transfer::getPermuteToLIDs_dv: "
164 "DualView needs sync to host" );
165 return dv;
166}
167
168template <class LO, class GO, class NT>
169Teuchos::ArrayView<const LO>
171getPermuteToLIDs () const {
172 return makeConstArrayViewFromDualView (TransferData_->permuteToLIDs_);
173}
174
175template <class LO, class GO, class NT>
176size_t
178getNumRemoteIDs () const {
179 return static_cast<size_t> (TransferData_->remoteLIDs_.extent (0));
180}
181
182template <class LO, class GO, class NT>
183Kokkos::DualView<const LO*, typename Transfer<LO, GO, NT>::device_type>
185getRemoteLIDs_dv () const {
186 const auto& dv = TransferData_->remoteLIDs_;
187 TEUCHOS_TEST_FOR_EXCEPTION
188 (dv.need_sync_device (), std::logic_error,
189 "Tpetra::Details::Transfer::getRemoteLIDs_dv: "
190 "DualView needs sync to device" );
191 TEUCHOS_TEST_FOR_EXCEPTION
192 (dv.need_sync_host (), std::logic_error,
193 "Tpetra::Details::Transfer::getRemoteLIDs_dv: "
194 "DualView needs sync to host" );
195 return dv;
196}
197
198template <class LO, class GO, class NT>
199Teuchos::ArrayView<const LO>
201getRemoteLIDs () const {
202 return makeConstArrayViewFromDualView (TransferData_->remoteLIDs_);
203}
204
205template <class LO, class GO, class NT>
206size_t
208getNumExportIDs () const {
209 return static_cast<size_t> (TransferData_->exportLIDs_.extent (0));
210}
211
212template <class LO, class GO, class NT>
213Kokkos::DualView<const LO*, typename Transfer<LO, GO, NT>::device_type>
215getExportLIDs_dv () const {
216 const auto& dv = TransferData_->exportLIDs_;
217 TEUCHOS_TEST_FOR_EXCEPTION
218 (dv.need_sync_device (), std::logic_error,
219 "Tpetra::Details::Transfer::getExportLIDs_dv: "
220 "DualView needs sync to device" );
221 TEUCHOS_TEST_FOR_EXCEPTION
222 (dv.need_sync_host (), std::logic_error,
223 "Tpetra::Details::Transfer::getExportLIDs_dv: "
224 "DualView needs sync to host" );
225 return dv;
226}
227
228template <class LO, class GO, class NT>
229Teuchos::ArrayView<const LO>
231getExportLIDs () const {
232 return makeConstArrayViewFromDualView (TransferData_->exportLIDs_);
233}
234
235template <class LO, class GO, class NT>
236Teuchos::ArrayView<const int>
238getExportPIDs () const {
239 return TransferData_->exportPIDs_ ();
240}
241
242template <class LO, class GO, class NT>
243Teuchos::RCP<const typename Transfer<LO, GO, NT>::map_type>
245getSourceMap () const {
246 return TransferData_->source_;
247}
248
249template <class LO, class GO, class NT>
250Teuchos::RCP<const typename Transfer<LO, GO, NT>::map_type>
252getTargetMap () const {
253 return TransferData_->target_;
254}
255
256template <class LO, class GO, class NT>
259getDistributor () const {
260 return TransferData_->distributor_;
261}
262
263template <class LO, class GO, class NT>
264bool
266isLocallyComplete () const {
267 return TransferData_->isLocallyComplete_;
268}
269
270template <class LO, class GO, class NT>
271bool
273isLocallyFitted () const {
274 return (getNumSameIDs() == std::min(getSourceMap()->getLocalNumElements(),
275 getTargetMap()->getLocalNumElements()));
276}
277
278template <class LO, class GO, class NT>
279void
282
283 // Check that maps are locally fitted
284 // TODO: We really want to check here that remote LIDs are sorted last.
285 // The current check is too restrictive in special cases.
286 bool ordered = (getNumSameIDs() == std::min(getSourceMap()->getLocalNumElements(),
287 getTargetMap()->getLocalNumElements()));
288 ordered &= (getTargetMap()->getLocalNumElements() == getNumSameIDs() + getNumRemoteIDs());
289 if (ordered) {
290 const auto& dv = TransferData_->remoteLIDs_;
291 TEUCHOS_TEST_FOR_EXCEPTION
292 (dv.need_sync_device (), std::logic_error,
293 "Tpetra::Details::Transfer::getRemoteLIDs_dv: "
294 "DualView needs sync to device" );
295 auto v_d = dv.view_device ();
296 ordered &= isViewOrdered<device_type, LO>(v_d);
297 }
298 TransferData_->remoteLIDsContiguous_ = ordered;
299
300 ordered = (getNumSameIDs() == std::min(getSourceMap()->getLocalNumElements(),
301 getTargetMap()->getLocalNumElements()));
302 ordered &= (getSourceMap()->getLocalNumElements() == getNumSameIDs() + getNumExportIDs());
303 if (ordered) {
304 const auto& dv = TransferData_->exportLIDs_;
305 TEUCHOS_TEST_FOR_EXCEPTION
306 (dv.need_sync_device (), std::logic_error,
307 "Tpetra::Details::Transfer::getRemoteLIDs_dv: "
308 "DualView needs sync to device" );
309 auto v_d = dv.view_device ();
310 ordered &= isViewOrdered<device_type, LO>(v_d);
311 }
312 TransferData_->exportLIDsContiguous_ = ordered;
313}
314
315template <class LO, class GO, class NT>
316bool
319 return TransferData_->remoteLIDsContiguous_;
320}
321
322template <class LO, class GO, class NT>
323bool
326 return TransferData_->exportLIDsContiguous_;
327}
328
329
330template <class LO, class GO, class NT>
331void
333describe (Teuchos::FancyOStream& out,
334 const Teuchos::EVerbosityLevel verbLevel) const
335{
336 this->describeImpl (out, "Tpetra::Details::Transfer", verbLevel);
337}
338
339template<class LO, class GO, class NT>
340Teuchos::FancyOStream&
342verboseOutputStream () const
343{
344 Teuchos::FancyOStream* outPtr = TransferData_->out_.getRawPtr ();
345 TEUCHOS_ASSERT( outPtr != nullptr );
346 return *outPtr;
347}
348
349template<class LO, class GO, class NT>
350bool
352verbose () const {
353 return TransferData_->verbose_;
354}
355
356template<class LO, class GO, class NT>
357void
359describeImpl (Teuchos::FancyOStream& out,
360 const std::string& className,
361 const Teuchos::EVerbosityLevel verbLevel) const
362{
363 using Teuchos::TypeNameTraits;
364 using Teuchos::VERB_DEFAULT;
365 using Teuchos::VERB_NONE;
366 using Teuchos::VERB_LOW;
367 using std::endl;
368 const Teuchos::EVerbosityLevel vl =
369 (verbLevel == VERB_DEFAULT) ? VERB_LOW : verbLevel;
370
371 if (vl == VERB_NONE) {
372 return; // don't print anything
373 }
374 // If this Transfer's source Map or Comm is null, then the Transfer
375 // does not participate in collective operations with the other
376 // processes. In that case, it is not even legal to call this
377 // method. The reasonable thing to do in that case is nothing.
378 auto srcMap = this->getSourceMap ();
379 if (srcMap.is_null ()) {
380 return;
381 }
382 auto comm = srcMap->getComm ();
383 if (comm.is_null ()) {
384 return;
385 }
386 if (this->getTargetMap ().is_null () ||
387 this->getTargetMap ()->getComm ().is_null ()) {
388 return;
389 }
390
391 const int myRank = comm->getRank ();
392 const int numProcs = comm->getSize ();
393
394 // Only Process 0 should touch the output stream, but this method in
395 // general may need to do communication. Thus, we may need to
396 // preserve the current tab level across multiple "if (myRank == 0)
397 // { ... }" inner scopes. This is why we sometimes create OSTab
398 // instances by pointer, instead of by value.
399 Teuchos::RCP<Teuchos::OSTab> tab0, tab1;
400
401 if (myRank == 0) {
402 // At every verbosity level but VERB_NONE, Process 0 prints.
403 // By convention, describe() always begins with a tab before
404 // printing.
405 tab0 = Teuchos::rcp (new Teuchos::OSTab (out));
406
407 out << "\"" << className << "\":" << endl;
408 tab1 = Teuchos::rcp (new Teuchos::OSTab (out));
409
410 {
411 out << "Template parameters:" << endl;
412 Teuchos::OSTab tab2 (out);
413 out << "LocalOrdinal: " << TypeNameTraits<LO>::name () << endl
414 << "GlobalOrdinal: " << TypeNameTraits<GO>::name () << endl
415 << "Node: " << TypeNameTraits<NT>::name () << endl;
416 }
417
418 const std::string label = this->getObjectLabel ();
419 if (label != "") {
420 out << "Label: " << label << endl;
421 }
422 out << "Number of processes: " << numProcs << endl;
423 }
424
425 if (vl > VERB_LOW) {
426 // At higher verbosity levels, describe() is allowed to
427 // communicate in order to print information from other
428 // processes in the object's communicator.
429 this->globalDescribe (out, vl);
430 }
431
432 // It's illegal to call describe() on a process where either Map is
433 // null. (That implies the process in question is not participating
434 // in collective operations with either Map, and describe is
435 // collective over the Maps' communicator.) Thus, we don't have to
436 // define behavior when either Map is NULL on any process. Thus,
437 // it's OK that the code below isn't quite right (that is, won't
438 // print anything) if either Map is NULL on Process 0.
439
440 if (myRank == 0) {
441 out << "Source Map:" << endl;
442 }
443 // This is collective over the Map's communicator.
444 this->getSourceMap ()->describe (out, vl);
445
446 if (myRank == 0) {
447 out << "Target Map:" << endl;
448 }
449 // This is collective over the Map's communicator.
450 this->getTargetMap ()->describe (out, vl);
451
452 if (myRank == 0) {
453 out << "Distributor:" << endl;
454 }
455 this->getDistributor ().describe (out, vl);
456}
457
458template<class LO, class GO, class NT>
459void
461globalDescribe (Teuchos::FancyOStream& out,
462 const Teuchos::EVerbosityLevel vl) const
463{
464 using Teuchos::Comm;
465 using Teuchos::OSTab;
466 using Teuchos::RCP;
467 using Teuchos::toString;
468 using std::endl;
469
470 // If this Transfer's source Map or Comm is null, then the Transfer
471 // does not participate in collective operations with the other
472 // processes. In that case, it is not even legal to call this
473 // method. The reasonable thing to do in that case is nothing.
474 auto srcMap = this->getSourceMap ();
475 if (srcMap.is_null ()) {
476 return;
477 }
478 RCP<const Teuchos::Comm<int> > comm = srcMap->getComm ();
479 if (comm.is_null ()) {
480 return;
481 }
482
483 const std::string myStr = localDescribeToString (vl);
484 ::Tpetra::Details::gathervPrint (out, myStr, *comm);
485}
486
487template<class LO, class GO, class NT>
488std::string
490localDescribeToString (const Teuchos::EVerbosityLevel vl) const
491{
492 using Teuchos::OSTab;
493 using Teuchos::RCP;
494 using std::endl;
495
496 RCP<std::ostringstream> outString (new std::ostringstream);
497 RCP<Teuchos::FancyOStream> outp = Teuchos::getFancyOStream (outString);
498 Teuchos::FancyOStream& out = *outp; // only valid during this scope
499
500 RCP<const Teuchos::Comm<int> > comm = this->getSourceMap ()->getComm ();
501 if (this->getSourceMap ().is_null () ||
502 this->getSourceMap ()->getComm ().is_null ()) {
503 // If this Transfer does not participate in the communicator,
504 // it's not even legal to call this method. However, we need to
505 // do something in this case. The reasonable thing to do is not
506 // to print anything.
507 return std::string ("");
508 }
509 else {
510 const int myRank = comm->getRank ();
511 const int numProcs = comm->getSize ();
512
513 out << "Process " << myRank << " of " << numProcs << ":" << endl;
514 OSTab tab1 (out);
515
516 out << "numSameIDs: " << getNumSameIDs () << endl;
517 out << "numPermuteIDs: " << getNumPermuteIDs () << endl;
518 out << "numRemoteIDs: " << getNumRemoteIDs () << endl;
519 out << "numExportIDs: " << getNumExportIDs () << endl;
520
521 // Only print the actual contents of these arrays at the two
522 // highest verbosity levels. Otherwise, just print their counts.
523 if (vl <= Teuchos::VERB_MEDIUM) {
524 out << "permuteFromLIDs count: " << getPermuteFromLIDs ().size () << endl
525 << "permuteToLIDs count: " << getPermuteToLIDs ().size () << endl
526 << "remoteLIDs count: " << getRemoteLIDs ().size () << endl
527 << "exportLIDs count: " << getExportLIDs ().size () << endl
528 << "exportPIDs count: " << getExportPIDs () << endl;
529 }
530 else { // vl = VERB_HIGH or VERB_EXTREME
531 // Build RemoteGIDs
532 RCP<const Map<LO,GO,NT> > tmap = getTargetMap();
533 RCP<const Map<LO,GO,NT> > smap = getSourceMap();
534 Teuchos::Array<GO> RemoteGIDs(getRemoteLIDs().size());
535 Teuchos::Array<int> RemotePIDs(getRemoteLIDs().size());
536 for(size_t i=0; i<(size_t)getRemoteLIDs().size(); i++)
537 RemoteGIDs[i] = tmap->getGlobalElement(getRemoteLIDs()[i]);
538
539 Teuchos::Array<int> ExportGIDs(getExportLIDs().size());
540 for(size_t i=0; i<(size_t)getExportLIDs().size(); i++)
541 ExportGIDs[i] = smap->getGlobalElement(getExportLIDs()[i]);
542
543 // Build RemotePIDs (taken from Tpetra_Import_Util.hpp)
544 const Tpetra::Distributor & D=getDistributor();
545 size_t NumReceives = D.getNumReceives();
546 Teuchos::ArrayView<const int> ProcsFrom = D.getProcsFrom();
547 Teuchos::ArrayView<const size_t> LengthsFrom = D.getLengthsFrom();
548 for (size_t i = 0, j = 0; i < NumReceives; ++i) {
549 const int pid = ProcsFrom[i];
550 for (size_t k = 0; k < LengthsFrom[i]; ++k) {
551 RemotePIDs[j] = pid;
552 j++;
553 }
554 }
555
556 out << "distor.NumRecvs : "<<NumReceives<<endl
557 << "distor.ProcsFrom : "<<toString(ProcsFrom)<<endl
558 << "distor.LengthsFrom: "<<toString(LengthsFrom)<<endl;
559
560 out << "distor.NumSends : "<<D.getNumSends()<<endl
561 << "distor.ProcsTo : "<<toString(D.getProcsTo())<<endl
562 << "distor.LengthsTo : "<<toString(D.getLengthsTo())<<endl;
563
564 out << "distor.hasSelfMsg : "<<D.hasSelfMessage()<<endl;
565
566 out << "permuteFromLIDs: " << toString (getPermuteFromLIDs ()) << endl
567 << "permuteToLIDs: " << toString (getPermuteToLIDs ()) << endl
568 << "remoteLIDs: " << toString (getRemoteLIDs ()) << endl
569 << "remoteGIDs: " << toString (RemoteGIDs ()) << endl
570 << "remotePIDs: " << toString (RemotePIDs ()) << endl
571 << "exportLIDs: " << toString (getExportLIDs ()) << endl
572 << "exportGIDs: " << toString (ExportGIDs ()) << endl
573 << "exportPIDs: " << toString (getExportPIDs ()) << endl;
574 }
575
576 out.flush (); // make sure the ostringstream got everything
577 return outString->str ();
578 }
579}
580
581
582template <class LO, class GO, class NT>
583void
584expertSetRemoteLIDsContiguous(Transfer<LO, GO, NT> transfer, bool contig) {
585 transfer.TransferData_->remoteLIDsContiguous_ = contig;
586}
587
588
589template <class LO, class GO, class NT>
590void
591expertSetExportLIDsContiguous(Transfer<LO, GO, NT> transfer, bool contig) {
592 transfer.TransferData_->exportLIDsContiguous_ = contig;
593}
594
595
596} // namespace Details
597} // namespace Tpetra
598
599#endif // TPETRA_DETAILS_TRANSFER_DEF_HPP
Declaration of a function that prints strings from each process.
Description of Tpetra's behavior.
static bool verbose()
Whether Tpetra is in verbose mode.
Common base class of Import and Export.
size_t getNumPermuteIDs() const
Number of IDs to permute but not to communicate.
Kokkos::DualView< const LO *, device_type > getPermuteFromLIDs_dv() const
List of local IDs in the source Map that are permuted, as a const DualView (that is sync'd to both ho...
size_t getNumSameIDs() const
Number of initial identical IDs.
Kokkos::DualView< const LO *, device_type > getPermuteToLIDs_dv() const
List of local IDs in the target Map that are permuted, as a const DualView (that is sync'd to both ho...
Teuchos::RCP< const map_type > getTargetMap() const
The target Map used to construct this Export or Import.
Teuchos::ArrayView< const LO > getExportLIDs() const
List of entries in the source Map that will be sent to other processes.
size_t getNumExportIDs() const
Number of entries that must be sent by the calling process to other processes.
size_t getNumRemoteIDs() const
Number of entries not on the calling process.
Teuchos::ArrayView< const LO > getRemoteLIDs() const
List of entries in the target Map to receive from other processes.
Teuchos::ArrayView< const LO > getPermuteFromLIDs() const
List of local IDs in the source Map that are permuted.
bool verbose() const
Whether to print verbose debugging output.
bool isLocallyComplete() const
Is this Export or Import locally complete?
Teuchos::ArrayView< const LO > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
Teuchos::ArrayView< const int > getExportPIDs() const
List of processes to which entries will be sent.
Teuchos::RCP< ImportExportData< LO, GO, NT > > TransferData_
All the data needed for executing the Export communication plan.
bool isLocallyFitted() const
Are source and target map locally fitted?
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Describe this object in a human-readable way to the given output stream.
Teuchos::FancyOStream & verboseOutputStream() const
Valid (nonnull) output stream for verbose output.
Kokkos::DualView< const LO *, device_type > getRemoteLIDs_dv() const
List of entries in the target Map to receive from other processes, as a const DualView (that is sync'...
::Tpetra::Distributor & getDistributor() const
The Distributor that this Export or Import object uses to move data.
void describeImpl(Teuchos::FancyOStream &out, const std::string &className, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Implementation of describe() for subclasses (Tpetra::Import and Tpetra::Export).
Teuchos::RCP< const map_type > getSourceMap() const
The source Map used to construct this Export or Import.
Kokkos::DualView< const LO *, device_type > getExportLIDs_dv() const
List of entries in the source Map that will be sent to other processes, as a const DualView (that is ...
Sets up and executes a communication plan for a Tpetra DistObject.
Teuchos::ArrayView< const int > getProcsTo() const
Ranks of the processes to which this process will send values.
size_t getNumReceives() const
The number of processes from which we will receive data.
bool hasSelfMessage() const
Whether the calling process will send or receive messages to itself.
Teuchos::ArrayView< const size_t > getLengthsTo() const
Number of values this process will send to each process.
Teuchos::ArrayView< const int > getProcsFrom() const
Ranks of the processes sending values to this process.
Teuchos::ArrayView< const size_t > getLengthsFrom() const
Number of values this process will receive from each process.
size_t getNumSends() const
The number of processes to which we will send data.
Implementation detail of Import and Export.
Nonmember function that computes a residual Computes R = B - A * X.
void gathervPrint(std::ostream &out, const std::string &s, const Teuchos::Comm< int > &comm)
On Process 0 in the given communicator, print strings from each process in that communicator,...
Namespace Tpetra contains the class and methods constituting the Tpetra library.