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 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>
345 template <
class Packet,
347 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
351 virtual public Teuchos::Describable
361 typedef typename ::Kokkos::Details::ArithTraits<Packet>::val_type
packet_type;
375 typedef typename Kokkos::View<packet_type*, device_type>::size_type view_size_type;
387 explicit DistObject (
const Teuchos::RCP<const map_type>& map);
502 bool isDistributed ()
const;
510 virtual Teuchos::RCP<const map_type>
getMap ()
const {
return map_; }
520 void print (std::ostream &os)
const;
530 virtual std::string description ()
const;
537 describe (Teuchos::FancyOStream &out,
538 const Teuchos::EVerbosityLevel verbLevel =
539 Teuchos::Describable::verbLevel_default)
const;
626 virtual size_t constantNumberOfPackets ()
const;
649 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, node_type>& transfer,
650 const char modeString[],
669 reallocArraysForNumPacketsPerLid (
const size_t numExportLIDs,
670 const size_t numImportLIDs);
676 const Teuchos::ArrayView<const local_ordinal_type> &permuteToLIDs,
677 const Teuchos::ArrayView<const local_ordinal_type> &permuteFromLIDs,
678 const Teuchos::ArrayView<const local_ordinal_type> &remoteLIDs,
679 const Teuchos::ArrayView<const local_ordinal_type> &exportLIDs,
687 #ifdef KOKKOS_ENABLE_CUDA 688 typedef typename std::conditional<
689 std::is_same<typename device_type::execution_space, Kokkos::Cuda>::value,
694 #endif // KOKKOS_ENABLE_CUDA 708 typedef Kokkos::Device<
709 typename device_type::execution_space,
717 const size_t numSameIDs,
718 const Kokkos::DualView<
const local_ordinal_type*,
719 device_type>& permuteToLIDs,
720 const Kokkos::DualView<
const local_ordinal_type*,
721 device_type>& permuteFromLIDs,
722 const Kokkos::DualView<
const local_ordinal_type*,
723 device_type>& remoteLIDs,
724 const Kokkos::DualView<
const local_ordinal_type*,
725 device_type>& exportLIDs,
728 const bool commOnHost);
783 const Teuchos::ArrayView<const local_ordinal_type>& permuteToLIDs,
784 const Teuchos::ArrayView<const local_ordinal_type>& permuteFromLIDs)
788 const size_t numSameIDs,
789 const Kokkos::DualView<const local_ordinal_type*, device_type>& permuteToLIDs,
790 const Kokkos::DualView<const local_ordinal_type*, device_type>& permuteFromLIDs)
817 const Teuchos::ArrayView<const local_ordinal_type>& exportLIDs,
818 Teuchos::Array<packet_type>& exports,
819 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
820 size_t& constantNumPackets,
826 const Kokkos::DualView<const local_ordinal_type*, device_type>& exportLIDs,
827 Kokkos::DualView<packet_type*, buffer_device_type>& exports,
828 const Kokkos::DualView<size_t*, buffer_device_type>& numPacketsPerLID,
829 size_t& constantNumPackets,
858 const Teuchos::ArrayView<const packet_type>& imports,
859 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
860 size_t constantNumPackets,
892 const Kokkos::DualView<const packet_type*, buffer_device_type>& imports,
893 const Kokkos::DualView<const size_t*, buffer_device_type>& numPacketsPerLID,
894 const size_t constantNumPackets,
906 virtual void createViews ()
const;
939 virtual void releaseViews ()
const;
942 Teuchos::RCP<const map_type>
map_;
951 Kokkos::DualView<packet_type*, buffer_device_type>
imports_;
968 reallocImportsIfNeeded (
const size_t newSize,
const bool debug =
false);
990 Kokkos::DualView<packet_type*, buffer_device_type>
exports_;
1007 #ifdef HAVE_TPETRA_TRANSFER_TIMERS 1009 Teuchos::RCP<Teuchos::Time> doXferTimer_;
1010 Teuchos::RCP<Teuchos::Time> copyAndPermuteTimer_;
1011 Teuchos::RCP<Teuchos::Time> packAndPrepareTimer_;
1012 Teuchos::RCP<Teuchos::Time> doPostsAndWaitsTimer_;
1013 Teuchos::RCP<Teuchos::Time> unpackAndCombineTimer_;
1014 #endif // HAVE_TPETRA_TRANSFER_TIMERS 1022 #endif // TPETRA_DISTOBJECT_DECL_HPP Base class for distributed Tpetra objects that support data redistribution.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distr...
Kokkos::DualView< packet_type *, buffer_device_type > exports_
Buffer from which packed data are exported (sent to other processes).
void removeEmptyProcessesInPlace(Teuchos::RCP< DistObjectType > &input)
Remove processes which contain no elements in this object's Map.
LocalOrdinal local_ordinal_type
The type of local indices.
GlobalOrdinal global_ordinal_type
The type of global indices.
Abstract base class for sources of an Import or Export.
Node node_type
The Kokkos Node type.
Forward declaration of Tpetra::DistObject.
virtual Teuchos::RCP< const map_type > getMap() const
The Map describing the parallel distribution of this object.
int local_ordinal_type
Default value of Scalar template parameter.
Classes::Map< LocalOrdinal, GlobalOrdinal, Node > Map
Alias for Tpetra::Classes::Map.
::Tpetra::Classes::DistObject< Packet, LocalOrdinal, GlobalOrdinal, Node > DistObject
Alias for Tpetra::Classes::DistObject.
virtual void unpackAndCombineNew(const Kokkos::DualView< const local_ordinal_type *, device_type > &importLIDs, const Kokkos::DualView< const packet_type *, buffer_device_type > &imports, const Kokkos::DualView< const size_t *, buffer_device_type > &numPacketsPerLID, const size_t constantNumPackets, Distributor &distor, const CombineMode CM)
Perform any unpacking and combining after communication (new version that uses Kokkos data structures...
Kokkos::DualView< packet_type *, buffer_device_type > imports_
Buffer into which packed data are imported (received from other processes).
Teuchos::RCP< const map_type > map_
The Map over which this object is distributed.
Kokkos::DualView< size_t *, buffer_device_type > numImportPacketsPerLID_
Number of packets to receive for each receive operation.
virtual void packAndPrepare(const SrcDistObject &source, const Teuchos::ArrayView< const local_ordinal_type > &exportLIDs, Teuchos::Array< packet_type > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets, Distributor &distor)
Perform any packing or preparation required for communication.
Sets up and executes a communication plan for a Tpetra DistObject.
CombineMode
Rule for combining data in an Import or Export.
Node::device_type device_type
The Kokkos Device type.
Abstract base class for objects that can be the source of an Import or Export operation.
Kokkos::DualView< size_t *, buffer_device_type > numExportPacketsPerLID_
Number of packets to send for each send operation.
ReadWriteOption
Read/write options for non-const views.
virtual void unpackAndCombine(const Teuchos::ArrayView< const local_ordinal_type > &importLIDs, const Teuchos::ArrayView< const packet_type > &imports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t constantNumPackets, Distributor &distor, CombineMode CM)
Perform any unpacking and combining after communication (old version that uses Teuchos memory managem...
::Kokkos::Compat::KokkosDeviceWrapperNode< execution_space > node_type
Default value of Node template parameter.
::Kokkos::Details::ArithTraits< Packet >::val_type packet_type
The type of each datum being sent or received in an Import or Export.
Communication plan for data redistribution from a uniquely-owned to a (possibly) multiply-owned distr...
virtual bool useNewInterface()
Whether the subclass implements the "old" or "new" (Kokkos-friendly) interface.
virtual void copyAndPermute(const SrcDistObject &source, size_t numSameIDs, const Teuchos::ArrayView< const local_ordinal_type > &permuteToLIDs, const Teuchos::ArrayView< const local_ordinal_type > &permuteFromLIDs)
Perform copies and permutations that are local to this process.
Kokkos::Device< typename device_type::execution_space, buffer_memory_space > buffer_device_type
Kokkos::Device specialization for communication buffers.
device_type::memory_space buffer_memory_space
Kokkos memory space for communication buffers.
A parallel distribution of indices over processes.
device_type::execution_space execution_space
The Kokkos execution space.
ReverseOption
Whether the data transfer should be performed in forward or reverse mode.
Map< local_ordinal_type, global_ordinal_type, node_type > map_type
The type of the Map specialization to use with this class.