#ifdef _WIN32
#include <windows.h>
#endif
#include <climits>
#include <cstdlib>
#include <cstring>
#include "graph/utils/utils.hpp"
namespace dnnl {
namespace impl {
namespace graph {
namespace utils {
int getenv_int_internal(const char *name, int default_value) {
int value = default_value;
const int len = 12;
char value_str[len]; for (const auto &prefix : {"_ONEDNN_", "_DNNL_"}) {
std::string name_str = std::string(prefix) + std::string(name);
if (getenv(name_str.c_str(), value_str, len) > 0) {
value = std::atoi(value_str);
break;
}
}
return value;
}
bool check_verbose_string_user(const char *name, const char *expected) {
std::string value;
const int len = 64;
char value_str[len]; for (const auto &prefix : {"ONEDNN_", "DNNL_"}) {
std::string name_str = std::string(prefix) + std::string(name);
if (getenv(name_str.c_str(), value_str, len) > 0) {
value = value_str;
break;
}
}
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
std::vector<std::string> splits;
std::string split;
istringstream_t ss(value);
while (std::getline(ss, split, ',')) {
splits.push_back(split);
}
return std::find(splits.begin(), splits.end(), std::string(expected))
!= splits.end();
}
} } } }