75template <
typename TData>
class Operator;
79template <
typename TData>
83 const std::vector<std::string> &>;
113 const std::vector<std::string> components)
146 template <
template <
typename>
typename TOperator>
147 static std::shared_ptr<TOperator<TData>>
Create(
149 const std::vector<std::string> components,
const std::string &execStr)
151 auto session = expansionList->GetSession();
153 std::string execStr0 = (execStr ==
"")
157 std::string requestedKey = TOperator<TData>::name + execStr0;
164 std::stringstream msg;
165 msg <<
"No such operator: " << requestedKey << std::endl;
170 return std::static_pointer_cast<TOperator<TData>>(
191 std::shared_ptr<LibUtilities::SessionReader>
session,
192 const bool warn =
true)
195#if defined(NEKTAR_ENABLE_SIMD)
201 if (
session->DefinesCmdLineArgument(
"opExecSpace"))
203 OpExec =
session->GetCmdLineArgument<std::string>(
"opExecSpace");
208 "No execution space specified for operator. Defaulting "
226 const std::string &execSpace)
233 exp->DetShapeType(), exp->EvalBasisNumModesMax() - 1);
257 const std::string &execSpace)
260 return rule ? std::string(rule->
opImpl) :
"SumFac";
291 const auto session = expansionList->GetSession();
292 std::vector<unsigned int> interleave_widths;
296 interleave_widths.assign(
GetCollections(expansionList).size(), 1u);
303 session->GetBackendMap(execName);
304 const bool cmdLineImpl =
session->DefinesCmdLineArgument(
"opImpl");
305 const std::string cmdLineImplName =
306 cmdLineImpl ?
session->GetCmdLineArgument<std::string>(
"opImpl")
311 const std::string implName =
312 cmdLineImpl ? cmdLineImplName
317 interleave_widths.push_back(
318 (implName ==
"SumFac" || execName ==
"AVX")
319 ? NektarSpaces::GetVectorWidth<TData>(execName)
323 return interleave_widths;
335 std::shared_ptr<LibUtilities::SessionReader>
session)
337 if (!
session->DefinesSolverInfo(
"Projection"))
342 std::string projection =
344 return projection ==
"DG" || projection ==
"DISCONTINUOUS";
The table of default operator implementations, by execution space, device architecture,...
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
LibUtilities::SessionReaderSharedPtr session
bool ModuleExists(tKey idKey)
Checks if a particular module is available.
tBasePtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
void PrintAvailableClasses(std::ostream &pOut=std::cout)
Prints the available classes to stdout.
Common base class of the operator family interfaces: holds the expansion list, component names and da...
Operator(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > components)
Construct the interface part of a concrete operator; called by the factory-registered creator functio...
std::vector< std::string > m_components
Names of the field components the operator was built for.
MultiRegions::ExpListSharedPtr m_expansionList
Expansion list the operator acts on.
virtual ~Operator()=default
static std::vector< unsigned int > GetDefaultInterleaveWidths(const MultiRegions::ExpListSharedPtr &expansionList)
Return the default interleave widths, one per block of expansionList, that persistent Fields (e....
static std::shared_ptr< TOperator< TData > > Create(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > components, const std::string &execStr)
Create a concrete operator instance through the operator factory.
static std::string GetDefaultOpImpl(const StdRegions::StdExpansionSharedPtr &exp, const std::string &execSpace)
Return the implementation a block of elements takes when neither the command line nor the session nam...
LibUtilities::NekDataWarehouseSharedPtr m_dataWarehouse
Data warehouse shared with the other operators on the expansion list, used to build and cache shared ...
static bool IsDiscontinuousProjection(std::shared_ptr< LibUtilities::SessionReader > session)
Return true if the session uses a Discontinuous (DG) projection.
static std::string GetOpExecSpace(std::shared_ptr< LibUtilities::SessionReader > session, const bool warn=true)
Return the execution space name ("opExecSpace") for an operator.
static const DefaultOpImplRule * GetDefaultOpImplRule(const StdRegions::StdExpansionSharedPtr &exp, const std::string &execSpace)
Return the row of the default implementation table (DefaultOpImplTable.hpp) that a block of elements ...
std::shared_ptr< NekDataWarehouse > NekDataWarehouseSharedPtr
std::map< std::string, std::string > BackendMap
Collections::CollectionVector GetCollections(MultiRegions::ExpListSharedPtr expansionList)
const DefaultOpImplRule * FindDefaultOpImplRule(const std::string_view execSpace, const std::string_view arch, const LibUtilities::ShapeType shape, const int order, const DefaultOpImplRule *first=std::begin(defaultOpImplTable), const DefaultOpImplRule *last=std::end(defaultOpImplTable))
Return the row of a default implementation table that a block takes, or null if none does (the block ...
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
OperatorFactory< TData > & GetOperatorFactory()
Return the process-wide singleton OperatorFactory<TData>, constructing it on first use.
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::string ToUpperCopy(std::string str)
static unsigned int nekGetNumDevice()
static std::string GetDeviceArchitecture()
Return the architecture id of the device the calling rank uses, as the default implementation table (...
One row of the default implementation table.
std::string_view opImpl
Implementation the row selects.