Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pyspark] support gpu transform #9542

Merged
merged 4 commits into from
Sep 7, 2023
Merged

Conversation

wbo4958
Copy link
Contributor

@wbo4958 wbo4958 commented Sep 4, 2023

PR to support gpu transform. @WeichenXu123 @trivialfis Please help to review this PR. Thx

@wbo4958 wbo4958 marked this pull request as ready for review September 5, 2023 03:53
Comment on lines +95 to +100
try:
import cupy

return True
except ImportError:
return False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test for cuDF availability originally had the comment:

    # Checking by `importing` instead of check `importlib.util.find_spec("cudf") is not None`
WeichenXu123 marked this conversation as resolved.
    # because user might install cudf successfully but importing cudf raises issues (e.g. saying
    # running on mismatched cuda version)

which to me was weird, that's a mismanaged environment and I'm not sure it's necessary for xgboost to work around it (or even a good idea to workaround anything since users with cuDF installed might expect GPU to be used).

Comment on lines 245 to 250
def set_device(self, value: str) -> "_SparkXGBParams":
"""Set device (cpu, cuda, gpu)"""
assert value in ("cpu", "cuda", "gpu")
self.set(self.device, value)
return self

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a check here:

def _check_distributed_params(kwargs: Dict[str, Any]) -> None:
.
StringView msg{R"(Invalid argument for `device`. Expected to be one of the following:
Not sure if it's a good idea to override existing checks, which creates new error messages. In this case, an assertion error with no error message.

Copy link
Contributor Author

@wbo4958 wbo4958 Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems _check_distributed_params just checks the type of the value, it seems we also need to restrict it to be one of (CPU ,GPU, cuda)

python-package/xgboost/spark/core.py Show resolved Hide resolved
python-package/xgboost/spark/core.py Show resolved Hide resolved
python-package/xgboost/spark/core.py Show resolved Hide resolved
python-package/xgboost/spark/core.py Outdated Show resolved Hide resolved
python-package/xgboost/spark/core.py Outdated Show resolved Hide resolved
@trivialfis trivialfis merged commit 6c791b5 into dmlc:master Sep 7, 2023
25 checks passed
trivialfis added a commit to trivialfis/xgboost that referenced this pull request Sep 7, 2023
trivialfis added a commit that referenced this pull request Sep 7, 2023
@wbo4958 wbo4958 deleted the gpu-transform branch April 23, 2024 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants