Nektar++
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions | Variables
ExpressionBlockOpDeviceGenericHelper.hpp File Reference

The parts of the runtime-compiled expression kernel shared by every device back-end: its variants, its launch arguments and the generators of its constants, parameter list and body. More...

#include <array>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <boost/lexical_cast.hpp>
#include <LibUtilities/Backends/Backends.hpp>
#include <LibUtilities/BasicUtils/Equation.h>

Go to the source code of this file.

Classes

struct  Nektar::MultiRegions::detail::ExpressionKernelArgs< TData >
 The arguments an expression kernel is launched with, in the order its parameter list declares them (see GetExpressionKernelParameters()). More...
 
struct  Nektar::MultiRegions::detail::ExpressionKernelVariant
 One variant of the expression kernel: the template arguments instantiating it, and the suffix naming it where a back-end needs a kernel function of its own per variant. More...
 

Namespaces

namespace  Nektar
 
namespace  Nektar::MultiRegions
 
namespace  Nektar::MultiRegions::detail
 

Enumerations

enum  Nektar::MultiRegions::detail::ExpressionKernelIndex {
  Nektar::MultiRegions::detail::eAppendScalar = 0 , Nektar::MultiRegions::detail::eAssignScalar , Nektar::MultiRegions::detail::eAppendInterleaved , Nektar::MultiRegions::detail::eAssignInterleaved ,
  Nektar::MultiRegions::detail::eNumExpressionKernels
}
 The variants of the expression kernel that are compiled, in the order Apply() selects them: appending to or assigning the output, reading storage interleaved at width one or at the device warp size. More...
 

Functions

std::array< ExpressionKernelVariant, eNumExpressionKernels > Nektar::MultiRegions::detail::GetExpressionKernelVariants (void)
 The kernel variants, in ExpressionKernelIndex order.
 
int Nektar::MultiRegions::detail::findMatching (const std::string &s, int start, int direction)
 Find the bracket matching the one at start by scanning in the given direction.
 
std::string Nektar::MultiRegions::detail::convertPow (std::string expr)
 Rewrite every caret power x^y in expr into a pow(x, y) call, since ^ is exclusive-or rather than exponentiation in the generated kernel source.
 
std::string Nektar::MultiRegions::detail::GetExpressionKernelConstants (const std::vector< LibUtilities::EquationSharedPtr > &exprs)
 Emit the constants and the parameters of the expressions as macro variables, so that they are substituted when the kernel is compiled. A name defined by several expressions is emitted once.
 
std::string Nektar::MultiRegions::detail::GetExpressionKernelParameters (const std::vector< std::string > &vnames, const std::vector< bool > &cmask)
 Emit the parameter list of an expression kernel, without the enclosing brackets: the fields of ExpressionKernelArgs in order, the EVAR pointers named <name>ptr and the outputs out<nc>.
 
std::string Nektar::MultiRegions::detail::GetExpressionKernelArguments (const std::vector< std::string > &vnames, const std::vector< bool > &cmask)
 Emit the argument list matching GetExpressionKernelParameters(), without the enclosing brackets, so that a kernel can forward its parameters on.
 
bool Nektar::MultiRegions::detail::IsDeviceExpression (const std::set< std::string > &variables, const std::set< std::string > &functions, const unsigned int coordDim)
 Whether the expression kernel can be compiled for an expression using variables and calling functions (see ExpressionBlockOp::GetExpressionVariables() and ExpressionBlockOp::GetExpressionFunctions()).
 
std::string Nektar::MultiRegions::detail::GetExpressionKernelBody (const std::vector< LibUtilities::EquationSharedPtr > &exprs, const std::vector< bool > &cmask, const std::vector< std::string > &vnames, const unsigned int coordDim, const std::string &threadIndex, const std::string &mathPrefix)
 Emit the body of an expression kernel, without the enclosing braces.
 

Variables

const std::string Nektar::MultiRegions::detail::expressionKernelName = "expression_kernel"
 The name the generated kernel function is compiled under.
 

Detailed Description

The parts of the runtime-compiled expression kernel shared by every device back-end: its variants, its launch arguments and the generators of its constants, parameter list and body.

The back-end helpers, ExpressionBlockOpDeviceGenericHIPCUDAHelper.hpp and ExpressionBlockOpDeviceGenericSYCLHelper.hpp, wrap these pieces in a kernel declaration of their own, then compile and launch the result.

Definition in file ExpressionBlockOpDeviceGenericHelper.hpp.