Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions python-package/xgboost/spark/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
"qid_col",
"repartition_random_shuffle",
"pred_contrib_col",
"use_gpu",
"launch_tracker_on_driver",
"coll_cfg",
]
Expand Down Expand Up @@ -218,16 +217,6 @@ class _SparkXGBParams(
),
TypeConverters.toString,
)
use_gpu = Param(
Params._dummy(),
"use_gpu",
(
"Deprecated, use `device` instead. A boolean variable. Set use_gpu=true "
"if the executors are running on GPU instances. Currently, only one GPU per"
" task is supported."
),
TypeConverters.toBoolean,
)
force_repartition = Param(
Params._dummy(),
"force_repartition",
Expand Down Expand Up @@ -503,9 +492,7 @@ def _validate_params(self) -> None:
def _run_on_gpu(self) -> bool:
"""If train or transform on the gpu according to the parameters"""

return use_cuda(self.getOrDefault(self.device)) or self.getOrDefault(
self.use_gpu
)
return use_cuda(self.getOrDefault(self.device))

def _col_is_defined_not_empty(self, param: "Param[str]") -> bool:
return self.isDefined(param) and self.getOrDefault(param) not in (None, "")
Expand Down Expand Up @@ -628,7 +615,6 @@ def __init__(self) -> None:
self._setDefault(
num_workers=1,
device="cpu",
use_gpu=False,
force_repartition=False,
repartition_random_shuffle=False,
feature_names=None,
Expand Down
33 changes: 1 addition & 32 deletions python-package/xgboost/spark/estimator.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""Xgboost pyspark integration submodule for estimator API."""

# pylint: disable=fixme, protected-access, no-member, invalid-name
# pylint: disable=protected-access, no-member, invalid-name
# pylint: disable=unused-argument, too-many-locals

import warnings
from typing import Any, List, Optional, Type, Union

import numpy as np
Expand Down Expand Up @@ -77,12 +76,6 @@ def set_param_attrs(attr_name: str, param: Param) -> None:
set_param_attrs(name, param_obj)


def _deprecated_use_gpu() -> None:
warnings.warn(
"`use_gpu` is deprecated since 2.0.0, use `device` instead", FutureWarning
)


class SparkXGBRegressor(_SparkXGBEstimator):
"""SparkXGBRegressor is a PySpark ML estimator. It implements the XGBoost regression
algorithm based on XGBoost python library, and it can be used in PySpark Pipeline
Expand Down Expand Up @@ -140,11 +133,6 @@ class SparkXGBRegressor(_SparkXGBEstimator):
num_workers:
How many XGBoost workers to be used to train.
Each XGBoost worker corresponds to one spark task.
use_gpu:
.. deprecated:: 2.0.0

Use `device` instead.

device:

.. versionadded:: 2.0.0
Expand Down Expand Up @@ -214,7 +202,6 @@ def __init__( # pylint:disable=too-many-arguments
weight_col: Optional[str] = None,
base_margin_col: Optional[str] = None,
num_workers: int = 1,
use_gpu: Optional[bool] = None,
device: Optional[str] = None,
force_repartition: bool = False,
repartition_random_shuffle: bool = False,
Expand All @@ -225,8 +212,6 @@ def __init__( # pylint:disable=too-many-arguments
) -> None:
super().__init__()
input_kwargs = self._input_kwargs
if use_gpu:
_deprecated_use_gpu()
self.setParams(**input_kwargs)

@classmethod
Expand Down Expand Up @@ -327,11 +312,6 @@ class SparkXGBClassifier(_SparkXGBEstimator, HasProbabilityCol, HasRawPrediction
num_workers:
How many XGBoost workers to be used to train.
Each XGBoost worker corresponds to one spark task.
use_gpu:
.. deprecated:: 2.0.0

Use `device` instead.

device:

.. versionadded:: 2.0.0
Expand Down Expand Up @@ -401,7 +381,6 @@ def __init__( # pylint:disable=too-many-arguments
weight_col: Optional[str] = None,
base_margin_col: Optional[str] = None,
num_workers: int = 1,
use_gpu: Optional[bool] = None,
device: Optional[str] = None,
force_repartition: bool = False,
repartition_random_shuffle: bool = False,
Expand All @@ -416,8 +395,6 @@ def __init__( # pylint:disable=too-many-arguments
# binary or multinomial input dataset, and we need to remove the fixed default
# param value as well to avoid causing ambiguity.
input_kwargs = self._input_kwargs
if use_gpu:
_deprecated_use_gpu()
self.setParams(**input_kwargs)
self._setDefault(objective=None)

Expand Down Expand Up @@ -517,11 +494,6 @@ class SparkXGBRanker(_SparkXGBEstimator):
num_workers:
How many XGBoost workers to be used to train.
Each XGBoost worker corresponds to one spark task.
use_gpu:
.. deprecated:: 2.0.0

Use `device` instead.

device:

.. versionadded:: 2.0.0
Expand Down Expand Up @@ -597,7 +569,6 @@ def __init__( # pylint:disable=too-many-arguments
base_margin_col: Optional[str] = None,
qid_col: Optional[str] = None,
num_workers: int = 1,
use_gpu: Optional[bool] = None,
device: Optional[str] = None,
force_repartition: bool = False,
repartition_random_shuffle: bool = False,
Expand All @@ -608,8 +579,6 @@ def __init__( # pylint:disable=too-many-arguments
) -> None:
super().__init__()
input_kwargs = self._input_kwargs
if use_gpu:
_deprecated_use_gpu()
self.setParams(**input_kwargs)

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion python-package/xgboost/spark/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class HasBaseMarginCol(Params):
class HasFeaturesCols(Params):
"""
Mixin for param features_cols: a list of feature column names.
This parameter is taken effect only when use_gpu is enabled.
This parameter is taken effect only when GPU is enabled.
"""

features_cols = Param(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def test_cv_sparkxgb_classifier_feature_cols_with_gpu(spark_iris_dataset_feature
assert f1 >= 0.97

clf = SparkXGBClassifier(
features_col=feature_names, use_gpu=True, num_workers=num_workers
features_col=feature_names, device="cuda", num_workers=num_workers
)
grid = ParamGridBuilder().addGrid(clf.max_depth, [6, 8]).build()
evaluator = MulticlassClassificationEvaluator(metricName="f1")
Expand Down
11 changes: 4 additions & 7 deletions tests/test_distributed/test_with_spark/test_spark_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,9 +944,6 @@ def test_gpu_params(self) -> None:
clf = SparkXGBClassifier(tree_method="hist")
assert not clf._run_on_gpu()

clf = SparkXGBClassifier(use_gpu=True)
assert clf._run_on_gpu()

clf = SparkXGBClassifier(device="cuda", tree_method="approx")
assert clf._run_on_gpu()

Expand Down Expand Up @@ -988,8 +985,8 @@ def test_validate_gpu_params(self) -> None:
.set("spark.executor.resource.gpu.amount", "1")
.set("spark.task.resource.gpu.amount", "0.08")
)
classifer_on_cpu = SparkXGBClassifier(use_gpu=False)
classifer_on_gpu = SparkXGBClassifier(use_gpu=True)
classifer_on_cpu = SparkXGBClassifier(device="cpu")
classifer_on_gpu = SparkXGBClassifier(device="cuda")

# No exception for classifier on CPU
classifer_on_cpu._validate_gpu_params("3.4.0", standalone_conf)
Expand Down Expand Up @@ -1107,8 +1104,8 @@ def test_skip_stage_level_scheduling(self) -> None:
.set("spark.task.resource.gpu.amount", "0.08")
)

classifer_on_cpu = SparkXGBClassifier(use_gpu=False)
classifer_on_gpu = SparkXGBClassifier(use_gpu=True)
classifer_on_cpu = SparkXGBClassifier(device="cpu")
classifer_on_gpu = SparkXGBClassifier(device="cuda")

# the correct configurations should not skip stage-level scheduling
assert not classifer_on_gpu._skip_stage_level_scheduling(
Expand Down
Loading