Skip to content

Commit 1a0ad29

Browse files
committed
tests.
1 parent b45fd9e commit 1a0ad29

File tree

8 files changed

+11
-26
lines changed

8 files changed

+11
-26
lines changed

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/spark/core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ def _run_on_gpu(self) -> bool:
506506
return (
507507
use_cuda(self.getOrDefault(self.device))
508508
or self.getOrDefault(self.use_gpu)
509-
or self.getOrDefault(self.getParam("tree_method")) == "gpu_hist"
510509
)
511510

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

tests/cpp/gbm/test_gbtree.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@ TEST(GBTree, ChooseTreeMethod) {
245245
{{"hist", "cuda"}, "grow_gpu_hist"},
246246
{{"hist", "cuda:0"}, "grow_gpu_hist"},
247247
{{"hist", std::nullopt}, "grow_quantile_histmaker"},
248-
// gpu_hist
249-
{{"gpu_hist", "cpu"}, "grow_gpu_hist"},
250-
{{"gpu_hist", "cuda"}, "grow_gpu_hist"},
251-
{{"gpu_hist", "cuda:0"}, "grow_gpu_hist"},
252-
{{"gpu_hist", std::nullopt}, "grow_gpu_hist"},
248+
// approx
249+
{{"approx", "cpu"}, "grow_gpu_approx"},
250+
{{"approx", "cuda"}, "grow_gpu_approx"},
251+
{{"approx", "cuda:0"}, "grow_gpu_approx"},
252+
{{"approx", std::nullopt}, "grow_gpu_approx"},
253253
// exact
254254
{{"exact", "cpu"}, "grow_colmaker,prune"},
255255
{{"exact", "cuda"}, "err"},

tests/test_distributed/test_with_spark/test_spark_local.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,12 +921,12 @@ def test_device_param(self, reg_data: RegData, clf_data: ClfData) -> None:
921921
with pytest.raises(ValueError, match="not supported for distributed"):
922922
regressor.fit(reg_data.reg_df_train)
923923

924-
reg = SparkXGBRegressor(device="cuda", tree_method="gpu_hist")
924+
reg = SparkXGBRegressor(device="cuda", tree_method="hist")
925925
reg._validate_params()
926926
reg = SparkXGBRegressor(device="cuda")
927927
reg._validate_params()
928928

929-
clf = SparkXGBClassifier(device="cuda", tree_method="gpu_hist")
929+
clf = SparkXGBClassifier(device="cuda", tree_method="hist")
930930
clf._validate_params()
931931
clf = SparkXGBClassifier(device="cuda")
932932
clf._validate_params()
@@ -941,7 +941,7 @@ def test_gpu_params(self) -> None:
941941
clf = SparkXGBClassifier(device="cuda")
942942
assert clf._run_on_gpu()
943943

944-
clf = SparkXGBClassifier(tree_method="gpu_hist")
944+
clf = SparkXGBClassifier(tree_method="hist")
945945
assert clf._run_on_gpu()
946946

947947
clf = SparkXGBClassifier(use_gpu=True)

0 commit comments

Comments
 (0)