Tpetra Matrix/Vector Services  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Tpetra::Details::Map< LO, GO, DeviceType > Class Template Reference

Device implementation of Tpetra::Map. More...

#include <Tpetra_KokkosRefactor_Details_Map.hpp>

Inheritance diagram for Tpetra::Details::Map< LO, GO, DeviceType >:
Inheritance graph
[legend]

List of all members.

Public Types

Typedefs
typedef LO local_ordinal_type
 The type of local indices.
typedef GO global_ordinal_type
 The type of global indices.
typedef DeviceType device_type
 The type of the Kokkos Device.

Public Member Functions

Constructors
 Map ()
 Empty constructor is helpful for clone(), etc.
 Map (const GO globalNumIndices, const GO indexBase, const Teuchos::Comm< int > &comm, const LocalGlobal lOrG)
 Contiguous uniform constructor.
 Map (const GO globalNumIndices, const LO myNumIndices, const GO indexBase, const Teuchos::Comm< int > &comm)
 Contiguous but possibly nonuniform constructor.
 Map (const GO globalNumIndices, const Kokkos::View< const GO *, DeviceType > &myGlobalIndices, const GO indexBase, const Teuchos::Comm< int > &comm)
 Possibly noncontiguous constructor.
template<class InDeviceType >
void create_copy_view (const Map< LO, GO, InDeviceType > &map)
 Make this Map a copy of the input Map, but for a (possibly) different device.
void setDistributed (const bool distributed)
 Set the distributed_ state.
bool initialized () const
 Whether this Map has been initialized.
Methods safe to call in a Kokkos parallel kernel.
KOKKOS_INLINE_FUNCTION GO getGlobalNumIndices () const
 The number of indices owned by all processes in the Map's communicator.
KOKKOS_INLINE_FUNCTION LO getMyNumIndices () const
 The number of indices owned by the calling process.
KOKKOS_INLINE_FUNCTION GO getIndexBase () const
 The index base for this Map.
KOKKOS_INLINE_FUNCTION LO getInvalidLocalIndex () const
 An invalid local index.
KOKKOS_INLINE_FUNCTION LO getMinLocalIndex () const
 The minimum local index (on the calling process).
KOKKOS_INLINE_FUNCTION LO getMaxLocalIndex () const
 The maximum local index on the calling process.
KOKKOS_INLINE_FUNCTION LO getInvalidGlobalIndex () const
 An invalid global index.
KOKKOS_INLINE_FUNCTION GO getMinGlobalIndex () const
 The minimum global index owned by the calling process.
KOKKOS_INLINE_FUNCTION GO getMaxGlobalIndex () const
 The maximum global index owned by the calling process.
KOKKOS_INLINE_FUNCTION GO getMinAllGlobalIndex () const
 The minimum global index over all processes in the communicator.
KOKKOS_INLINE_FUNCTION GO getMaxAllGlobalIndex () const
 The maximum global index over all processes in the communicator.
KOKKOS_INLINE_FUNCTION LO getLocalIndex (const GO globalIndex) const
 The local index corresponding to the given global index.
KOKKOS_INLINE_FUNCTION GO getGlobalIndex (const LO localIndex) const
 The global index corresponding to the given local index.
KOKKOS_INLINE_FUNCTION bool isOwnedLocalIndex (const LO localIndex) const
 Whether the given local index is owned by (valid on) the calling process.
KOKKOS_INLINE_FUNCTION bool isOwnedGlobalIndex (const GO globalIndex) const
 Whether the given global index is owned by the calling process.
KOKKOS_INLINE_FUNCTION bool isUniform () const
 Whether the range of global indices is uniform.
KOKKOS_INLINE_FUNCTION bool isContiguous () const
 True if this Map is distributed contiguously, else false.
KOKKOS_INLINE_FUNCTION bool isDistributed () const
 Whether this Map is globally distributed or locally replicated.

Methods <i>not</i> safe to call in a Kokkos parallel kernel

Kokkos::View< const GO
*, DeviceType > 
getMyGlobalIndices ()
 Return a view of the global indices owned by this process.
std::string description ()
 A one-line description of this object.
void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
 Print this object with the given verbosity level to the given Teuchos::FancyOStream.

Detailed Description

template<class LO, class GO, class DeviceType>
class Tpetra::Details::Map< LO, GO, DeviceType >

Device implementation of Tpetra::Map.

Template Parameters:
LOThe local ordinal type
GOThe global ordinal type
DeviceTypeThe Kokkos device type

All methods marked const may be called in Kokkos parallel kernels. No method that is not marked const may be called in a Kokkos parallel kernel.

This class must not inherit from Teuchos::Describable, because that class contains data (e.g., the object label) that cannot live in CUDA device memory. Every datum in this device must be able to live on a CUDA device, without requiring UVM.

Definition at line 295 of file Tpetra_KokkosRefactor_Details_Map.hpp.


Member Typedef Documentation

template<class LO, class GO, class DeviceType>
typedef LO Tpetra::Details::Map< LO, GO, DeviceType >::local_ordinal_type

The type of local indices.

Definition at line 302 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
typedef GO Tpetra::Details::Map< LO, GO, DeviceType >::global_ordinal_type

The type of global indices.

Definition at line 304 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
typedef DeviceType Tpetra::Details::Map< LO, GO, DeviceType >::device_type

The type of the Kokkos Device.

Definition at line 306 of file Tpetra_KokkosRefactor_Details_Map.hpp.


Constructor & Destructor Documentation

template<class LO, class GO, class DeviceType>
Tpetra::Details::Map< LO, GO, DeviceType >::Map ( ) [inline]

Empty constructor is helpful for clone(), etc.

Definition at line 313 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
Tpetra::Details::Map< LO, GO, DeviceType >::Map ( const GO  globalNumIndices,
const GO  indexBase,
const Teuchos::Comm< int > &  comm,
const LocalGlobal  lOrG 
) [inline]

Contiguous uniform constructor.

Definition at line 332 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
Tpetra::Details::Map< LO, GO, DeviceType >::Map ( const GO  globalNumIndices,
const LO  myNumIndices,
const GO  indexBase,
const Teuchos::Comm< int > &  comm 
) [inline]

Contiguous but possibly nonuniform constructor.

Definition at line 489 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
Tpetra::Details::Map< LO, GO, DeviceType >::Map ( const GO  globalNumIndices,
const Kokkos::View< const GO *, DeviceType > &  myGlobalIndices,
const GO  indexBase,
const Teuchos::Comm< int > &  comm 
) [inline]

Possibly noncontiguous constructor.

Definition at line 629 of file Tpetra_KokkosRefactor_Details_Map.hpp.


Member Function Documentation

template<class LO, class GO, class DeviceType>
template<class InDeviceType >
void Tpetra::Details::Map< LO, GO, DeviceType >::create_copy_view ( const Map< LO, GO, InDeviceType > &  map) [inline]

Make this Map a copy of the input Map, but for a (possibly) different device.

Definition at line 957 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
void Tpetra::Details::Map< LO, GO, DeviceType >::setDistributed ( const bool  distributed) [inline]

Set the distributed_ state.

This method exists to avoid making Tpetra::Map a friend of this class.

Warning:
This method only sets the host datum. Any "mirror" that is resident in device memory won't get this setting automatically.

Definition at line 1020 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
bool Tpetra::Details::Map< LO, GO, DeviceType >::initialized ( ) const [inline]

Whether this Map has been initialized.

The default Map constructor creates an uninitialized Map. All other Map constructors create an initialized Map. The create_copy_view method set the output Map (the *this argument) as initialized.

It is an error to use an uninitialized Map. Results are undefined, but the resulting Map will likely behave as if it were empty.

Definition at line 1034 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION GO Tpetra::Details::Map< LO, GO, DeviceType >::getGlobalNumIndices ( ) const [inline]

The number of indices owned by all processes in the Map's communicator.

Definition at line 1043 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION LO Tpetra::Details::Map< LO, GO, DeviceType >::getMyNumIndices ( ) const [inline]

The number of indices owned by the calling process.

Definition at line 1048 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION GO Tpetra::Details::Map< LO, GO, DeviceType >::getIndexBase ( ) const [inline]

The index base for this Map.

Definition at line 1053 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION LO Tpetra::Details::Map< LO, GO, DeviceType >::getInvalidLocalIndex ( ) const [inline]

An invalid local index.

Map's methods that return a local index use this index to indicate an error condition. For example, if getLocalIndex() gets a global index that is not owned by the calling process, it returns an invalid local index, which equals the return value of this method.

Definition at line 1064 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION LO Tpetra::Details::Map< LO, GO, DeviceType >::getMinLocalIndex ( ) const [inline]

The minimum local index (on the calling process).

Definition at line 1069 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION LO Tpetra::Details::Map< LO, GO, DeviceType >::getMaxLocalIndex ( ) const [inline]

The maximum local index on the calling process.

If this process owns no indices, that is, if getMyNumIndices() == 0, then this method returns Teuchos::OrdinalTraits<LO>::invalid().

Definition at line 1078 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION LO Tpetra::Details::Map< LO, GO, DeviceType >::getInvalidGlobalIndex ( ) const [inline]

An invalid global index.

Map's methods that return a global index use this index to indicate an error condition. For example, if getGlobalIndex() gets a local index that is not owned by the calling process, it returns an invalid global index, which equals the return value of this method.

Definition at line 1091 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION GO Tpetra::Details::Map< LO, GO, DeviceType >::getMinGlobalIndex ( ) const [inline]

The minimum global index owned by the calling process.

Definition at line 1096 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION GO Tpetra::Details::Map< LO, GO, DeviceType >::getMaxGlobalIndex ( ) const [inline]

The maximum global index owned by the calling process.

Definition at line 1101 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION GO Tpetra::Details::Map< LO, GO, DeviceType >::getMinAllGlobalIndex ( ) const [inline]

The minimum global index over all processes in the communicator.

Definition at line 1106 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION GO Tpetra::Details::Map< LO, GO, DeviceType >::getMaxAllGlobalIndex ( ) const [inline]

The maximum global index over all processes in the communicator.

Definition at line 1111 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION LO Tpetra::Details::Map< LO, GO, DeviceType >::getLocalIndex ( const GO  globalIndex) const [inline]

The local index corresponding to the given global index.

If the given global index is not owned by this process, return Teuchos::OrdinalTraits<LO>::invalid().

Definition at line 1119 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION GO Tpetra::Details::Map< LO, GO, DeviceType >::getGlobalIndex ( const LO  localIndex) const [inline]

The global index corresponding to the given local index.

If the given local index is not valid on the calling process, return Teuchos::OrdinalTraits<GO>::invalid().

Definition at line 1150 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION bool Tpetra::Details::Map< LO, GO, DeviceType >::isOwnedLocalIndex ( const LO  localIndex) const [inline]

Whether the given local index is owned by (valid on) the calling process.

Definition at line 1167 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION bool Tpetra::Details::Map< LO, GO, DeviceType >::isOwnedGlobalIndex ( const GO  globalIndex) const [inline]

Whether the given global index is owned by the calling process.

Definition at line 1174 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION bool Tpetra::Details::Map< LO, GO, DeviceType >::isUniform ( ) const [inline]

Whether the range of global indices is uniform.

This is a conservative quantity. It need only be true if the Map was constructed using the first (uniform contiguous) constructor or a nonmember constructor that calls it. We reserve the right to do more work to check this in the future.

Definition at line 1185 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION bool Tpetra::Details::Map< LO, GO, DeviceType >::isContiguous ( ) const [inline]

True if this Map is distributed contiguously, else false.

Currently, creating this Map using the constructor for a user-defined arbitrary distribution (that takes a list of global elements owned on each process) means that this method always returns false. We currently make no effort to test whether the user-provided global indices are actually contiguous on all the processes. Many operations may be faster for contiguous Maps. Thus, if you know the indices are contiguous on all processes, you should consider using one of the constructors for contiguous elements.

Definition at line 1200 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
KOKKOS_INLINE_FUNCTION bool Tpetra::Details::Map< LO, GO, DeviceType >::isDistributed ( ) const [inline]

Whether this Map is globally distributed or locally replicated.

Returns:
True if this Map is globally distributed, else false.

"Globally distributed" means that all of the following are true:

  1. The map's communicator has more than one process.
  2. There is at least one process in the map's communicator, whose local number of indices does not equal the number of global indices. (That is, not all the indices are replicated over all the processes.)

If at least one of the above are not true, then the map is "locally replicated." (The two are mutually exclusive.)

Calling this method requires no communication or computation, because the result is precomputed in Map's constructors.

Definition at line 1225 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
Kokkos::View<const GO*, DeviceType> Tpetra::Details::Map< LO, GO, DeviceType >::getMyGlobalIndices ( ) [inline]

Return a view of the global indices owned by this process.

If you call this method on a contiguous Map, it will create and cache the list of global indices for later use. Beware of calling this if the calling process owns a very large number of global indices.

Definition at line 1239 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
std::string Tpetra::Details::Map< LO, GO, DeviceType >::description ( ) [inline]

A one-line description of this object.

Definition at line 1252 of file Tpetra_KokkosRefactor_Details_Map.hpp.

template<class LO, class GO, class DeviceType>
void Tpetra::Details::Map< LO, GO, DeviceType >::describe ( Teuchos::FancyOStream &  out,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::Describable::verbLevel_default 
) [inline]

Print this object with the given verbosity level to the given Teuchos::FancyOStream.

Definition at line 1258 of file Tpetra_KokkosRefactor_Details_Map.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines