Unify the hist tree method for different devices. (#9363)

This commit is contained in:
Jiaming Yuan
2023-07-11 10:04:39 +08:00
committed by GitHub
parent 20c52f07d2
commit 97ed944209
8 changed files with 242 additions and 142 deletions

36
src/common/error_msg.cc Normal file
View File

@@ -0,0 +1,36 @@
/**
* Copyright 2023 by XGBoost contributors
*/
#include "error_msg.h"
#include "xgboost/logging.h"
namespace xgboost::error {
void WarnDeprecatedGPUHist() {
bool static thread_local logged{false};
if (logged) {
return;
}
auto msg =
"The tree method `gpu_hist` is deprecated since 2.0.0. To use GPU training, set the `device` "
R"(parameter to CUDA instead.
E.g. tree_method = "hist", device = "CUDA"
)";
LOG(WARNING) << msg;
logged = true;
}
void WarnManualUpdater() {
bool static thread_local logged{false};
if (logged) {
return;
}
LOG(WARNING)
<< "You have manually specified the `updater` parameter. The `tree_method` parameter "
"will be ignored. Incorrect sequence of updaters will produce undefined "
"behavior. For common uses, we recommend using `tree_method` parameter instead.";
logged = true;
}
} // namespace xgboost::error

View File

@@ -75,9 +75,12 @@ inline void WarnOldSerialization() {
if (logged) {
return;
}
LOG(WARNING) << OldSerialization();
logged = true;
}
void WarnDeprecatedGPUHist();
void WarnManualUpdater();
} // namespace xgboost::error
#endif // XGBOOST_COMMON_ERROR_MSG_H_