The Kokkos wrapper class for standard map. More...
#include <KokkosMap.h>
Public Member Functions | |
auto | begin () |
Get the beginning writeable iterator of the host map. More... | |
auto | begin () const |
Get the beginning const iterator of the host map. More... | |
auto | end () |
Get the end writeable iterator of the host map. More... | |
auto | end () const |
Get the end const iterator of the host map. More... | |
auto & | get () |
Get the underlying writeable host map. More... | |
const auto & | get () const |
Get the underlying const host map. More... | |
T2 & | operator[] (const T1 &key) |
Call host map's operator[]. More... | |
void | copyToDevice () |
Copy host map to device. More... | |
void | copyToDeviceNested () |
Copy host map to device, perform nested copy for Kokkos arrays. More... | |
void | swap (Map< T1, T2 > &map) |
Swap with another Kokkos map. More... | |
KOKKOS_FUNCTION dof_id_type | size () const |
Get the size of map. More... | |
KOKKOS_FUNCTION dof_id_type | find (const T1 &key) const |
Find the index of a key. More... | |
KOKKOS_FUNCTION bool | exists (const T1 &key) const |
Get whether a key exists. More... | |
KOKKOS_FUNCTION const T1 & | key (dof_id_type idx) const |
Get the key of an index. More... | |
KOKKOS_FUNCTION const T2 & | value (dof_id_type idx) const |
Get the value of an index. More... | |
KOKKOS_FUNCTION const T2 & | operator[] (const T1 &key) const |
Get the value corresponding to a key. More... | |
KOKKOS_FUNCTION const T2 & | operator() (const T1 &key) const |
Static Public Attributes | |
static const dof_id_type | invalid_id = libMesh::DofObject::invalid_id |
Private Member Functions | |
void | copy () |
Internal method to copy host map to device. More... | |
Private Attributes | |
std::shared_ptr< std::map< T1, T2 > > | _map_host |
Standard map on host Stored as a shared pointer to avoid deep copy. More... | |
Array< T1 > | _keys |
Keys on device. More... | |
Array< T2 > | _values |
Values on device. More... | |
Array< dof_id_type > | _offset |
Beginning offset into device arrays of each bucket. More... | |
Friends | |
void | dataStore (std::ostream &, Map< T1, T2 > &, void *) |
void | dataLoad (std::istream &, Map< T1, T2 > &, void *) |
The Kokkos wrapper class for standard map.
The map can only be populated on host. Make sure to call copyToDevice() or copyToDeviceNested() after populating the map on host.
Definition at line 60 of file KokkosMap.h.
|
inline |
Get the beginning writeable iterator of the host map.
Definition at line 80 of file KokkosMap.h.
Referenced by Moose::Kokkos::Map< unsigned int, unsigned int >::begin().
|
inline |
Get the beginning const iterator of the host map.
Definition at line 85 of file KokkosMap.h.
|
private |
Internal method to copy host map to device.
Definition at line 243 of file KokkosMap.h.
void Moose::Kokkos::Map< T1, T2 >::copyToDevice | ( | ) |
Copy host map to device.
Definition at line 275 of file KokkosMap.h.
void Moose::Kokkos::Map< T1, T2 >::copyToDeviceNested | ( | ) |
Copy host map to device, perform nested copy for Kokkos arrays.
Definition at line 285 of file KokkosMap.h.
|
inline |
Get the end writeable iterator of the host map.
Definition at line 90 of file KokkosMap.h.
Referenced by Moose::Kokkos::Map< unsigned int, unsigned int >::end().
|
inline |
Get the end const iterator of the host map.
Definition at line 95 of file KokkosMap.h.
|
inline |
Get whether a key exists.
key | The key |
Definition at line 161 of file KokkosMap.h.
Referenced by KokkosMatCoupledForce::computeQpOffDiagJacobian().
KOKKOS_FUNCTION dof_id_type Moose::Kokkos::Map< T1, T2 >::find | ( | const T1 & | key | ) | const |
Find the index of a key.
key | The key |
Definition at line 305 of file KokkosMap.h.
Referenced by Moose::Kokkos::Map< unsigned int, unsigned int >::exists().
|
inline |
Get the underlying writeable host map.
Definition at line 100 of file KokkosMap.h.
Referenced by Moose::Kokkos::dataLoad(), Moose::Kokkos::dataStore(), and Moose::Kokkos::Map< unsigned int, unsigned int >::swap().
|
inline |
Get the underlying const host map.
Definition at line 111 of file KokkosMap.h.
|
inline |
Get the key of an index.
idx | The index returned by find() |
Definition at line 167 of file KokkosMap.h.
Referenced by Moose::Kokkos::Map< unsigned int, unsigned int >::exists(), Moose::Kokkos::Map< unsigned int, unsigned int >::operator()(), and Moose::Kokkos::Map< unsigned int, unsigned int >::operator[]().
|
inline |
Definition at line 204 of file KokkosMap.h.
|
inline |
Call host map's operator[].
key | The key |
Definition at line 123 of file KokkosMap.h.
Referenced by Moose::Kokkos::Map< unsigned int, unsigned int >::operator()().
|
inline |
Get the value corresponding to a key.
key | The key |
Definition at line 190 of file KokkosMap.h.
|
inline |
Get the size of map.
Definition at line 144 of file KokkosMap.h.
Referenced by Moose::Kokkos::Map< unsigned int, unsigned int >::size().
void Moose::Kokkos::Map< T1, T2 >::swap | ( | Map< T1, T2 > & | map | ) |
Swap with another Kokkos map.
map | The Kokkos map to be swapped |
Definition at line 295 of file KokkosMap.h.
|
inline |
Get the value of an index.
idx | The index returned by find() |
Definition at line 178 of file KokkosMap.h.
|
friend |
Definition at line 335 of file KokkosMap.h.
|
friend |
Definition at line 323 of file KokkosMap.h.
|
private |
Keys on device.
Definition at line 226 of file KokkosMap.h.
Referenced by Moose::Kokkos::dataLoad(), Moose::Kokkos::dataStore(), Moose::Kokkos::Map< unsigned int, unsigned int >::key(), Moose::Kokkos::Map< unsigned int, unsigned int >::size(), and Moose::Kokkos::Map< unsigned int, unsigned int >::swap().
|
mutableprivate |
Standard map on host Stored as a shared pointer to avoid deep copy.
Definition at line 222 of file KokkosMap.h.
Referenced by Moose::Kokkos::Map< unsigned int, unsigned int >::get().
|
private |
Beginning offset into device arrays of each bucket.
Definition at line 234 of file KokkosMap.h.
Referenced by Moose::Kokkos::dataLoad(), Moose::Kokkos::dataStore(), and Moose::Kokkos::Map< unsigned int, unsigned int >::swap().
|
private |
Values on device.
Definition at line 230 of file KokkosMap.h.
Referenced by Moose::Kokkos::dataLoad(), Moose::Kokkos::dataStore(), Moose::Kokkos::Map< unsigned int, unsigned int >::swap(), and Moose::Kokkos::Map< unsigned int, unsigned int >::value().
|
static |
Definition at line 208 of file KokkosMap.h.
Referenced by Moose::Kokkos::Map< unsigned int, unsigned int >::exists(), Moose::Kokkos::Map< unsigned int, unsigned int >::key(), and Moose::Kokkos::Map< unsigned int, unsigned int >::value().