Files
rocm-systems/src/include/debug.h
T

44 líneas
1.3 KiB
C++
Original Vista normal Histórico

2018-09-24 16:06:59 -07:00
/*************************************************************************
2019-03-14 19:39:20 -07:00
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
2018-09-24 16:06:59 -07:00
*
* See LICENSE.txt for license information
************************************************************************/
#ifndef NCCL_DEBUG_H_
#define NCCL_DEBUG_H_
2019-11-19 14:57:39 -08:00
#include "core.h"
2018-09-24 16:06:59 -07:00
#include <stdio.h>
#include <chrono>
#include <sys/syscall.h>
#include <limits.h>
#include <string.h>
2018-11-13 10:37:20 -08:00
#include "nccl_net.h"
2018-09-24 16:06:59 -07:00
#define gettid() (pid_t) syscall(SYS_gettid)
2018-11-13 10:37:20 -08:00
extern int ncclDebugLevel;
2018-09-24 16:06:59 -07:00
extern uint64_t ncclDebugMask;
extern pthread_mutex_t ncclDebugOutputLock;
extern FILE *ncclDebugFile;
2019-03-14 19:39:20 -07:00
extern ncclResult_t getHostName(char* hostname, int maxlen, const char delim);
2018-09-24 16:06:59 -07:00
2019-11-19 14:57:39 -08:00
void ncclDebugLog(ncclDebugLogLevel level, unsigned long flags, const char *filefunc, int line, const char *fmt, ...);
// Let code temporarily downgrade WARN into INFO
extern thread_local int ncclDebugNoWarn;
2018-09-24 16:06:59 -07:00
2018-11-13 10:37:20 -08:00
#define WARN(...) ncclDebugLog(NCCL_LOG_WARN, NCCL_ALL, __FILE__, __LINE__, __VA_ARGS__)
#define INFO(FLAGS, ...) ncclDebugLog(NCCL_LOG_INFO, (FLAGS), __func__, __LINE__, __VA_ARGS__)
2018-09-24 16:06:59 -07:00
#ifdef ENABLE_TRACE
2018-11-13 10:37:20 -08:00
#define TRACE(FLAGS, ...) ncclDebugLog(NCCL_LOG_TRACE, (FLAGS), __func__, __LINE__, __VA_ARGS__)
2018-09-24 16:06:59 -07:00
extern std::chrono::high_resolution_clock::time_point ncclEpoch;
#else
#define TRACE(...)
#endif
#endif