Skip to content

Namespace TempLat::device_kokkos

Namespace List > TempLat > device_kokkos

Namespaces

Type Name
namespace iteration
namespace memory

Classes

Type Name
class DeviceGuard
A class to manage and initialize the Kokkos runtime environment and its dependencies.
struct GetKokkosNDStarType <NDim, typename T>
struct GetKokkosNDStarType< 1, T > <typename T>
struct KokkosNDLambdaWrapper <NDim, typename FUN>
This is a functor which wraps a lambda. Basically, this is necessary when one wants to call a variadic lambda on an NVIDIA GPU. CUDA seems to be unable to expand the variadic arguments - in contrast, a direct approach does indeed work for openMP or serial compilation. To get around this limitation, the KokkosNDLambdaWrapper packs the indices into an array. If you wonder, whether there's a difference when using tie and tuples:https://godbolt.org/z/M3bG39rsM No. Therefore, we spare the ourselves the hassle and simply use an array.
struct KokkosNDLambdaWrapperInnerLoop <NDim, typename FUN>
The CPU dispatch: a functor which wraps a lambda and walks the contiguous last dimension itself.
struct KokkosNDLambdaWrapperReduction <NDim, typename FUN>
This is a functor which wraps a lambda for reduction. Basically, this is necessary when one wants to call a variadic lambda on an NVIDIA GPU. CUDA seems to be unable to expand the variadic arguments - in contrast, a direct approach does indeed work for openMP or serial compilation. To get around this limitation, the KokkosNDLambdaWrapperReduction packs the indices into an array. If you wonder, whether there's a difference when using tie and tuples:https://godbolt.org/z/M3bG39rsM No. Therefore, we spare the ourselves the hassle and simply use an array.

Public Types

Type Name
typedef Kokkos::DefaultExecutionSpace DefaultExecutionSpace
typedef Kokkos::DefaultHostExecutionSpace DefaultHostExecutionSpace
typedef Kokkos::LayoutRight DefaultLayout
typedef int64_t Idx
typedef std::array< Idx, NDim > IdxArray
typedef std::array< T, N > array
typedef Kokkos::complex< T > complex

Public Attributes

Type Name
constexpr bool reverse_access_pattern = false

Public Functions

Type Name
MakeException (KokkosDeviceGuardInstantiationException)
auto getLocalKokkosOuterPolicy (const LayoutStruct< NDim > & layout)
The CPU counterpart of getLocalKokkosPolicy: a policy over the OUTER NDim-1 dimensions only. The contiguous last dimension is left to KokkosNDLambdaWrapperInnerLoop , which walks it in a plain loop that the vectorizer can see. Never used on GPU, where the full-rank MDRange with the reversed access pattern is what gives coalesced access.
auto getLocalKokkosPolicy (const LayoutStruct< NDim > & layout)
auto getLocalKokkosPolicy (const device_kokkos::array< I, NDim > & starts, const device_kokkos::array< I, NDim > & stops)
DEVICE_INLINE_FUNCTION auto reverse_array (const device_kokkos::array< Arg, N > & arr, std::index_sequence< Is... >)
DEVICE_INLINE_FUNCTION auto reverse_array (const device_kokkos::array< Arg, N > & arr)
DEVICE_INLINE_FUNCTION auto reverse_tuple (const device_kokkos::tuple< Args... > & tuple, std::index_sequence< Is... >)
DEVICE_INLINE_FUNCTION auto reverse_tuple (const device_kokkos::tuple< Args... > & tuple)
DEVICE_INLINE_FUNCTION constexpr auto tuple_first (const device_kokkos::tuple< Head, Tail... > & t)
Returns the first i elements of the given tuple t.
DEVICE_INLINE_FUNCTION constexpr auto tuple_last (const device_kokkos::tuple< Head, Tail... > & t)
Returns the last i elements of the given tuple t.

Public Types Documentation

typedef DefaultExecutionSpace

using TempLat::device_kokkos::DefaultExecutionSpace = typedef Kokkos::DefaultExecutionSpace;

typedef DefaultHostExecutionSpace

using TempLat::device_kokkos::DefaultHostExecutionSpace = typedef Kokkos::DefaultHostExecutionSpace;

typedef DefaultLayout

using TempLat::device_kokkos::DefaultLayout = typedef Kokkos::LayoutRight;

typedef Idx

using TempLat::device_kokkos::Idx = typedef int64_t;

typedef IdxArray

using TempLat::device_kokkos::IdxArray = typedef std::array<Idx, NDim>;

typedef array

using TempLat::device_kokkos::array = typedef std::array<T, N>;

typedef complex

using TempLat::device_kokkos::complex = typedef Kokkos::complex<T>;

Public Attributes Documentation

variable reverse_access_pattern

constexpr bool TempLat::device_kokkos::reverse_access_pattern;

Public Functions Documentation

function MakeException

TempLat::device_kokkos::MakeException (
    KokkosDeviceGuardInstantiationException
) 

function getLocalKokkosOuterPolicy

The CPU counterpart of getLocalKokkosPolicy: a policy over the OUTER NDim-1 dimensions only. The contiguous last dimension is left to KokkosNDLambdaWrapperInnerLoop , which walks it in a plain loop that the vectorizer can see. Never used on GPU, where the full-rank MDRange with the reversed access pattern is what gives coalesced access.

template<size_t NDim>
auto TempLat::device_kokkos::getLocalKokkosOuterPolicy (
    const LayoutStruct < NDim > & layout
) 


function getLocalKokkosPolicy

template<size_t NDim>
auto TempLat::device_kokkos::getLocalKokkosPolicy (
    const LayoutStruct < NDim > & layout
) 

function getLocalKokkosPolicy

template<size_t NDim, typename I>
auto TempLat::device_kokkos::getLocalKokkosPolicy (
    const device_kokkos::array< I, NDim > & starts,
    const device_kokkos::array< I, NDim > & stops
) 

function reverse_array

template<typename Arg, size_t N, std::size_t... Is>
DEVICE_INLINE_FUNCTION auto TempLat::device_kokkos::reverse_array (
    const device_kokkos::array< Arg, N > & arr,
    std::index_sequence< Is... >
) 

function reverse_array

template<typename Arg, size_t N>
DEVICE_INLINE_FUNCTION auto TempLat::device_kokkos::reverse_array (
    const device_kokkos::array< Arg, N > & arr
) 

function reverse_tuple

template<typename... Args, std::size_t... Is>
DEVICE_INLINE_FUNCTION auto TempLat::device_kokkos::reverse_tuple (
    const device_kokkos::tuple< Args... > & tuple,
    std::index_sequence< Is... >
) 

function reverse_tuple

template<typename... Args>
DEVICE_INLINE_FUNCTION auto TempLat::device_kokkos::reverse_tuple (
    const device_kokkos::tuple< Args... > & tuple
) 

function tuple_first

Returns the first i elements of the given tuple t.

template<int i, typename Head, typename... Tail>
DEVICE_INLINE_FUNCTION constexpr auto TempLat::device_kokkos::tuple_first (
    const device_kokkos::tuple< Head, Tail... > & t
) 

Template parameters:

  • i size of the tuple to be returned

Parameters:

  • t tuple to be split

Returns:

auto a tied tuple of the first i elements


function tuple_last

Returns the last i elements of the given tuple t.

template<size_t i, typename Head, typename... Tail>
DEVICE_INLINE_FUNCTION constexpr auto TempLat::device_kokkos::tuple_last (
    const device_kokkos::tuple< Head, Tail... > & t
) 

Template parameters:

  • i size of the tuple to be returned

Parameters:

  • t tuple to be split

Returns:

auto a tied tuple of the last i elements



The documentation for this class was generated from the following file cosmolatticeweb/tmp/code_source/templat/include/TempLat/parallel/devices/kokkos/kokkos.h