|
Tpetra parallel linear algebra
Version of the Day
|
Go to the documentation of this file.
42 #ifndef TPETRA_DISTOBJECT_DECL_HPP
43 #define TPETRA_DISTOBJECT_DECL_HPP
53 #include "Tpetra_Map.hpp"
54 #include "Tpetra_Import.hpp"
55 #include "Tpetra_Export.hpp"
58 #include "Kokkos_ArithTraits.hpp"
59 #include <type_traits>
65 #ifdef HAVE_TPETRA_TRANSFER_TIMERS
66 # undef HAVE_TPETRA_TRANSFER_TIMERS
67 #endif // HAVE_TPETRA_TRANSFER_TIMERS
69 namespace KokkosClassic {
164 template<
class DistObjectType>
167 const Teuchos::RCP<
const Map<
typename DistObjectType::local_ordinal_type,
168 typename DistObjectType::global_ordinal_type,
169 typename DistObjectType::node_type> >& newMap);
207 template<
class DistObjectType>
322 template <
class Packet,
328 virtual public Teuchos::Describable
338 using packet_type = typename ::Kokkos::Details::ArithTraits<Packet>::val_type;
361 explicit DistObject (
const Teuchos::RCP<const map_type>& map);
421 const bool restrictedMode =
false);
454 const bool restrictedMode =
false);
488 const bool restrictedMode =
false);
522 const bool restrictedMode =
false);
541 virtual Teuchos::RCP<const map_type>
getMap ()
const {
return map_; }
551 void print (std::ostream& os)
const;
568 describe (Teuchos::FancyOStream &out,
569 const Teuchos::EVerbosityLevel verbLevel =
570 Teuchos::Describable::verbLevel_default)
const;
680 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, node_type>& transfer,
681 const char modeString[],
684 const bool restrictedMode);
702 const size_t numImportLIDs);
704 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
705 virtual void TPETRA_DEPRECATED
714 const Teuchos::ArrayView<const local_ordinal_type> &permuteToLIDs,
715 const Teuchos::ArrayView<const local_ordinal_type> &permuteFromLIDs,
716 const Teuchos::ArrayView<const local_ordinal_type> &remoteLIDs,
717 const Teuchos::ArrayView<const local_ordinal_type> &exportLIDs,
720 const bool restrictedMode);
721 #endif // TPETRA_ENABLE_DEPRECATED_CODE
727 typename device_type::execution_space>;
741 Kokkos::Device<
typename device_type::execution_space,
752 const size_t numSameIDs,
763 const bool commOnHost,
764 const bool restrictedMode);
784 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
813 const size_t numSameIDs,
818 #else // TPETRA_ENABLE_DEPRECATED_CODE
847 const size_t numSameIDs,
852 #endif // TPETRA_ENABLE_DEPRECATED_CODE
854 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
901 Kokkos::DualView<
size_t*,
903 size_t& constantNumPackets,
905 #else // TPETRA_ENABLE_DEPRECATED_CODE
952 Kokkos::DualView<
size_t*,
954 size_t& constantNumPackets,
956 #endif // TPETRA_ENABLE_DEPRECATED_CODE
958 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1006 Kokkos::DualView<
size_t*,
1008 const size_t constantNumPackets,
1011 #else // TPETRA_ENABLE_DEPRECATED_CODE
1059 Kokkos::DualView<
size_t*,
1061 const size_t constantNumPackets,
1064 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1066 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1067 virtual bool TPETRA_DEPRECATED useNewInterface () {
return true; }
1078 virtual void TPETRA_DEPRECATED
1080 const size_t numSameIDs,
1081 const Teuchos::ArrayView<const local_ordinal_type>& permuteToLIDs,
1082 const Teuchos::ArrayView<const local_ordinal_type>& permuteFromLIDs);
1089 virtual void TPETRA_DEPRECATED
1091 const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
1092 Teuchos::Array<packet_type>& exports,
1093 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1094 size_t& constantNumPackets,
1102 virtual void TPETRA_DEPRECATED
1103 unpackAndCombine (
const Teuchos::ArrayView<const local_ordinal_type>& importLIDs,
1104 const Teuchos::ArrayView<const packet_type>& imports,
1105 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
1106 const size_t constantNumPackets,
1115 virtual void TPETRA_DEPRECATED
1116 createViews ()
const;
1122 virtual void TPETRA_DEPRECATED
1129 virtual void TPETRA_DEPRECATED releaseViews ()
const;
1130 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1142 Kokkos::DualView<packet_type*, buffer_device_type>
imports_;
1165 const std::string* prefix);
1187 Kokkos::DualView<packet_type*, buffer_device_type>
exports_;
1207 #ifdef HAVE_TPETRA_TRANSFER_TIMERS
1208 Teuchos::RCP<Teuchos::Time> doXferTimer_;
1209 Teuchos::RCP<Teuchos::Time> copyAndPermuteTimer_;
1210 Teuchos::RCP<Teuchos::Time> packAndPrepareTimer_;
1211 Teuchos::RCP<Teuchos::Time> doPostsAndWaitsTimer_;
1212 Teuchos::RCP<Teuchos::Time> unpackAndCombineTimer_;
1213 #endif // HAVE_TPETRA_TRANSFER_TIMERS
1217 #endif // TPETRA_DISTOBJECT_DECL_HPP
void doExport(const SrcDistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const CombineMode CM, const bool restrictedMode=false)
Export data into this object using an Export object ("forward mode").
Kokkos::DualView< packet_type *, buffer_device_type > exports_
Buffer from which packed data are exported (sent to other processes).
DistObject(const Teuchos::RCP< const map_type > &map)
Constructor.
DistObject & operator=(const DistObject< Packet, LocalOrdinal, GlobalOrdinal, Node > &)=default
Assignment operator (default).
Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distr...
virtual bool reallocArraysForNumPacketsPerLid(const size_t numExportLIDs, const size_t numImportLIDs)
Reallocate numExportPacketsPerLID_ and/or numImportPacketsPerLID_, if necessary.
typename Node::device_type device_type
The Kokkos Device type.
::Tpetra::DistObject< char >::local_ordinal_type local_ordinal_type
The type of local indices.
A parallel distribution of indices over processes.
Forward declaration of Tpetra::DistObject.
virtual void packAndPrepare(const SrcDistObject &source, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &exportLIDs, Kokkos::DualView< packet_type *, buffer_device_type > &exports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, size_t &constantNumPackets, Distributor &distor)
Pack data and metadata for communication (sends).
Communication plan for data redistribution from a uniquely-owned to a (possibly) multiply-owned distr...
virtual void unpackAndCombine(const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &importLIDs, Kokkos::DualView< packet_type *, buffer_device_type > imports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, const size_t constantNumPackets, Distributor &distor, const CombineMode combineMode)
Perform any unpacking and combining after communication.
virtual bool checkSizes(const SrcDistObject &source)=0
Compare the source and target (this) objects for compatibility.
Base class for distributed Tpetra objects that support data redistribution.
::Tpetra::DistObject< char >::node_type node_type
The Node type. If you don't know what this is, don't use it.
virtual void doTransferNew(const SrcDistObject &src, const CombineMode CM, const size_t numSameIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteToLIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteFromLIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &remoteLIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &exportLIDs, Distributor &distor, const ReverseOption revOp, const bool commOnHost, const bool restrictedMode)
Implementation detail of doTransfer.
Teuchos::RCP< const map_type > map_
The Map over which this object is distributed.
Kokkos::DualView< packet_type *, buffer_device_type > imports_
Buffer into which packed data are imported (received from other processes).
bool reallocImportsIfNeeded(const size_t newSize, const bool verbose, const std::string *prefix)
Reallocate imports_ if needed.
virtual void doTransfer(const SrcDistObject &src, const ::Tpetra::Details::Transfer< local_ordinal_type, global_ordinal_type, node_type > &transfer, const char modeString[], const ReverseOption revOp, const CombineMode CM, const bool restrictedMode)
Redistribute data across (MPI) processes.
DistObject(DistObject< Packet, LocalOrdinal, GlobalOrdinal, Node > &&)=default
Move constructor (default).
void print(std::ostream &os) const
Print this object to the given output stream.
ReadWriteOption
Read/write options for non-const views.
virtual void copyAndPermute(const SrcDistObject &source, const size_t numSameIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteToLIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteFromLIDs)
Perform copies and permutations that are local to the calling (MPI) process.
Sets up and executes a communication plan for a Tpetra DistObject.
typename device_type::execution_space execution_space
The Kokkos execution space.
typename ExecutionSpace::memory_space comm_buffer_memory_space
Memory space used for MPI communication buffers.
Abstract base class for sources of an Import or Export.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print a descriptiion of this object to the given output stream.
bool isDistributed() const
Whether this is a globally distributed object.
::Tpetra::Details::DefaultTypes::comm_buffer_memory_space< typename device_type::execution_space > buffer_memory_space
Kokkos memory space for communication buffers.
Kokkos::DualView< size_t *, buffer_device_type > numExportPacketsPerLID_
Number of packets to send for each send operation.
virtual Teuchos::RCP< const map_type > getMap() const
The Map describing the parallel distribution of this object.
void doImport(const SrcDistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const CombineMode CM, const bool restrictedMode=false)
Import data into this object using an Import object ("forward mode").
void removeEmptyProcessesInPlace(Teuchos::RCP< DistObjectType > &input, const Teuchos::RCP< const Map< typename DistObjectType::local_ordinal_type, typename DistObjectType::global_ordinal_type, typename DistObjectType::node_type > > &newMap)
Remove processes which contain no elements in this object's Map.
DistObject(const DistObject< Packet, LocalOrdinal, GlobalOrdinal, Node > &)=default
Copy constructor (default).
typename ::Kokkos::Details::ArithTraits< char >::val_type packet_type
The type of each datum being sent or received in an Import or Export.
virtual size_t constantNumberOfPackets() const
Whether the implementation's instance promises always to have a constant number of packets per LID (l...
ReverseOption
Whether the data transfer should be performed in forward or reverse mode.
Kokkos::Device< typename device_type::execution_space, buffer_memory_space > buffer_device_type
Kokkos::Device specialization for communication buffers.
Kokkos::DualView< size_t *, buffer_device_type > numImportPacketsPerLID_
Number of packets to receive for each receive operation.
virtual void removeEmptyProcessesInPlace(const Teuchos::RCP< const map_type > &newMap)
Remove processes which contain no entries in this object's Map.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Abstract base class for objects that can be the source of an Import or Export operation.
virtual std::string description() const
One-line descriptiion of this object.
virtual ~DistObject()=default
Destructor (virtual for memory safety of derived classes).
CombineMode
Rule for combining data in an Import or Export.
::Tpetra::DistObject< char >::global_ordinal_type global_ordinal_type
The type of global indices.