68 #define zeroThread (threadIdx.x + blockDim.x*blockIdx.x==0 && \
69 threadIdx.y + blockDim.y*blockIdx.y==0 && \
70 threadIdx.z + blockDim.z*blockIdx.z==0)
72 #define printfZero(...) do { \
73 if (zeroThread) printf(__VA_ARGS__); \
78 #define printfQuda(...) do { \
79 sprintf(getPrintBuffer(), __VA_ARGS__); \
80 if (getRankVerbosity()) { \
81 fprintf(getOutputFile(), "%s", getOutputPrefix()); \
82 fprintf(getOutputFile(), "%s", getPrintBuffer()); \
83 fflush(getOutputFile()); \
87 #define errorQuda(...) \
89 fprintf(getOutputFile(), "%sERROR: ", getOutputPrefix()); \
90 fprintf(getOutputFile(), __VA_ARGS__); \
91 fprintf(getOutputFile(), " (rank %d, host %s, " __FILE__ ":%d in %s())\n", comm_rank_global(), comm_hostname(), \
92 __LINE__, __func__); \
93 fprintf(getOutputFile(), "%s last kernel called was (name=%s,volume=%s,aux=%s)\n", getOutputPrefix(), \
94 getLastTuneKey().name, getLastTuneKey().volume, getLastTuneKey().aux); \
95 fflush(getOutputFile()); \
96 quda::saveTuneCache(true); \
100 #define warningQuda(...) do { \
101 if (getVerbosity() > QUDA_SILENT) { \
102 sprintf(getPrintBuffer(), __VA_ARGS__); \
103 if (getRankVerbosity()) { \
104 fprintf(getOutputFile(), "%sWARNING: ", getOutputPrefix()); \
105 fprintf(getOutputFile(), "%s", getPrintBuffer()); \
106 fprintf(getOutputFile(), "\n"); \
107 fflush(getOutputFile()); \
114 #define printfQuda(...) do { \
115 fprintf(getOutputFile(), "%s", getOutputPrefix()); \
116 fprintf(getOutputFile(), __VA_ARGS__); \
117 fflush(getOutputFile()); \
120 #define errorQuda(...) do { \
121 fprintf(getOutputFile(), "%sERROR: ", getOutputPrefix()); \
122 fprintf(getOutputFile(), __VA_ARGS__); \
123 fprintf(getOutputFile(), " (" __FILE__ ":%d in %s())\n", \
124 __LINE__, __func__); \
125 fprintf(getOutputFile(), "%s last kernel called was (name=%s,volume=%s,aux=%s)\n", \
126 getOutputPrefix(), getLastTuneKey().name, \
127 getLastTuneKey().volume, getLastTuneKey().aux); \
128 quda::saveTuneCache(true); \
132 #define warningQuda(...) do { \
133 if (getVerbosity() > QUDA_SILENT) { \
134 fprintf(getOutputFile(), "%sWARNING: ", getOutputPrefix()); \
135 fprintf(getOutputFile(), __VA_ARGS__); \
136 fprintf(getOutputFile(), "\n"); \
137 fflush(getOutputFile()); \
143 #define checkCudaErrorNoSync() \
145 cudaError_t error = cudaGetLastError(); \
146 if (error != cudaSuccess) errorQuda("(CUDA) %s", cudaGetErrorString(error)); \
151 #define checkCudaError() do { \
152 cudaDeviceSynchronize(); \
153 checkCudaErrorNoSync(); \
158 #define checkCudaError() checkCudaErrorNoSync()
165 #define errorQuda(...)
enum QudaVerbosity_s QudaVerbosity
void saveTuneCache(bool error=false)
void pushVerbosity(QudaVerbosity verbosity)
Push a new verbosity onto the stack.
QudaTune getTuning()
Query whether autotuning is enabled or not. Default is enabled but can be overridden by setting QUDA_...
void popOutputPrefix()
Pop the output prefix restoring the prior one on the stack.
void popVerbosity()
Pop the verbosity restoring the prior one on the stack.
char * getOmpThreadStr()
Returns a string of the form ",omp_threads=$OMP_NUM_THREADS", which can be used for storing the numbe...
bool getRankVerbosity()
This function returns true if the calling rank is enabled for verbosity (e.g., whether printQuda and ...
void pushOutputPrefix(const char *prefix)
Push a new output prefix onto the stack.
QudaVerbosity getVerbosity()
void setVerbosity(QudaVerbosity verbosity)
void setOutputPrefix(const char *prefix)
void setOutputFile(FILE *outfile)