Concepts and Traits¶
Concepts¶
-
template<typename T>
concept KokkosView¶ Specifies that a type
T
is aKokkos::View
object.
-
template<typename T>
concept KokkosExecutionSpace¶ Specifies that a type
T
is aKokkos::ExecutionSpace
.
-
template<typename T>
concept CommunicationSpace¶ Specifies that a type
T
is a KokkosComm communication backend.
Traits¶
General traits¶
-
template<KokkosView View>
struct Traits<View>¶ A struct that can be specialized to implement custom behavior for a particular Kokkos view.
-
template<KokkosView View>
static auto data_handle(const View &v) -> View::pointer_type¶ - Template Parameters:
View – The type of the Kokkos view.
- Parameters:
v – The Kokkos view to query.
- Returns:
The pointer to the underlying data allocation.
-
template<KokkosView View>
static auto span(const View &v) -> size_t¶ - Template Parameters:
View – The type of the Kokkos view.
- Parameters:
v – The Kokkos view to query.
- Returns:
The number of bytes between the beginning of the first byte and the end of the last byte of data in
v
.
For example, if
View
was an std::vector<int16_t> of size 3, it would be 6. If theView
is non-contiguous, the result includes any “holes” inv
.
-
template<KokkosView View>
static auto is_contiguous(const View &v) -> bool¶ Checks if a view is contiguous.
- Template Parameters:
View – The type of the Kokkos view.
- Parameters:
v – The Kokkos view to query.
- Returns:
True if, and only if, the data in
v
is contiguous.
-
template<KokkosView View>
static constexpr auto rank() -> size_t¶ - Template Parameters:
View – The type of the Kokkos view.
- Returns:
The rank (number of dimensions) of the
View
type.
-
template<KokkosView View>
static constexpr auto extent(const View &v, const int i) -> size_t¶ - Template Parameters:
View – The type of the Kokkos view.
- Parameters:
v – The Kokkos view to query.
i – The index of the dimension. Must be smaller than the
rank
of the view.
- Returns:
The extent of the specified dimension.
-
template<KokkosView View>
static constexpr auto stride(const View &v, const int i) -> size_t¶ - Template Parameters:
View – The type of the Kokkos view.
- Parameters:
v – The Kokkos view to query.
i – The index of the dimension. Must be smaller than the
rank
of the view.
- Returns:
The stride of the specified dimension.
-
template<KokkosView View>
static constexpr auto is_reference_counted() -> bool¶ - Template Parameters:
View – The type of the Kokkos view.
- Returns:
True if, and only if, the type is subject to reference counting (e.g., always true for
Kokkos::View
objects).
This is used to determine if asynchronous MPI operations may need to extend the lifetime of this type when it’s used as an argument.
Packing Traits¶
Strategies for handling non-contiguous views.