Traits

General traits

template<KokkosView V>
struct Traits<V>

A struct that can be specialized to implement custom behavior for a particular Kokkos View.

using non_const_packed_view_type = Kokkos::View<typename V::non_const_data_type, typename V::execution_space::array_layout, typename V::memory_space>
using packed_view_type = Kokkos::View<typename V::data_type, typename V::execution_space::array_layout, typename V::memory_space>
template<KokkosView V>
[[nodiscard]] constexpr auto data_handle(const V &view) noexcept -> V::pointer_type
Template Parameters:

V – A Kokkos View type.

Parameters:

view – The Kokkos View to query.

Returns:

A pointer to the underlying data allocation.

template<KokkosView V>
[[nodiscard]] constexpr auto rank() noexcept -> size_t
template<KokkosView V>
[[nodiscard]] constexpr auto rank([[maybe_unused]] const V &view) noexcept -> size_t
Template Parameters:

V – A Kokkos view type.

Parameters:

view – The Kokkos view to query.

Returns:

The rank (number of dimensions) of the View.

template<KokkosView V>
[[nodiscard]] constexpr auto size(const V &view) noexcept -> size_t
Template Parameters:

V – A Kokkos View type.

Parameters:

view – The Kokkos View to query.

Returns:

The product of extents, i.e., the logical number of elements in the View.

template<KokkosView V>
[[nodiscard]] constexpr auto span(const V &view) noexcept -> V::size_type
Template Parameters:

V – A Kokkos View type.

Parameters:

view – The Kokkos View to query.

Returns:

The span between the elements of lowest and highest address.

The span may be larger than the product of extents due to padding, and or non-contiguous data layout.

template<KokkosView V, std::integral I>
[[nodiscard]] constexpr auto extent(const V &view, I i) noexcept -> size_t
Template Parameters:
  • V – A Kokkos view type.

  • I – An integral type.

Parameters:
  • view – The Kokkos view to query.

  • i – The index of the dimension. Must be smaller than the rank of the View.

Returns:

The extent (number of elements) of the specified dimension.

template<KokkosView V, std::integral I>
[[nodiscard]] constexpr auto stride(const V &view, I i) noexcept -> size_t
Template Parameters:
  • V – A Kokkos view type.

  • I – An integral type.

Parameters:
  • view – The Kokkos view to query.

  • i – The index of the dimension. Must be smaller than the rank of the View.

Returns:

The stride (number of elements the mapping advances upon increment) of the specified dimension.

template<KokkosView V>
[[nodiscard]] constexpr auto is_reference_counted() noexcept -> bool
template<KokkosView V>
[[nodiscard]] constexpr auto is_reference_counted([[maybe_unused]] const V &view) noexcept -> bool
Template Parameters:

V – A Kokkos view type.

Parameters:

view – The Kokkos view to query.

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 communication operations may need to extend the lifetime of this type when it is used as an argument.

template<KokkosView V>
[[nodiscard]] auto is_contiguous(const V &view) noexcept -> bool

Checks if a view is contiguous in memory.

Template Parameters:

V – A Kokkos view type.

Parameters:

view – The Kokkos view to query.

Returns:

True if, and only if, the product of extents is equal to the span.

Packing Traits

Strategies for handling non-contiguous views.

template<typename T>
struct PackTraits<T>

A common packing-related struct that can be specialized to implement custom behavior for a particular Kokkos view.

using packer_type = Impl::Packer::DeepCopy<View>

The packer to use for this View type.