Unify logging facilities. (#3982)

* Unify logging facilities.

* Enhance `ConsoleLogger` to handle different verbosity.
* Override macros from `dmlc`.
* Don't use specialized gamma when building with GPU.
* Remove verbosity cache in monitor.
* Test monitor.
* Deprecate `silent`.
* Fix doc and messages.
* Fix python test.
* Fix silent tests.
This commit is contained in:
Jiaming Yuan
2018-12-14 19:29:58 +08:00
committed by GitHub
parent fd722d60cd
commit e0a279114e
28 changed files with 368 additions and 171 deletions

View File

@@ -116,7 +116,6 @@ inline static bool CmpSecond(const std::pair<float, unsigned> &a,
#if XGBOOST_STRICT_R_MODE
// check nan
bool CheckNAN(double v);
double LogGamma(double v);
#else
template<typename T>
inline bool CheckNAN(T v) {
@@ -126,9 +125,19 @@ inline bool CheckNAN(T v) {
return std::isnan(v);
#endif
}
#endif // XGBOOST_STRICT_R_MODE_
// GPU version is not uploaded in CRAN anyway.
// Specialize only when using R with CPU.
#if XGBOOST_STRICT_R_MODE && !defined(XGBOOST_USE_CUDA)
double LogGamma(double v);
#else // Not R or R with GPU.
template<typename T>
XGBOOST_DEVICE inline T LogGamma(T v) {
#ifdef _MSC_VER
#if _MSC_VER >= 1800
return lgamma(v);
#else
@@ -136,12 +145,15 @@ XGBOOST_DEVICE inline T LogGamma(T v) {
", poisson regression will be disabled")
utils::Error("lgamma function was not available until VS2013");
return static_cast<T>(1.0);
#endif
#endif // _MSC_VER >= 1800
#else
return lgamma(v);
#endif
}
#endif // XGBOOST_STRICT_R_MODE_
#endif // XGBOOST_STRICT_R_MODE && !defined(XGBOOST_USE_CUDA)
} // namespace common
} // namespace xgboost
#endif // XGBOOST_COMMON_MATH_H_