40 #ifndef TPETRA_DISTOBJECT_DECL_HPP 41 #define TPETRA_DISTOBJECT_DECL_HPP 46 #include "Tpetra_Details_DistributorActor.hpp" 47 #include "Tpetra_Map.hpp" 48 #include "Tpetra_Import.hpp" 49 #include "Tpetra_Export.hpp" 52 #include "Kokkos_ArithTraits.hpp" 54 #include <type_traits> 60 #ifdef HAVE_TPETRA_TRANSFER_TIMERS 61 # undef HAVE_TPETRA_TRANSFER_TIMERS 62 #endif // HAVE_TPETRA_TRANSFER_TIMERS 159 template<
class DistObjectType>
162 const Teuchos::RCP<
const Map<
typename DistObjectType::local_ordinal_type,
163 typename DistObjectType::global_ordinal_type,
164 typename DistObjectType::node_type> >& newMap);
202 template<
class DistObjectType>
317 template <
class Packet,
323 virtual public Teuchos::Describable
333 using packet_type = typename ::Kokkos::Details::ArithTraits<Packet>::val_type;
356 explicit DistObject (
const Teuchos::RCP<const map_type>& map);
416 const bool restrictedMode =
false);
449 const bool restrictedMode =
false);
483 const bool restrictedMode =
false);
517 const bool restrictedMode =
false);
523 const bool restrictedMode =
false);
529 const bool restrictedMode =
false);
535 const bool restrictedMode =
false);
541 const bool restrictedMode =
false);
547 const bool restrictedMode =
false);
553 const bool restrictedMode =
false);
559 const bool restrictedMode =
false);
565 const bool restrictedMode =
false);
584 virtual Teuchos::RCP<const map_type>
getMap ()
const {
return map_; }
594 void print (std::ostream& os)
const;
611 describe (Teuchos::FancyOStream &out,
612 const Teuchos::EVerbosityLevel verbLevel =
613 Teuchos::Describable::verbLevel_default)
const;
723 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, node_type>& transfer,
724 const char modeString[],
727 const bool restrictedMode);
745 const size_t numImportLIDs);
751 ::Tpetra::Details::DefaultTypes::comm_buffer_memory_space<device_type>;
765 Kokkos::Device<
typename device_type::execution_space,
774 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, node_type>& transfer,
775 const char modeString[],
778 const bool restrictedMode);
781 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, node_type>& transfer,
782 const char modeString[],
785 const bool restrictedMode);
788 size_t constantNumPackets,
790 std::shared_ptr<std::string> prefix,
791 const bool canTryAliasing,
795 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& exportLIDs,
796 size_t& constantNumPackets);
798 void doUnpackAndCombine(
const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& remoteLIDs,
799 size_t constantNumPackets,
851 const size_t numSameIDs,
901 Kokkos::DualView<
size_t*,
903 size_t& constantNumPackets);
949 Kokkos::DualView<
size_t*,
951 const size_t constantNumPackets,
956 Teuchos::RCP<const map_type>
map_;
959 std::unique_ptr<std::string>
960 createPrefix(
const char className[],
961 const char methodName[])
const;
969 Kokkos::DualView<packet_type*, buffer_device_type>
imports_;
992 const std::string* prefix,
993 const bool remoteLIDsContiguous=
false,
1016 Kokkos::DualView<packet_type*, buffer_device_type>
exports_;
1036 Details::DistributorActor distributorActor_;
1038 #ifdef HAVE_TPETRA_TRANSFER_TIMERS 1039 Teuchos::RCP<Teuchos::Time> doXferTimer_;
1040 Teuchos::RCP<Teuchos::Time> copyAndPermuteTimer_;
1041 Teuchos::RCP<Teuchos::Time> packAndPrepareTimer_;
1042 Teuchos::RCP<Teuchos::Time> doPostsAndWaitsTimer_;
1043 Teuchos::RCP<Teuchos::Time> unpackAndCombineTimer_;
1044 #endif // HAVE_TPETRA_TRANSFER_TIMERS 1048 #endif // TPETRA_DISTOBJECT_DECL_HPP Communication plan for data redistribution from a uniquely-owned to a (possibly) multiply-owned distr...
Namespace Tpetra contains the class and methods constituting the Tpetra library.
void print(std::ostream &os) const
Print this object to the given output stream.
Node node_type
The Node type. If you don't know what this is, don't use it.
Kokkos::DualView< size_t *, buffer_device_type > numExportPacketsPerLID_
Number of packets to send for each send operation.
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, const CombineMode CM)
Perform copies and permutations that are local to the calling (MPI) process.
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").
virtual bool reallocArraysForNumPacketsPerLid(const size_t numExportLIDs, const size_t numImportLIDs)
Reallocate numExportPacketsPerLID_ and/or numImportPacketsPerLID_, if necessary.
virtual std::string description() const
One-line descriptiion of this object.
Abstract base class for sources of an Import or Export.
Forward declaration of Tpetra::DistObject.
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.
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, const CombineMode combineMode)
Perform any unpacking and combining after communication.
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.
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.
typename Node::device_type device_type
The Kokkos Device type.
void beginTransfer(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)
Implementation detail of doTransfer.
GlobalOrdinal global_ordinal_type
The type of global indices.
virtual Teuchos::RCP< const map_type > getMap() const
The Map describing the parallel distribution of this object.
virtual ~DistObject()=default
Destructor (virtual for memory safety of derived classes).
typename ::Kokkos::Details::ArithTraits< GlobalOrdinal >::val_type packet_type
The type of each datum being sent or received in an Import or Export.
Kokkos::DualView< size_t *, buffer_device_type > numImportPacketsPerLID_
Number of packets to receive for each receive operation.
Insert new values that don't currently exist.
typename device_type::execution_space execution_space
The Kokkos execution space.
Kokkos::DualView< packet_type *, buffer_device_type > imports_
Buffer into which packed data are imported (received from other processes).
Kokkos::DualView< packet_type *, buffer_device_type > exports_
Buffer from which packed data are exported (sent to other processes).
::Tpetra::Details::DefaultTypes::comm_buffer_memory_space< device_type > buffer_memory_space
Kokkos memory space for communication buffers.
Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distr...
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)
Pack data and metadata for communication (sends).
CombineMode
Rule for combining data in an Import or Export.
Teuchos::RCP< const map_type > map_
The Map over which this object is distributed.
virtual size_t constantNumberOfPackets() const
Whether the implementation's instance promises always to have a constant number of packets per LID (l...
Abstract base class for objects that can be the source of an Import or Export operation.
ReadWriteOption
Read/write options for non-const views.
DistObject & operator=(const DistObject< Packet, LocalOrdinal, GlobalOrdinal, Node > &)=default
Assignment operator (default).
LocalOrdinal local_ordinal_type
The type of local indices.
ReverseOption
Whether the data transfer should be performed in forward or reverse mode.
DistObject(const Teuchos::RCP< const map_type > &map)
Constructor.
virtual bool reallocImportsIfNeeded(const size_t newSize, const bool verbose, const std::string *prefix, const bool remoteLIDsContiguous=false, const CombineMode CM=INSERT)
Reallocate imports_ if needed.
A parallel distribution of indices over processes.
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").
bool isDistributed() const
Whether this is a globally distributed object.
Kokkos::Device< typename device_type::execution_space, buffer_memory_space > buffer_device_type
Kokkos::Device specialization for communication buffers.
Base class for distributed Tpetra objects that support data redistribution.
virtual void removeEmptyProcessesInPlace(const Teuchos::RCP< const map_type > &newMap)
Remove processes which contain no entries in this object's Map.
virtual bool checkSizes(const SrcDistObject &source)=0
Compare the source and target (this) objects for compatibility.