Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_Details_Transfer_def.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Tpetra: Templated Linear Algebra Services Package
5 // Copyright (2008) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 // @HEADER
41 
42 #ifndef TPETRA_DETAILS_TRANSFER_DEF_HPP
43 #define TPETRA_DETAILS_TRANSFER_DEF_HPP
44 
46 #include "Tpetra_Distributor.hpp"
47 #include "Tpetra_ImportExportData.hpp"
48 #include "Tpetra_Map.hpp"
49 #include "Teuchos_CommHelpers.hpp"
50 #include "Teuchos_TypeNameTraits.hpp"
51 #include <sstream>
52 
53 namespace { // (anonymous)
54 
55  // Assume that dv is sync'd.
56  template<class ElementType, class DeviceType>
57  Teuchos::ArrayView<const ElementType>
58  makeConstArrayViewFromDualView (const Kokkos::DualView<ElementType*, DeviceType>& dv)
59  {
60  TEUCHOS_ASSERT( ! dv.need_sync_host () );
61  auto hostView = dv.view_host ();
62  const auto size = hostView.extent (0);
63  return Teuchos::ArrayView<const ElementType> (size == 0 ? nullptr : hostView.data (), size);
64  }
65 
66  template<class DeviceType, class LocalOrdinal>
67  struct OrderedViewFunctor {
68  OrderedViewFunctor (const Kokkos::View<LocalOrdinal*, DeviceType>& viewToCheck) :
69  viewToCheck_ (viewToCheck) {}
70  KOKKOS_INLINE_FUNCTION void operator() (const size_t i, unsigned int& isUnordered) const {
71  isUnordered |= static_cast<unsigned int>(viewToCheck_(i)+1 != viewToCheck_(i+1));
72  }
73  Kokkos::View<const LocalOrdinal*, DeviceType> viewToCheck_;
74  };
75 
76  template<class DeviceType, class LocalOrdinal>
77  bool
78  isViewOrdered (const Kokkos::View<LocalOrdinal*, DeviceType>& viewToCheck)
79  {
80  using Kokkos::parallel_reduce;
81  typedef DeviceType DT;
82  typedef typename DT::execution_space DES;
83  typedef Kokkos::RangePolicy<DES, size_t> range_type;
84 
85  const size_t size = viewToCheck.extent (0);
86  unsigned int isUnordered = 0;
87  if (size>1)
88  parallel_reduce ("isViewOrdered",
89  range_type (0, size-1),
90  OrderedViewFunctor<DeviceType, LocalOrdinal> (viewToCheck),
91  isUnordered);
92  return isUnordered == 0;
93  }
94 
95 } // namespace (anonymous)
96 
97 namespace Tpetra {
98 namespace Details {
99 
100 template <class LO, class GO, class NT>
101 Transfer<LO, GO, NT>::
102 Transfer (const Teuchos::RCP<const map_type>& source,
103  const Teuchos::RCP<const map_type>& target,
104  const Teuchos::RCP<Teuchos::FancyOStream>& out,
105  const Teuchos::RCP<Teuchos::ParameterList>& plist,
106  const std::string& className) :
107  TransferData_ (new ImportExportData<LO, GO, NT> (source, target, out, plist))
108 {
109  TEUCHOS_ASSERT( ! TransferData_->out_.is_null () );
110  this->setParameterList (plist, className);
111 }
112 
113 template <class LO, class GO, class NT>
115 Transfer (const Transfer<LO, GO, NT>& rhs, reverse_tag)
116 {
117  TEUCHOS_ASSERT( ! (rhs.TransferData_).is_null () );
118  this->TransferData_ = rhs.TransferData_->reverseClone ();
119  TEUCHOS_ASSERT( ! this->TransferData_->out_.is_null () );
120 }
121 
122 template <class LO, class GO, class NT>
123 void
125 setParameterList (const Teuchos::RCP<Teuchos::ParameterList>& plist,
126  const std::string& className)
127 {
128  using ::Tpetra::Details::Behavior;
129 
130  const bool verboseEnv = Behavior::verbose (className.c_str ()) ||
131  Behavior::verbose ((std::string ("Tpetra::") + className).c_str ());
132 
133  bool verboseParam = false;
134  if (! plist.is_null ()) {
135  // FIXME (mfh 03 Feb 2019) Phase out these parameters in favor of
136  // TPETRA_VERBOSE.
137  if (plist->isType<bool> ("Verbose")) {
138  verboseParam = plist->get<bool> ("Verbose");
139  }
140  else if (plist->isType<bool> ("Debug")) { // backwards compat
141  verboseParam = plist->get<bool> ("Debug");
142  }
143  }
144  this->TransferData_->verbose_ = verboseEnv || verboseParam;
145 }
146 
147 template <class LO, class GO, class NT>
148 size_t
150 getNumSameIDs () const {
151  return TransferData_->numSameIDs_;
152 }
153 
154 template <class LO, class GO, class NT>
155 size_t
158  return static_cast<size_t> (TransferData_->permuteFromLIDs_.extent (0));
159 }
160 
161 template <class LO, class GO, class NT>
162 Kokkos::DualView<const LO*, typename Transfer<LO, GO, NT>::device_type>
165  const auto& dv = TransferData_->permuteFromLIDs_;
166  TEUCHOS_TEST_FOR_EXCEPTION
167  (dv.need_sync_device (), std::logic_error,
168  "Tpetra::Details::Transfer::getPermuteFromLIDs_dv: "
169  "DualView needs sync to device" );
170  TEUCHOS_TEST_FOR_EXCEPTION
171  (dv.need_sync_host (), std::logic_error,
172  "Tpetra::Details::Transfer::getPermuteFromLIDs_dv: "
173  "DualView needs sync to host" );
174  return dv;
175 }
176 
177 template <class LO, class GO, class NT>
178 Teuchos::ArrayView<const LO>
181  return makeConstArrayViewFromDualView (TransferData_->permuteFromLIDs_);
182 }
183 
184 template <class LO, class GO, class NT>
185 Kokkos::DualView<const LO*, typename Transfer<LO, GO, NT>::device_type>
188  const auto& dv = TransferData_->permuteToLIDs_;
189  TEUCHOS_TEST_FOR_EXCEPTION
190  (dv.need_sync_device (), std::logic_error,
191  "Tpetra::Details::Transfer::getPermuteToLIDs_dv: "
192  "DualView needs sync to device" );
193  TEUCHOS_TEST_FOR_EXCEPTION
194  (dv.need_sync_host (), std::logic_error,
195  "Tpetra::Details::Transfer::getPermuteToLIDs_dv: "
196  "DualView needs sync to host" );
197  return dv;
198 }
199 
200 template <class LO, class GO, class NT>
201 Teuchos::ArrayView<const LO>
204  return makeConstArrayViewFromDualView (TransferData_->permuteToLIDs_);
205 }
206 
207 template <class LO, class GO, class NT>
208 size_t
210 getNumRemoteIDs () const {
211  return static_cast<size_t> (TransferData_->remoteLIDs_.extent (0));
212 }
213 
214 template <class LO, class GO, class NT>
215 Kokkos::DualView<const LO*, typename Transfer<LO, GO, NT>::device_type>
218  const auto& dv = TransferData_->remoteLIDs_;
219  TEUCHOS_TEST_FOR_EXCEPTION
220  (dv.need_sync_device (), std::logic_error,
221  "Tpetra::Details::Transfer::getRemoteLIDs_dv: "
222  "DualView needs sync to device" );
223  TEUCHOS_TEST_FOR_EXCEPTION
224  (dv.need_sync_host (), std::logic_error,
225  "Tpetra::Details::Transfer::getRemoteLIDs_dv: "
226  "DualView needs sync to host" );
227  return dv;
228 }
229 
230 template <class LO, class GO, class NT>
231 Teuchos::ArrayView<const LO>
233 getRemoteLIDs () const {
234  return makeConstArrayViewFromDualView (TransferData_->remoteLIDs_);
235 }
236 
237 template <class LO, class GO, class NT>
238 size_t
240 getNumExportIDs () const {
241  return static_cast<size_t> (TransferData_->exportLIDs_.extent (0));
242 }
243 
244 template <class LO, class GO, class NT>
245 Kokkos::DualView<const LO*, typename Transfer<LO, GO, NT>::device_type>
248  const auto& dv = TransferData_->exportLIDs_;
249  TEUCHOS_TEST_FOR_EXCEPTION
250  (dv.need_sync_device (), std::logic_error,
251  "Tpetra::Details::Transfer::getExportLIDs_dv: "
252  "DualView needs sync to device" );
253  TEUCHOS_TEST_FOR_EXCEPTION
254  (dv.need_sync_host (), std::logic_error,
255  "Tpetra::Details::Transfer::getExportLIDs_dv: "
256  "DualView needs sync to host" );
257  return dv;
258 }
259 
260 template <class LO, class GO, class NT>
261 Teuchos::ArrayView<const LO>
263 getExportLIDs () const {
264  return makeConstArrayViewFromDualView (TransferData_->exportLIDs_);
265 }
266 
267 template <class LO, class GO, class NT>
268 Teuchos::ArrayView<const int>
270 getExportPIDs () const {
271  return TransferData_->exportPIDs_ ();
272 }
273 
274 template <class LO, class GO, class NT>
275 Teuchos::RCP<const typename Transfer<LO, GO, NT>::map_type>
277 getSourceMap () const {
278  return TransferData_->source_;
279 }
280 
281 template <class LO, class GO, class NT>
282 Teuchos::RCP<const typename Transfer<LO, GO, NT>::map_type>
284 getTargetMap () const {
285  return TransferData_->target_;
286 }
287 
288 template <class LO, class GO, class NT>
291 getDistributor () const {
292  return TransferData_->distributor_;
293 }
294 
295 template <class LO, class GO, class NT>
296 bool
299  return TransferData_->isLocallyComplete_;
300 }
301 
302 template <class LO, class GO, class NT>
303 bool
305 isLocallyFitted () const {
306  return (getNumSameIDs() == std::min(getSourceMap()->getLocalNumElements(),
307  getTargetMap()->getLocalNumElements()));
308 }
309 
310 template <class LO, class GO, class NT>
311 void
314 
315  // Check that maps are locally fitted
316  // TODO: We really want to check here that remote LIDs are sorted last.
317  // The current check is too restrictive in special cases.
318  bool ordered = (getNumSameIDs() == std::min(getSourceMap()->getLocalNumElements(),
319  getTargetMap()->getLocalNumElements()));
320  ordered &= (getTargetMap()->getLocalNumElements() == getNumSameIDs() + getNumRemoteIDs());
321  if (ordered) {
322  const auto& dv = TransferData_->remoteLIDs_;
323  TEUCHOS_TEST_FOR_EXCEPTION
324  (dv.need_sync_device (), std::logic_error,
325  "Tpetra::Details::Transfer::getRemoteLIDs_dv: "
326  "DualView needs sync to device" );
327  auto v_d = dv.view_device ();
328  ordered &= isViewOrdered<device_type, LO>(v_d);
329  }
330  TransferData_->remoteLIDsContiguous_ = ordered;
331 
332  ordered = (getNumSameIDs() == std::min(getSourceMap()->getLocalNumElements(),
333  getTargetMap()->getLocalNumElements()));
334  ordered &= (getSourceMap()->getLocalNumElements() == getNumSameIDs() + getNumExportIDs());
335  if (ordered) {
336  const auto& dv = TransferData_->exportLIDs_;
337  TEUCHOS_TEST_FOR_EXCEPTION
338  (dv.need_sync_device (), std::logic_error,
339  "Tpetra::Details::Transfer::getRemoteLIDs_dv: "
340  "DualView needs sync to device" );
341  auto v_d = dv.view_device ();
342  ordered &= isViewOrdered<device_type, LO>(v_d);
343  }
344  TransferData_->exportLIDsContiguous_ = ordered;
345 }
346 
347 template <class LO, class GO, class NT>
348 bool
349 Transfer<LO, GO, NT>::
350 areRemoteLIDsContiguous () const {
351  return TransferData_->remoteLIDsContiguous_;
352 }
353 
354 template <class LO, class GO, class NT>
355 bool
356 Transfer<LO, GO, NT>::
357 areExportLIDsContiguous () const {
358  return TransferData_->exportLIDsContiguous_;
359 }
360 
361 
362 template <class LO, class GO, class NT>
363 void
365 describe (Teuchos::FancyOStream& out,
366  const Teuchos::EVerbosityLevel verbLevel) const
367 {
368  this->describeImpl (out, "Tpetra::Details::Transfer", verbLevel);
369 }
370 
371 template<class LO, class GO, class NT>
372 Teuchos::FancyOStream&
375 {
376  Teuchos::FancyOStream* outPtr = TransferData_->out_.getRawPtr ();
377  TEUCHOS_ASSERT( outPtr != nullptr );
378  return *outPtr;
379 }
380 
381 template<class LO, class GO, class NT>
382 bool
384 verbose () const {
385  return TransferData_->verbose_;
386 }
387 
388 template<class LO, class GO, class NT>
389 void
391 describeImpl (Teuchos::FancyOStream& out,
392  const std::string& className,
393  const Teuchos::EVerbosityLevel verbLevel) const
394 {
395  using Teuchos::TypeNameTraits;
396  using Teuchos::VERB_DEFAULT;
397  using Teuchos::VERB_NONE;
398  using Teuchos::VERB_LOW;
399  using std::endl;
400  const Teuchos::EVerbosityLevel vl =
401  (verbLevel == VERB_DEFAULT) ? VERB_LOW : verbLevel;
402 
403  if (vl == VERB_NONE) {
404  return; // don't print anything
405  }
406  // If this Transfer's source Map or Comm is null, then the Transfer
407  // does not participate in collective operations with the other
408  // processes. In that case, it is not even legal to call this
409  // method. The reasonable thing to do in that case is nothing.
410  auto srcMap = this->getSourceMap ();
411  if (srcMap.is_null ()) {
412  return;
413  }
414  auto comm = srcMap->getComm ();
415  if (comm.is_null ()) {
416  return;
417  }
418  if (this->getTargetMap ().is_null () ||
419  this->getTargetMap ()->getComm ().is_null ()) {
420  return;
421  }
422 
423  const int myRank = comm->getRank ();
424  const int numProcs = comm->getSize ();
425 
426  // Only Process 0 should touch the output stream, but this method in
427  // general may need to do communication. Thus, we may need to
428  // preserve the current tab level across multiple "if (myRank == 0)
429  // { ... }" inner scopes. This is why we sometimes create OSTab
430  // instances by pointer, instead of by value.
431  Teuchos::RCP<Teuchos::OSTab> tab0, tab1;
432 
433  if (myRank == 0) {
434  // At every verbosity level but VERB_NONE, Process 0 prints.
435  // By convention, describe() always begins with a tab before
436  // printing.
437  tab0 = Teuchos::rcp (new Teuchos::OSTab (out));
438 
439  out << "\"" << className << "\":" << endl;
440  tab1 = Teuchos::rcp (new Teuchos::OSTab (out));
441 
442  {
443  out << "Template parameters:" << endl;
444  Teuchos::OSTab tab2 (out);
445  out << "LocalOrdinal: " << TypeNameTraits<LO>::name () << endl
446  << "GlobalOrdinal: " << TypeNameTraits<GO>::name () << endl
447  << "Node: " << TypeNameTraits<NT>::name () << endl;
448  }
449 
450  const std::string label = this->getObjectLabel ();
451  if (label != "") {
452  out << "Label: " << label << endl;
453  }
454  out << "Number of processes: " << numProcs << endl;
455  }
456 
457  if (vl > VERB_LOW) {
458  // At higher verbosity levels, describe() is allowed to
459  // communicate in order to print information from other
460  // processes in the object's communicator.
461  this->globalDescribe (out, vl);
462  }
463 
464  // It's illegal to call describe() on a process where either Map is
465  // null. (That implies the process in question is not participating
466  // in collective operations with either Map, and describe is
467  // collective over the Maps' communicator.) Thus, we don't have to
468  // define behavior when either Map is NULL on any process. Thus,
469  // it's OK that the code below isn't quite right (that is, won't
470  // print anything) if either Map is NULL on Process 0.
471 
472  if (myRank == 0) {
473  out << "Source Map:" << endl;
474  }
475  // This is collective over the Map's communicator.
476  this->getSourceMap ()->describe (out, vl);
477 
478  if (myRank == 0) {
479  out << "Target Map:" << endl;
480  }
481  // This is collective over the Map's communicator.
482  this->getTargetMap ()->describe (out, vl);
483 
484  if (myRank == 0) {
485  out << "Distributor:" << endl;
486  }
487  this->getDistributor ().describe (out, vl);
488 }
489 
490 template<class LO, class GO, class NT>
491 void
493 globalDescribe (Teuchos::FancyOStream& out,
494  const Teuchos::EVerbosityLevel vl) const
495 {
496  using Teuchos::Comm;
497  using Teuchos::OSTab;
498  using Teuchos::RCP;
499  using Teuchos::toString;
500  using std::endl;
501 
502  // If this Transfer's source Map or Comm is null, then the Transfer
503  // does not participate in collective operations with the other
504  // processes. In that case, it is not even legal to call this
505  // method. The reasonable thing to do in that case is nothing.
506  auto srcMap = this->getSourceMap ();
507  if (srcMap.is_null ()) {
508  return;
509  }
510  RCP<const Teuchos::Comm<int> > comm = srcMap->getComm ();
511  if (comm.is_null ()) {
512  return;
513  }
514 
515  const std::string myStr = localDescribeToString (vl);
516  ::Tpetra::Details::gathervPrint (out, myStr, *comm);
517 }
518 
519 template<class LO, class GO, class NT>
520 std::string
521 Transfer<LO, GO, NT>::
522 localDescribeToString (const Teuchos::EVerbosityLevel vl) const
523 {
524  using Teuchos::OSTab;
525  using Teuchos::RCP;
526  using std::endl;
527 
528  RCP<std::ostringstream> outString (new std::ostringstream);
529  RCP<Teuchos::FancyOStream> outp = Teuchos::getFancyOStream (outString);
530  Teuchos::FancyOStream& out = *outp; // only valid during this scope
531 
532  RCP<const Teuchos::Comm<int> > comm = this->getSourceMap ()->getComm ();
533  if (this->getSourceMap ().is_null () ||
534  this->getSourceMap ()->getComm ().is_null ()) {
535  // If this Transfer does not participate in the communicator,
536  // it's not even legal to call this method. However, we need to
537  // do something in this case. The reasonable thing to do is not
538  // to print anything.
539  return std::string ("");
540  }
541  else {
542  const int myRank = comm->getRank ();
543  const int numProcs = comm->getSize ();
544 
545  out << "Process " << myRank << " of " << numProcs << ":" << endl;
546  OSTab tab1 (out);
547 
548  out << "numSameIDs: " << getNumSameIDs () << endl;
549  out << "numPermuteIDs: " << getNumPermuteIDs () << endl;
550  out << "numRemoteIDs: " << getNumRemoteIDs () << endl;
551  out << "numExportIDs: " << getNumExportIDs () << endl;
552 
553  // Only print the actual contents of these arrays at the two
554  // highest verbosity levels. Otherwise, just print their counts.
555  if (vl <= Teuchos::VERB_MEDIUM) {
556  out << "permuteFromLIDs count: " << getPermuteFromLIDs ().size () << endl
557  << "permuteToLIDs count: " << getPermuteToLIDs ().size () << endl
558  << "remoteLIDs count: " << getRemoteLIDs ().size () << endl
559  << "exportLIDs count: " << getExportLIDs ().size () << endl
560  << "exportPIDs count: " << getExportPIDs () << endl;
561  }
562  else { // vl = VERB_HIGH or VERB_EXTREME
563  // Build RemoteGIDs
564  RCP<const Map<LO,GO,NT> > tmap = getTargetMap();
565  RCP<const Map<LO,GO,NT> > smap = getSourceMap();
566  Teuchos::Array<GO> RemoteGIDs(getRemoteLIDs().size());
567  Teuchos::Array<int> RemotePIDs(getRemoteLIDs().size());
568  for(size_t i=0; i<(size_t)getRemoteLIDs().size(); i++)
569  RemoteGIDs[i] = tmap->getGlobalElement(getRemoteLIDs()[i]);
570 
571  Teuchos::Array<int> ExportGIDs(getExportLIDs().size());
572  for(size_t i=0; i<(size_t)getExportLIDs().size(); i++)
573  ExportGIDs[i] = smap->getGlobalElement(getExportLIDs()[i]);
574 
575  // Build RemotePIDs (taken from Tpetra_Import_Util.hpp)
576  const Tpetra::Distributor & D=getDistributor();
577  size_t NumReceives = D.getNumReceives();
578  Teuchos::ArrayView<const int> ProcsFrom = D.getProcsFrom();
579  Teuchos::ArrayView<const size_t> LengthsFrom = D.getLengthsFrom();
580  for (size_t i = 0, j = 0; i < NumReceives; ++i) {
581  const int pid = ProcsFrom[i];
582  for (size_t k = 0; k < LengthsFrom[i]; ++k) {
583  RemotePIDs[j] = pid;
584  j++;
585  }
586  }
587 
588  out << "distor.NumRecvs : "<<NumReceives<<endl
589  << "distor.ProcsFrom : "<<toString(ProcsFrom)<<endl
590  << "distor.LengthsFrom: "<<toString(LengthsFrom)<<endl;
591 
592  out << "distor.NumSends : "<<D.getNumSends()<<endl
593  << "distor.ProcsTo : "<<toString(D.getProcsTo())<<endl
594  << "distor.LengthsTo : "<<toString(D.getLengthsTo())<<endl;
595 
596  out << "distor.hasSelfMsg : "<<D.hasSelfMessage()<<endl;
597 
598  out << "permuteFromLIDs: " << toString (getPermuteFromLIDs ()) << endl
599  << "permuteToLIDs: " << toString (getPermuteToLIDs ()) << endl
600  << "remoteLIDs: " << toString (getRemoteLIDs ()) << endl
601  << "remoteGIDs: " << toString (RemoteGIDs ()) << endl
602  << "remotePIDs: " << toString (RemotePIDs ()) << endl
603  << "exportLIDs: " << toString (getExportLIDs ()) << endl
604  << "exportGIDs: " << toString (ExportGIDs ()) << endl
605  << "exportPIDs: " << toString (getExportPIDs ()) << endl;
606  }
607 
608  out.flush (); // make sure the ostringstream got everything
609  return outString->str ();
610  }
611 }
612 
613 
614 template <class LO, class GO, class NT>
615 void
616 expertSetRemoteLIDsContiguous(Transfer<LO, GO, NT> transfer, bool contig) {
617  transfer.TransferData_->remoteLIDsContiguous_ = contig;
618 }
619 
620 
621 template <class LO, class GO, class NT>
622 void
623 expertSetExportLIDsContiguous(Transfer<LO, GO, NT> transfer, bool contig) {
624  transfer.TransferData_->exportLIDsContiguous_ = contig;
625 }
626 
627 
628 } // namespace Details
629 } // namespace Tpetra
630 
631 #endif // TPETRA_DETAILS_TRANSFER_DEF_HPP
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&#39;...
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).
Common base class of Import and Export.
size_t getNumReceives() const
The number of processes from which we will receive data.
Teuchos::FancyOStream & verboseOutputStream() const
Valid (nonnull) output stream for verbose output.
bool isLocallyFitted() const
Are source and target map locally fitted?
Declaration of a function that prints strings from each process.
Teuchos::ArrayView< const int > getExportPIDs() const
List of processes to which entries will be sent.
Teuchos::ArrayView< const LO > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
Teuchos::RCP< const map_type > getTargetMap() const
The target Map used to construct this Export or Import.
size_t getNumSameIDs() const
Number of initial identical IDs.
Teuchos::ArrayView< const size_t > getLengthsFrom() const
Number of values this process will receive from each process.
Teuchos::ArrayView< const int > getProcsFrom() const
Ranks of the processes sending values to this process.
size_t getNumRemoteIDs() const
Number of entries not on the calling process.
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&#39;d to both ho...
Teuchos::ArrayView< const LO > getRemoteLIDs() const
List of entries in the target Map to receive from other processes.
Teuchos::ArrayView< const int > getProcsTo() const
Ranks of the processes to which this process will send values.
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&#39;d to both ho...
size_t getNumPermuteIDs() const
Number of IDs to permute but not to communicate.
bool hasSelfMessage() const
Whether the calling process will send or receive messages to itself.
Implementation detail of Import and Export.
Sets up and executes a communication plan for a Tpetra DistObject.
static bool verbose()
Whether Tpetra is in verbose mode.
Teuchos::RCP< ImportExportData< LO, GO, NT > > TransferData_
All the data needed for executing the Export communication plan.
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 ...
Teuchos::RCP< const map_type > getSourceMap() const
The source Map used to construct this Export or Import.
size_t getNumExportIDs() const
Number of entries that must be sent by the calling process to other processes.
bool isLocallyComplete() const
Is this Export or Import locally complete?
Teuchos::ArrayView< const size_t > getLengthsTo() const
Number of values this process will send to each process.
Teuchos::ArrayView< const LO > getExportLIDs() const
List of entries in the source Map that will be sent to other processes.
Teuchos::ArrayView< const LO > getPermuteFromLIDs() const
List of local IDs in the source Map that are permuted.
::Tpetra::Distributor & getDistributor() const
The Distributor that this Export or Import object uses to move data.
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.
size_t getNumSends() const
The number of processes to which we will send data.
bool verbose() const
Whether to print verbose debugging output.