Skip to content

Commit 5ff47c1

Browse files
authored
Remove the deprecated gpu_hist. (#11549)
1 parent 9ffb6ff commit 5ff47c1

File tree

17 files changed

+58
-136
lines changed

17 files changed

+58
-136
lines changed

include/xgboost/context.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,6 @@ struct Context : public XGBoostParameter<Context> {
162162
bool fail_on_invalid_gpu_id{false};
163163
bool validate_parameters{false};
164164

165-
/**
166-
* @brief Configure the parameter `device'. Deprecated, will remove once `gpu_id` is
167-
* removed.
168-
*
169-
* @param require_gpu Whether GPU is explicitly required by the user through other
170-
* configurations.
171-
*/
172-
void ConfigureGpuId(bool require_gpu);
173165
/**
174166
* @brief Returns the automatically chosen number of threads based on the `nthread`
175167
* parameter and the system settting.

include/xgboost/gbm.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ class GradientBooster : public Model, public Configurable {
158158
common::Span<int32_t const> trees,
159159
std::vector<bst_feature_t>* features,
160160
std::vector<float>* scores) const = 0;
161-
/**
162-
* @brief Whether the current booster uses GPU.
163-
*/
164-
[[nodiscard]] virtual bool UseGPU() const = 0;
165161
/*!
166162
* \brief create a gradient booster from given name
167163
* \param name name of gradient booster

jvm-packages/xgboost4j-spark-gpu/src/main/scala/ml/dmlc/xgboost4j/scala/spark/GpuXGBoostPlugin.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class GpuXGBoostPlugin extends XGBoostPlugin {
102102
private[spark] def validate[T <: XGBoostEstimator[T, M], M <: XGBoostModel[M]](
103103
estimator: XGBoostEstimator[T, M],
104104
dataset: Dataset[_]): Unit = {
105-
require(estimator.getTreeMethod == "gpu_hist" || estimator.getDevice != "cpu",
105+
require(estimator.getDevice != "cpu",
106106
"Using Spark-Rapids to accelerate XGBoost must set device=cuda")
107107
}
108108

jvm-packages/xgboost4j-spark-gpu/src/test/scala/ml/dmlc/xgboost4j/scala/spark/GpuXGBoostPluginSuite.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ class GpuXGBoostPluginSuite extends GpuTestSuite {
129129

130130
classifier.setDevice("gpu")
131131
plugin.validate(classifier, df)
132-
133-
classifier.setDevice("cpu")
134-
classifier.setTreeMethod("gpu_hist")
135-
plugin.validate(classifier, df)
136132
}
137133
}
138134

jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostEstimator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ private[spark] trait XGBoostEstimator[
374374

375375
private[spark] def getRuntimeParameters(isLocal: Boolean,
376376
configs: Map[String, AnyRef] = Map.empty): RuntimeParams = {
377-
val runOnGpu = if (getDevice != "cpu" || getTreeMethod == "gpu_hist") true else false
377+
val runOnGpu = if (getDevice != "cpu") true else false
378378
RuntimeParams(
379379
getNumWorkers,
380380
getNumRound,

jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/params/TreeBoosterParams.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private[spark] trait TreeBoosterParams extends Params {
231231

232232
private[spark] object BoosterParams {
233233

234-
val supportedTreeMethods = HashSet("auto", "exact", "approx", "hist", "gpu_hist")
234+
val supportedTreeMethods = HashSet("auto", "exact", "approx", "hist")
235235

236236
val supportedUpdaters = HashSet("grow_colmaker", "grow_histmaker", "grow_quantile_histmaker",
237237
"grow_gpu_hist", "grow_gpu_approx", "sync", "refresh", "prune")

jvm-packages/xgboost4j-spark/src/test/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostEstimatorSuite.scala

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,6 @@ class XGBoostEstimatorSuite extends AnyFunSuite with PerTest with TmpFolderPerSu
133133
Map("device" -> "cuda")).setNumWorkers(1).setNumRound(1)
134134
.getRuntimeParameters(true)
135135
assert(runtimeParams.runOnGpu)
136-
137-
runtimeParams = new XGBoostClassifier(
138-
Map("device" -> "cpu", "tree_method" -> "gpu_hist")).setNumWorkers(1).setNumRound(1)
139-
.getRuntimeParameters(true)
140-
assert(runtimeParams.runOnGpu)
141-
142-
runtimeParams = new XGBoostClassifier(
143-
Map("device" -> "cuda", "tree_method" -> "gpu_hist")).setNumWorkers(1).setNumRound(1)
144-
.getRuntimeParameters(true)
145-
assert(runtimeParams.runOnGpu)
146136
}
147137

148138
test("missing value exception for sparse vector") {

python-package/xgboost/sklearn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def _check_rf_callback(
8585

8686
def _can_use_qdm(tree_method: Optional[str], device: Optional[str]) -> bool:
8787
not_sycl = (device is None) or (not device.startswith("sycl"))
88-
return tree_method in ("hist", "gpu_hist", None, "auto") and not_sycl
88+
return tree_method in ("hist", None, "auto") and not_sycl
8989

9090

9191
class _SklObjWProto(Protocol):

python-package/xgboost/spark/core.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,8 @@ def _validate_params(self) -> None:
503503
def _run_on_gpu(self) -> bool:
504504
"""If train or transform on the gpu according to the parameters"""
505505

506-
return (
507-
use_cuda(self.getOrDefault(self.device))
508-
or self.getOrDefault(self.use_gpu)
509-
or self.getOrDefault(self.getParam("tree_method")) == "gpu_hist"
506+
return use_cuda(self.getOrDefault(self.device)) or self.getOrDefault(
507+
self.use_gpu
510508
)
511509

512510
def _col_is_defined_not_empty(self, param: "Param[str]") -> bool:

src/context.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,6 @@ void Context::Init(Args const& kwargs) {
234234
}
235235
}
236236

237-
void Context::ConfigureGpuId(bool require_gpu) {
238-
if (this->IsCPU() && require_gpu) {
239-
this->UpdateAllowUnknown(Args{{kDevice, DeviceSym::CUDA()}});
240-
}
241-
}
242-
243237
void Context::SetDeviceOrdinal(Args const& kwargs) {
244238
auto gpu_id_it = std::find_if(kwargs.cbegin(), kwargs.cend(),
245239
[](auto const& p) { return p.first == "gpu_id"; });

0 commit comments

Comments
 (0)