KokkosNDLambdaWrapper< dim, FUN > Struct Template Reference#

DiFfRG: DiFfRG::KokkosNDLambdaWrapper< dim, FUN > Struct Template Reference
DiFfRG
DiFfRG::KokkosNDLambdaWrapper< dim, FUN > Struct Template Reference

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. More...

#include <kokkos.hh>

Public Member Functions

KOKKOS_FUNCTION KokkosNDLambdaWrapper (const FUN &_fun)
 
template<typename... Args>
requires (sizeof...(Args) == dim)
KOKKOS_FORCEINLINE_FUNCTION void operator() (Args &&...args) const
 

Public Attributes

FUN fun
 

Detailed Description

template<int dim, typename FUN>
struct DiFfRG::KokkosNDLambdaWrapper< dim, 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.

Template Parameters
dimNumber of arguments taken
FUNThe lambda to which we forward the indices

Constructor & Destructor Documentation

◆ KokkosNDLambdaWrapper()

template<int dim, typename FUN >
KOKKOS_FUNCTION DiFfRG::KokkosNDLambdaWrapper< dim, FUN >::KokkosNDLambdaWrapper ( const FUN & _fun)
inline

Member Function Documentation

◆ operator()()

template<int dim, typename FUN >
template<typename... Args>
requires (sizeof...(Args) == dim)
KOKKOS_FORCEINLINE_FUNCTION void DiFfRG::KokkosNDLambdaWrapper< dim, FUN >::operator() ( Args &&... args) const
inline

Member Data Documentation

◆ fun

template<int dim, typename FUN >
FUN DiFfRG::KokkosNDLambdaWrapper< dim, FUN >::fun

The documentation for this struct was generated from the following file:
  • /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/kokkos.hh