-
Notifications
You must be signed in to change notification settings - Fork 563
[Bug] constraints.Interval is overzealous in forcing GPU synchronizes #2258
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
Labels
Comments
Thanks for flagging this. I do think that the right place for this is |
actually should just be able to gate this by the class instance |
Balandat
added a commit
that referenced
this issue
Jan 21, 2023
Addresses #2258, avoids repeatedly checking the same condition in each forward pass. Avoids forcing GPU synchronization.
gpleiss
pushed a commit
that referenced
this issue
Jan 30, 2023
* Move infinite interval bounds check into Internval constructor Addresses #2258, avoids repeatedly checking the same condition in each forward pass. Avoids forcing GPU synchronization. * Remove second obsolete check in forward, some type annotations.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐛 Bug
By default, if any model parameters use a
constraints.Interval
, fetching these parameters forces a GPU synchronize on every forward pass, due to this line:gpytorch/gpytorch/constraints/constraints.py
Line 118 in 2e1ccec
True, this code can be disabled by calling
gpytorch.settings.debug._set_state(False)
, but even with debug enabled this check ought to only happen once, not on everytransform
.To reproduce
Expected Behavior
This sync should happen at most once, since
lower_bound
andupper_bound
are constant.self
to denote whether the check has occurred, and only perform the check on the first call totransform
oruntransform
__init__
(but this would require some refactoring)System information
gpytorch: 1.9.1
torch: 1.13.1+cu116
Linux
The text was updated successfully, but these errors were encountered: