|
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>
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);
510 virtual Teuchos::RCP<const map_type>
getMap ()
const {
return map_; }
520 void print (std::ostream &os)
const;
537 describe (Teuchos::FancyOStream &out,
538 const Teuchos::EVerbosityLevel verbLevel =
539 Teuchos::Describable::verbLevel_default)
const;
649 const ::Tpetra::Details::Transfer<local_ordinal_type, global_ordinal_type, node_type>& transfer,
650 const char modeString[],
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,
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,
942 Teuchos::RCP<const map_type>
map_;
951 Kokkos::DualView<packet_type*, buffer_device_type>
imports_;
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
Kokkos::DualView< packet_type *, buffer_device_type > exports_
Buffer from which packed data are exported (sent to other processes).
virtual void releaseViews() const
Hook for releasing views.
virtual void removeEmptyProcessesInPlace(const Teuchos::RCP< const map_type > &newMap)
Remove processes which contain no entries in this object's Map.
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)
Redistribute data across memory images.
LocalOrdinal local_ordinal_type
The type of local indices.
bool reallocImportsIfNeeded(const size_t newSize, const bool debug=false)
Reallocate imports_ if needed.
Teuchos::RCP< const map_type > map_
The Map over which this object is distributed.
void doImport(const SrcDistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
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.
::Kokkos::Compat::KokkosDeviceWrapperNode< execution_space > node_type
Default value of Node template parameter.
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.
Forward declaration of Tpetra::DistObject.
Node::device_type device_type
The Kokkos Device type.
device_type::memory_space buffer_memory_space
Kokkos memory space for communication buffers.
void doExport(const SrcDistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export data into this object using an Export object ("forward mode").
virtual Teuchos::RCP< const map_type > getMap() const
The Map describing the parallel distribution of this object.
virtual bool checkSizes(const SrcDistObject &source)=0
Compare the source and target (this) objects for compatibility.
virtual std::string description() const
One-line descriptiion of this object.
void print(std::ostream &os) const
Print this object to the given output stream.
virtual void createViews() const
Hook for creating a const view.
Base class for distributed Tpetra objects that support data redistribution.
ReverseOption
Whether the data transfer should be performed in forward or reverse mode.
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.
ReadWriteOption
Read/write options for non-const views.
virtual ~DistObject()
Destructor (virtual for memory safety of derived classes).
Communication plan for data redistribution from a uniquely-owned to a (possibly) multiply-owned distr...
Sets up and executes a communication plan for a Tpetra DistObject.
Kokkos::DualView< packet_type *, buffer_device_type > imports_
Buffer into which packed data are imported (received from other processes).
Abstract base class for sources of an Import or Export.
int local_ordinal_type
Default value of Scalar template parameter.
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...
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 size_t constantNumberOfPackets() const
Whether the implementation's instance promises always to have a constant number of packets per LID (l...
Map< local_ordinal_type, global_ordinal_type, node_type > map_type
The type of the Map specialization to use with this class.
A parallel distribution of indices over processes.
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.
device_type::execution_space execution_space
The Kokkos execution space.
Kokkos::DualView< size_t *, buffer_device_type > numImportPacketsPerLID_
Number of packets to receive for each receive operation.
Classes::Map< LocalOrdinal, GlobalOrdinal, Node > Map
Alias for Tpetra::Classes::Map.
::Kokkos::Details::ArithTraits< Packet >::val_type packet_type
The type of each datum being sent or received in an Import or Export.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Kokkos::Device< typename device_type::execution_space, buffer_memory_space > buffer_device_type
Kokkos::Device specialization for communication buffers.
virtual bool useNewInterface()
Whether the subclass implements the "old" or "new" (Kokkos-friendly) interface.
Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distr...
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...
Abstract base class for objects that can be the source of an Import or Export operation.
virtual void createViewsNonConst(KokkosClassic::ReadWriteOption rwo)
Hook for creating a nonconst view.
Kokkos::DualView< size_t *, buffer_device_type > numExportPacketsPerLID_
Number of packets to send for each send operation.
bool isDistributed() const
Whether this is a globally distributed object.
Node node_type
The Kokkos Node type.
GlobalOrdinal global_ordinal_type
The type of global indices.
CombineMode
Rule for combining data in an Import or Export.
DistObject(const Teuchos::RCP< const map_type > &map)
Constructor.