10#ifndef TPETRA_DISTOBJECT_DECL_HPP
11#define TPETRA_DISTOBJECT_DECL_HPP
16#include "Tpetra_Details_DistributorActor.hpp"
17#include "Tpetra_Map.hpp"
18#include "Tpetra_Import.hpp"
19#include "Tpetra_Export.hpp"
22#include "KokkosKernels_ArithTraits.hpp"
26namespace KokkosClassic {
121template <
class DistObjectType>
123 const Teuchos::RCP<
const Map<
typename DistObjectType::local_ordinal_type,
124 typename DistObjectType::global_ordinal_type,
125 typename DistObjectType::node_type> >& newMap);
163template <
class DistObjectType>
277template <
class Packet,
282 virtual public Teuchos::Describable {
291 using packet_type = typename ::KokkosKernels::ArithTraits<Packet>::val_type;
314 explicit DistObject(
const Teuchos::RCP<const map_type>& map);
375 const bool restrictedMode =
false);
409 const bool restrictedMode =
false);
444 const bool restrictedMode =
false);
479 const bool restrictedMode =
false);
485 const bool restrictedMode =
false);
491 const bool restrictedMode =
false);
497 const bool restrictedMode =
false);
503 const bool restrictedMode =
false);
509 const bool restrictedMode =
false);
515 const bool restrictedMode =
false);
521 const bool restrictedMode =
false);
527 const bool restrictedMode =
false);
550 virtual Teuchos::RCP<const map_type>
getMap()
const {
return map_; }
578 const Teuchos::EVerbosityLevel verbLevel =
579 Teuchos::Describable::verbLevel_default)
const;
630 const Details::DistributorActor&
getActor() {
return distributorActor_; }
689 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, node_type>& transfer,
690 const char modeString[],
693 const bool restrictedMode);
711 const size_t numImportLIDs);
716 ::Tpetra::Details::DefaultTypes::comm_buffer_memory_space<device_type>;
730 Kokkos::Device<
typename device_type::execution_space,
740 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, node_type>& transfer,
741 const char modeString[],
744 const bool restrictedMode);
747 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, node_type>& transfer,
748 const char modeString[],
751 const bool restrictedMode);
754 size_t constantNumPackets,
756 std::shared_ptr<std::string> prefix,
757 const bool canTryAliasing,
761 size_t constantNumPackets,
763 std::shared_ptr<std::string> prefix);
766 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& exportLIDs,
767 size_t& constantNumPackets,
770 void doUnpackAndCombine(
const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& remoteLIDs,
771 size_t constantNumPackets,
824 const size_t numSameIDs,
835 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteToLIDs,
836 const Kokkos::DualView<const local_ordinal_type*, buffer_device_type>& permuteFromLIDs,
882 Kokkos::DualView<
size_t*,
885 size_t& constantNumPackets);
895 Kokkos::DualView<
size_t*,
898 size_t& constantNumPackets,
946 Kokkos::DualView<
size_t*,
949 const size_t constantNumPackets,
958 Kokkos::DualView<
size_t*,
961 const size_t constantNumPackets,
966 Teuchos::RCP<const map_type>
map_;
969 std::unique_ptr<std::string>
970 createPrefix(
const char className[],
971 const char methodName[])
const;
979 Kokkos::DualView<packet_type*, buffer_device_type>
imports_;
1006 const std::string* prefix,
1007 const bool remoteLIDsContiguous =
false,
1030 Kokkos::DualView<packet_type*, buffer_device_type>
exports_;
1050 Details::DistributorActor distributorActor_;
ReadWriteOption
Read/write options for non-const views.
Forward declaration of Tpetra::DistObject.
Abstract base class for sources of an Import or Export.
DistObject(const DistObject< Packet, LocalOrdinal, GlobalOrdinal, Node > &)=default
Copy constructor (default).
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 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.
void doImport(const SrcDistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const CombineMode CM, const bool restrictedMode=false)
Import data into this object using an Export object ("reverse mode").
DistObject(DistObject< Packet, LocalOrdinal, GlobalOrdinal, Node > &&)=default
Move constructor (default).
Kokkos::DualView< size_t *, buffer_device_type > numImportPacketsPerLID_
Kokkos::DualView< packet_type *, buffer_device_type > exports_
Kokkos::DualView< packet_type *, buffer_device_type > imports_
virtual bool reallocArraysForNumPacketsPerLid(const size_t numExportLIDs, const size_t numImportLIDs)
Reallocate numExportPacketsPerLID_ and/or numImportPacketsPerLID_, if necessary.
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 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.
DistObject(const Teuchos::RCP< const map_type > &map)
Constructor.
::Tpetra::Details::DefaultTypes::comm_buffer_memory_space< device_type > buffer_memory_space
Kokkos::Device< typename device_type::execution_space, buffer_memory_space > buffer_device_type
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, const execution_space &space)
Same as copyAndPermute, but do operations in space.
bool transferArrived() const
Whether the data from an import/export operation has arrived, and is ready for the unpack and combine...
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).
DistObject & operator=(const DistObject< Packet, LocalOrdinal, GlobalOrdinal, Node > &)=default
Assignment operator (default).
void doExport(const SrcDistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const CombineMode CM, const bool restrictedMode=false)
Export data into this object using an Import object ("reverse mode").
DistObject & operator=(DistObject< Packet, LocalOrdinal, GlobalOrdinal, Node > &&)=default
Move assignment (default).
typename Node::device_type device_type
Map< local_ordinal_type, global_ordinal_type, node_type > map_type
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.
virtual bool checkSizes(const SrcDistObject &source)=0
Compare the source and target (this) objects for compatibility.
typename device_type::execution_space execution_space
void print(std::ostream &os) const
Print this object to the given output stream.
Kokkos::DualView< size_t *, buffer_device_type > numExportPacketsPerLID_
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 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.
Teuchos::RCP< const map_type > map_
ReverseOption
Whether the data transfer should be performed in forward or reverse mode.
const Details::DistributorActor & getActor()
Getter for the DistributorActor.
virtual size_t constantNumberOfPackets() const
Whether the implementation's instance promises always to have a constant number of packets per LID (l...
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").
virtual std::string description() const
One-line descriptiion of this object.
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 ::KokkosKernels::ArithTraits< char >::val_type packet_type
virtual void removeEmptyProcessesInPlace(const Teuchos::RCP< const map_type > &newMap)
Remove processes which contain no entries in this object's Map.
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, const execution_space &space)
Same as packAndPrepare, but in an execution space instance.
bool isDistributed() const
Whether this is a globally distributed object.
Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distr...
Communication plan for data redistribution from a uniquely-owned to a (possibly) multiply-owned distr...
A parallel distribution of indices over processes.
Abstract base class for objects that can be the source of an Import or Export operation.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
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.
CombineMode
Rule for combining data in an Import or Export.
@ INSERT
Insert new values that don't currently exist.