Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building cuda version of k2 on Windows #1257

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions k2/csrc/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,21 @@ enum class LogLevel {
// K2_LOG(TRACE) << "some message";
// K2_LOG(DEBUG) << "some message";
//
#ifndef _MSC_VER
constexpr LogLevel TRACE = LogLevel::kTrace;
constexpr LogLevel DEBUG = LogLevel::kDebug;
constexpr LogLevel INFO = LogLevel::kInfo;
constexpr LogLevel WARNING = LogLevel::kWarning;
constexpr LogLevel ERROR = LogLevel::kError;
constexpr LogLevel FATAL = LogLevel::kFatal;
#else
#define TRACE LogLevel::kTrace
#define DEBUG LogLevel::kDebug
#define INFO LogLevel::kInfo
#define WARNING LogLevel::kWarning
#define ERROR LogLevel::kError
#define FATAL LogLevel::kFatal
#endif

std::string GetStackTrace();

Expand All @@ -110,9 +119,8 @@ K2_CUDA_HOSTDEV LogLevel GetCurrentLogLevel();
inline bool EnableAbort() {
static std::once_flag init_flag;
static bool enable_abort = false;
std::call_once(init_flag, []() {
enable_abort = (std::getenv("K2_ABORT") != nullptr);
});
std::call_once(init_flag,
[]() { enable_abort = (std::getenv("K2_ABORT") != nullptr); });
return enable_abort;
}

Expand Down Expand Up @@ -274,7 +282,7 @@ class Logger {

class Voidifier {
public:
K2_CUDA_HOSTDEV void operator&(const Logger &)const {}
K2_CUDA_HOSTDEV void operator&(const Logger &) const {}
};

inline bool EnableCudaDeviceSync() {
Expand Down
Loading