31 static bool init =
false;
32 static bool rank_verbosity =
false;
33 static char *rank_verbosity_env = getenv(
"QUDA_RANK_VERBOSITY");
35 if (!init && rank_verbosity_env) {
36 std::stringstream rank_list(rank_verbosity_env);
39 while (rank_list >> rank_) {
40 if (
comm_rank() == rank_ || rank_ == -1) rank_verbosity =
true;
41 if (rank_list.peek() ==
',') rank_list.ignore();
44 rank_verbosity =
comm_rank() == 0 ? true :
false;
48 return rank_verbosity;
53 static bool init =
false;
57 char *enable_tuning = getenv(
"QUDA_ENABLE_TUNING");
58 if (!enable_tuning || strcmp(enable_tuning,
"0")!=0) {
81 static std::stack<QudaVerbosity>
vstack;
88 if (vstack.size() > 10) {
89 warningQuda(
"Verbosity stack contains %u elements. Is there a missing popVerbosity() somewhere?",
90 static_cast<unsigned int>(vstack.size()));
97 errorQuda(
"popVerbosity() called with empty stack");
110 pstack.push(prefix_backup);
115 if (pstack.size() > 10) {
116 warningQuda(
"Verbosity stack contains %u elements. Is there a missing popOutputPrefix() somewhere?",
117 static_cast<unsigned int>(vstack.size()));
123 if (pstack.empty()) {
errorQuda(
"popOutputPrefix() called with empty stack"); }
126 char *prefix_restore = pstack.top();
135 static char omp_thread_string[128];
136 static bool init =
false;
138 strcpy(omp_thread_string,
",omp_threads=");
139 char *omp_threads = getenv(
"OMP_NUM_THREADS");
140 strcat(omp_thread_string, omp_threads ? omp_threads :
"1");
143 return omp_thread_string;
void setOutputFile(FILE *outfile)
QudaTune getTuning()
Query whether autotuning is enabled or not. Default is enabled but can be overridden by setting QUDA_...
void pushVerbosity(QudaVerbosity verbosity)
Push a new verbosity onto the stack.
void setOutputPrefix(const char *prefix)
static char prefix_[MAX_PREFIX_SIZE]
void pushOutputPrefix(const char *prefix)
Push a new output prefix onto the stack.
static std::stack< QudaVerbosity > vstack
static const int MAX_BUFFER_SIZE
char * getOmpThreadStr()
Returns a string of the form ",omp_threads=$OMP_NUM_THREADS", which can be used for storing the numbe...
void popVerbosity()
Pop the verbosity restoring the prior one on the stack.
void init()
Create the CUBLAS context.
void popOutputPrefix()
Pop the output prefix restoring the prior one on the stack.
#define safe_malloc(size)
void setVerbosity(QudaVerbosity verbosity)
static QudaVerbosity verbosity_
QudaVerbosity getVerbosity()
enum QudaVerbosity_s QudaVerbosity
static char buffer_[MAX_BUFFER_SIZE]
bool getRankVerbosity()
This function returns true if the calling rank is enabled for verbosity (e.g., whether printQuda and ...
static std::stack< char * > pstack
static const size_t MAX_PREFIX_SIZE