12#ifndef MFEM_KERNEL_REPORTER_HPP 
   13#define MFEM_KERNEL_REPORTER_HPP 
   20#define MFEM_STR_(X) #X 
   21#define MFEM_STR(X) MFEM_STR_(X) 
   22#define MFEM_KERNEL_NAME(KernelName)  \ 
   23   __FILE__ ":" MFEM_STR(__LINE__) " : " #KernelName 
   31template <
typename Last>
 
   32static void Stringify_(std::ostream &o, Last &&arg)
 
   37template <
typename T1, 
typename T2, 
typename... Rest>
 
   38static void Stringify_(std::ostream &o, T1 &&a1, T2 &&a2, Rest&&... rest)
 
   41   Stringify_(o, a2, rest...);
 
   44template <
typename... 
Args>
 
   45static std::string Stringify(
Args&&... args)
 
   48   Stringify_(o, args...);
 
   64   std::set<std::string> reported_fallbacks;
 
   67      const char *env = 
GetEnv(
"MFEM_REPORT_KERNELS");
 
   70         if (std::string(env) != 
"NO") { enabled = 
true; }
 
   80   static void Enable() { Instance().enabled = 
true; }
 
   82   static void Disable() { Instance().enabled = 
false; }
 
   84   template <
typename... Params>
 
   85   static void ReportFallback(
const std::string &kernel_name, Params&&... params)
 
   87      if (!Instance().enabled) { 
return; }
 
   88      auto &reported_fallbacks = Instance().reported_fallbacks;
 
   89      const std::string requested_kernel =
 
   90         kernel_name + 
"<" + internal::Stringify(params...) + 
">";
 
   91      if (reported_fallbacks.find(requested_kernel) == reported_fallbacks.end())
 
   93         reported_fallbacks.insert(requested_kernel);
 
   94         mfem::err << 
"Fallback kernel. Requested " 
   95                   << requested_kernel << std::endl;
 
 
 
Singleton class to report fallback kernels.
static void Enable()
Enable reporting of fallback kernels.
static void Disable()
Disable reporting of fallback kernels.
static void ReportFallback(const std::string &kernel_name, Params &&... params)
Report the fallback kernel with given parameters.
const char * GetEnv(const char *name)
Wrapper for std::getenv.
OutStream err(std::cerr)
Global stream used by the library for standard error output. Initially it uses the same std::streambu...
kernels::InvariantsEvaluator2D::Buffers Args