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. | |
| auto | begin () const |
| Get the beginning const iterator of the host map. | |
| auto | end () |
| Get the end writeable iterator of the host map. | |
| auto | end () const |
| Get the end const iterator of the host map. | |
| auto & | get () |
| Get the underlying writeable host map. | |
| const auto & | get () const |
| Get the underlying const host map. | |
| void | clear () |
| Clear the underlying data. | |
| T2 & | operator[] (const T1 &key) |
| Call host map's operator[]. | |
| void | copyToDevice () |
| Copy host map to device. | |
| void | copyToDeviceNested () |
| Copy host map to device, perform nested copy for Kokkos arrays. | |
| void | swap (MapBase< T1, T2, index_type, MapType > &map) |
| Swap with another Kokkos map. | |
| KOKKOS_FUNCTION index_type | size () const |
| Get the size of map. | |
| KOKKOS_FUNCTION index_type | find (const T1 &key) const |
| Find the index of a key. | |
| KOKKOS_FUNCTION bool | exists (const T1 &key) const |
| Get whether a key exists. | |
| KOKKOS_FUNCTION const T1 & | key (index_type idx) const |
| Get the key of an index. | |
| KOKKOS_FUNCTION const T2 & | value (index_type idx) const |
| Get the value of an index. | |
| KOKKOS_FUNCTION const T2 & | operator[] (const T1 &key) const |
| Get the value corresponding to a key. | |
| KOKKOS_FUNCTION const T2 & | operator() (const T1 &key) const |
Static Public Attributes | |
| static constexpr index_type | invalid_id = std::numeric_limits<index_type>::max() |
Private Member Functions | |
| void | copy () |
| Internal method to copy host map to device. | |
Private Attributes | |
| std::shared_ptr< MapType< T1, T2 > > | _map_host |
| Standard map on host Stored as a shared pointer to avoid deep copy. | |
| Array< T1, 1, index_type > | _keys |
| Keys on device. | |
| Array< T2, 1, index_type > | _values |
| Values on device. | |
| Array< index_type, 1, index_type > | _offset |
| Beginning offset into device arrays of each bucket. | |
Friends | |
| void | dataStore (std::ostream &, MapBase< T1, T2, index_type, MapType > &, void *) |
| void | dataLoad (std::istream &, MapBase< T1, T2, index_type, MapType > &, 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 68 of file KokkosMap.h.
|
inline |
Get the beginning writeable iterator of the host map.
Definition at line 75 of file KokkosMap.h.
|
inline |
Get the beginning const iterator of the host map.
Definition at line 80 of file KokkosMap.h.
| void Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::clear | ( | ) |
Clear the underlying data.
Definition at line 245 of file KokkosMap.h.
|
private |
Internal method to copy host map to device.
Definition at line 257 of file KokkosMap.h.
| void Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::copyToDevice | ( | ) |
Copy host map to device.
Definition at line 289 of file KokkosMap.h.
| void Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::copyToDeviceNested | ( | ) |
Copy host map to device, perform nested copy for Kokkos arrays.
Definition at line 299 of file KokkosMap.h.
|
inline |
Get the end writeable iterator of the host map.
Definition at line 85 of file KokkosMap.h.
|
inline |
Get the end const iterator of the host map.
Definition at line 90 of file KokkosMap.h.
|
inline |
Get whether a key exists.
| key | The key |
Definition at line 160 of file KokkosMap.h.
| KOKKOS_FUNCTION index_type Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::find | ( | const T1 & | key | ) | const |
Find the index of a key.
| key | The key |
Definition at line 319 of file KokkosMap.h.
Referenced by Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::exists(), and Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::operator[]().
|
inline |
Get the underlying writeable host map.
Definition at line 95 of file KokkosMap.h.
Referenced by Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::begin(), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::begin(), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::end(), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::end(), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::operator[](), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::operator[](), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::size(), and Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::swap().
|
inline |
Get the underlying const host map.
Definition at line 106 of file KokkosMap.h.
|
inline |
Get the key of an index.
| idx | The index returned by find() |
Definition at line 166 of file KokkosMap.h.
Referenced by Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::exists(), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::operator()(), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::operator[](), and Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::operator[]().
|
inline |
Definition at line 203 of file KokkosMap.h.
|
inline |
Call host map's operator[].
| key | The key |
Definition at line 122 of file KokkosMap.h.
Referenced by Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::operator()().
|
inline |
Get the value corresponding to a key.
| key | The key |
Definition at line 189 of file KokkosMap.h.
|
inline |
Get the size of map.
Definition at line 143 of file KokkosMap.h.
Referenced by Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::size().
| void Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::swap | ( | MapBase< T1, T2, index_type, MapType > & | map | ) |
Swap with another Kokkos map.
| map | The Kokkos map to be swapped |
Definition at line 309 of file KokkosMap.h.
|
inline |
Get the value of an index.
| idx | The index returned by find() |
Definition at line 177 of file KokkosMap.h.
|
friend |
Definition at line 349 of file KokkosMap.h.
|
friend |
Definition at line 337 of file KokkosMap.h.
|
private |
Keys on device.
Definition at line 225 of file KokkosMap.h.
Referenced by Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::key(), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::size(), and Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::swap().
|
mutableprivate |
Standard map on host Stored as a shared pointer to avoid deep copy.
Definition at line 221 of file KokkosMap.h.
Referenced by Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::get(), and Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::get().
|
private |
Beginning offset into device arrays of each bucket.
Definition at line 233 of file KokkosMap.h.
Referenced by Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::swap().
|
private |
Values on device.
Definition at line 229 of file KokkosMap.h.
Referenced by Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::operator[](), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::swap(), and Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::value().
|
staticconstexpr |
Definition at line 207 of file KokkosMap.h.
Referenced by Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::exists(), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::key(), Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::operator[](), and Moose::Kokkos::MapBase< T1, T2, index_type, MapType >::value().