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

[BREAKING] Cleanup gpu_id configuration. #6971

Closed
wants to merge 17 commits into from

Conversation

trivialfis
Copy link
Member

@trivialfis trivialfis commented May 19, 2021

Recently found a bug that was introduced in updating the prediction cache for gpu_hist. When a custom objective is used, the gradient is on CPU. This PR fixes it by prioritizing the gpu_id parameter.

Other than the bug fix, this PR also tries to cleanup and clarify the configuration of this parameter. Please see the note in gbtree.cc for details.

Here breaking means, one can no longer run into edge cases like having gpu_id = 0 while running CPU exact. Overall it should not change normal usage.

Todos:

  • Correct linear updaters.
  • Add tests for the state transition.

@hcho3 hcho3 self-requested a review May 21, 2021 02:32
@trivialfis trivialfis changed the title [BREAKING] Set tree method to gpu_hist when gpu_id is set. [BREAKING] Cleanup gpu_id configuration. May 24, 2021
@trivialfis
Copy link
Member Author

@RAMitchell @hcho3 I will probably close this PR and open a different one to simply fix the bug. Getting it to work without some user-visible breaking changes seems impossible. For example:

Setting "gpu_hist" leads to gpu_id >= 0

"gpu_hist" -> gpu_id = 0

then if a user wants to run prediction on the CPU, he will set

booster.set_param({"predictor": "cpu_predictor"})

then xgboost will throw an error as gpu_id is invalid for CPU.

@trivialfis
Copy link
Member Author

I'm picking up this PR again. Will proceed with breaking changes.

@trivialfis trivialfis closed this Jan 4, 2024
@trivialfis trivialfis deleted the fix-gpu-id branch January 4, 2024 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant