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

Use booster context in DMatrix. #8896

Merged
merged 1 commit into from
Apr 28, 2023
Merged

Conversation

trivialfis
Copy link
Member

@trivialfis trivialfis commented Mar 10, 2023

  • Pass context from booster to DMatrix.
  • Use context instead of integer for n_threads.
  • Check the consistency configuration for max_bin.
  • Test for all combinations of initialization options.

The DMatrix object is somewhat lazy as it generates required formats only when it's queried by GetBatches, as a result, we need a context for the operation. Previously, the context created at DMatrix initialization is used, now we use the context from the booster for unifying the behavior.

This has some interesting implications. For instance, when the QuantileDMatrix is initialized on GPU, but a different CPU QDM wants to use it for reference. We don't have any booster for creating context at the point. For now, we will just generate a temporary context.

A different option is a global variable stored in a thread local static variable as we discussed before, but I find it too fragile to be used in distributed environment as we can't serialize global variable to move between threads and processes.

@trivialfis trivialfis force-pushed the booster-ctx branch 3 times, most recently from 53feffc to 4efea19 Compare March 23, 2023 19:35
@trivialfis trivialfis force-pushed the booster-ctx branch 2 times, most recently from 5c3dec2 to 8161c3d Compare April 21, 2023 09:24
@trivialfis trivialfis marked this pull request as ready for review April 21, 2023 19:32
@trivialfis trivialfis changed the title [WIP] Use booster context in DMatrix. Use booster context in DMatrix. Apr 21, 2023
- Pass context from booster to DMatrix.
- Use context instead of integer for `n_threads`.
- Check the consistency configuration for `max_bin`.
- Test for all combinations of initialization options.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants