39 #include <cuda_runtime.h>
84 template<
typename... Args>
86 const std::string& format,
98 const std::string& message);
101 static void Error(
const std::string& errorMessage);
111 const std::string& delimiters,
112 const int indentation = 0,
113 const int lineSize = 65);
125 template<
typename ... Args>
131 size_t size = snprintf(
nullptr, 0, format.c_str(), args ... ) + 1;
133 std::unique_ptr<char[]> buf(
new char[ size ] );
134 snprintf(buf.get(), size, format.c_str(), args ... );
135 return std::string( buf.get(), buf.get() + size - 1 );
140 size_t size = _snprintf (
nullptr, 0, format.c_str(), args ... ) + 1;
142 std::unique_ptr<char[]> buf(
new char[ size ] );
143 _snprintf (buf.get(), size, format.c_str(), args ... );
144 return std::string( buf.get(), buf.get() + size - 1 );
160 static std::string
GetWord(std::istringstream& textStream,
161 const std::string& delimiters);
182 template <
bool forceSynchronisation = false>
184 const char* routineName,
185 const char* fileName,
186 const int lineNumber)
188 if (forceSynchronisation)
190 cudaDeviceSynchronize();
193 if (errorCode != cudaSuccess)
197 cudaGetErrorString(errorCode),
209 #define checkCudaErrors(val) CheckErrors ( (val), #val, __FILE__, __LINE__ )
Static class implementing the user interface by info messages.
static std::string WordWrapString(const std::string &inputString, const std::string &delimiters, const int indentation=0, const int lineSize=65)
Wrap the line based on logger conventions.
static TLogLevel logLevel
Log level of the logger.
static TLogLevel GetLevel()
Get the log level.
TErrorMessage ERR_FMT_GPU_ERROR
CUDAParameters error message.
static void SetLevel(const TLogLevel actualLogLevel)
Set the log level.
static void Error(const std::string &errorMessage)
Log an error.
static void ErrorAndTerminate(const std::string &errorMessage)
Log an error and terminate the execution.
TLogger()
Default constructor is not allowed, static class.
static std::string GetWord(std::istringstream &textStream, const std::string &delimiters)
Extract a word (string between two delimiters)
TLogLevel
Log level of the message.
static void Flush(const TLogLevel queryLevel)
Flush output messages.
The header file containing routines for error messages and error messages common for both linux and w...
The header file including output messages based on the operating system.
Basic (default) level of verbosity.
void CheckErrors(const cudaError_t errorCode, const char *routineName, const char *fileName, const int lineNumber)
Checks CUDA errors, create an error message and throw an exception.
static std::string FormatMessage(const std::string &format, Args...args)
C++-11 replacement for sprintf that works with std::string instead of char *.
Advanced level of verbosity.
static void Log(const TLogLevel queryLevel, const std::string &format, Args...args)
Log desired activity for a given log level, version with string format.
~TLogger()
Destructor is not allowed, static class.