Unify the hist tree method for different devices. (#9363)
This commit is contained in:
36
src/common/error_msg.cc
Normal file
36
src/common/error_msg.cc
Normal 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
|
||||
@@ -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_
|
||||
|
||||
Reference in New Issue
Block a user