Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Details_Transfer_decl.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_DECL_HPP
11#define TPETRA_DETAILS_TRANSFER_DECL_HPP
12
15#include "Tpetra_Map_decl.hpp"
16#include "Teuchos_Describable.hpp"
17
18namespace Tpetra {
19
20// Forward declaration. The macro tells Doxygen (our automatic
21// documentation generation system) to skip forward declarations.
22#ifndef DOXYGEN_SHOULD_SKIP_THIS
23class Distributor;
24#endif // DOXYGEN_SHOULD_SKIP_THIS
25
26namespace Details {
27
28#ifndef DOXYGEN_SHOULD_SKIP_THIS
31template <class LO, class GO, class NT>
32void expertSetRemoteLIDsContiguous(Transfer<LO, GO, NT> transfer, bool contig);
33
36template <class LO, class GO, class NT>
37void expertSetExportLIDsContiguous(Transfer<LO, GO, NT> transfer, bool contig);
38#endif // DOXYGEN_SHOULD_SKIP_THIS
39
44template <class LO,
45 class GO,
46 class NT>
47class Transfer : public Teuchos::Describable {
48 public:
54
55 private:
56 using execution_space = typename NT::device_type::execution_space;
57 using memory_space =
58 ::Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename NT::device_type>;
59 using device_type = Kokkos::Device<execution_space, memory_space>;
60
61 public:
62 // Don't be tempted to comment this out if code doesn't build.
63 // The point is to ensure correct initialization of TransferData_.
64 Transfer() = delete;
65
81 Transfer(const Teuchos::RCP<const map_type>& source,
82 const Teuchos::RCP<const map_type>& target,
83 const Teuchos::RCP<Teuchos::FancyOStream>& out,
84 const Teuchos::RCP<Teuchos::ParameterList>& plist,
85 const std::string& className);
86
87 Transfer(const Transfer<LO, GO, NT>& rhs) = default;
88
89 struct reverse_tag {};
94 Transfer(const Transfer<LO, GO, NT>& rhs, reverse_tag tag);
95
96 Transfer<LO, GO, NT>& operator=(const Transfer<LO, GO, NT>&) = default;
97
99 virtual ~Transfer() = default;
100
105 size_t getNumSameIDs() const;
106
113 size_t getNumPermuteIDs() const;
114
117 Kokkos::DualView<const LO*, device_type> getPermuteFromLIDs_dv() const;
118
120 Teuchos::ArrayView<const LO> getPermuteFromLIDs() const;
121
124 Kokkos::DualView<const LO*, device_type> getPermuteToLIDs_dv() const;
125
127 Teuchos::ArrayView<const LO> getPermuteToLIDs() const;
128
130 size_t getNumRemoteIDs() const;
131
135 Kokkos::DualView<const LO*, device_type> getRemoteLIDs_dv() const;
136
138 Teuchos::ArrayView<const LO> getRemoteLIDs() const;
139
141 size_t getNumExportIDs() const;
142
146 Kokkos::DualView<const LO*, device_type> getExportLIDs_dv() const;
147
149 Teuchos::ArrayView<const LO> getExportLIDs() const;
150
155 Teuchos::ArrayView<const int> getExportPIDs() const;
156
158 Teuchos::RCP<const map_type> getSourceMap() const;
159
161 Teuchos::RCP<const map_type> getTargetMap() const;
162
165
182 bool isLocallyComplete() const;
183
184 void detectRemoteExportLIDsContiguous() const;
185
186 bool areRemoteLIDsContiguous() const;
187
188 bool areExportLIDsContiguous() const;
189
190#ifndef DOXYGEN_SHOULD_SKIP_THIS
193
196#endif // DOXYGEN_SHOULD_SKIP_THIS
197
204 bool isLocallyFitted() const;
205
226 virtual void
227 describe(Teuchos::FancyOStream& out,
228 const Teuchos::EVerbosityLevel verbLevel =
229 Teuchos::Describable::verbLevel_default) const;
230
231 protected:
233 Teuchos::RCP<ImportExportData<LO, GO, NT> > TransferData_;
234
236 Teuchos::FancyOStream& verboseOutputStream() const;
237
239 bool verbose() const;
240
254 void
255 describeImpl(Teuchos::FancyOStream& out,
256 const std::string& className,
257 const Teuchos::EVerbosityLevel verbLevel =
258 Teuchos::Describable::verbLevel_default) const;
259
260 private:
268 void
269 setParameterList(const Teuchos::RCP<Teuchos::ParameterList>& plist,
270 const std::string& className);
271
278 void
279 globalDescribe(Teuchos::FancyOStream& out,
280 const Teuchos::EVerbosityLevel vl) const;
281
286 std::string
287 localDescribeToString(const Teuchos::EVerbosityLevel vl) const;
288};
289
290} // namespace Details
291} // namespace Tpetra
292
293// Explicit instantiation macro.
294// Only invoke this when in the Tpetra::Details namespace.
295// Most users do not need to use this.
296//
297// LO: The local ordinal type.
298// GO: The global ordinal type.
299// NODE: The Kokkos Node type.
300#define TPETRA_DETAILS_TRANSFER_INSTANT(LO, GO, NODE) \
301 template class Transfer<LO, GO, NODE>; \
302 template void expertSetRemoteLIDsContiguous<LO, GO, NODE>(Transfer<LO, GO, NODE> transfer, bool contig); \
303 template void expertSetExportLIDsContiguous<LO, GO, NODE>(Transfer<LO, GO, NODE> transfer, bool contig);
304
305#endif // TPETRA_DETAILS_TRANSFER_DECL_HPP
Forward declaration of Tpetra::Details::Transfer.
Forward declaration of Tpetra::ImportExportData.
Declaration of the Tpetra::Map class and related nonmember constructors.
Struct that holds views of the contents of a CrsMatrix.
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.
virtual ~Transfer()=default
Destructor (declared virtual for memory safety of derived classes).
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.
Implementation details of Tpetra.
Namespace Tpetra contains the class and methods constituting the Tpetra library.