-
Notifications
You must be signed in to change notification settings - Fork 24.2k
add device generalisation support for distributed tests #152471
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
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/152471
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
b3e51b4
to
c640bda
Compare
@albanD , @wconstab , @EikanWang , @cyyever , @guangyey : Could you help in reviewing and merging this one ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes generally seem fine -- just a few nits
os.remove(self.file_name) | ||
except OSError: | ||
pass | ||
|
||
@property | ||
def world_size(self) -> int: | ||
return torch.cuda.device_count() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need to change as well?
|
||
class TestZeroRedundancyOptimizerSingleRank(TestZeroRedundancyOptimizer): | ||
def test_state_dict(self): | ||
"""Check that ZeroRedundancyOptimizer exposes the expected state dict | ||
interface, irrespective of the sharding.""" | ||
self.dist_init(self.rank) | ||
self.create_pg(self.device) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to pass device here? Seems like we can infer it from the setting on the class since it's on self
@@ -20,6 +19,7 @@ | |||
if not dist.is_available(): | |||
print("Distributed not available, skipping tests", file=sys.stderr) | |||
sys.exit(0) | |||
from torch._inductor.utils import is_gpu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it fine for us to depend on inductor code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is a bit weird.
MOTIVATION
To generalize Distributed test cases for non-CUDA devices
CHANGES
Replaced hard coded device names with get_devtype from torch.testing._internal.common_fsdp.
DistributedTestBase is used instead of MultiProcessTestCase, to make use of helper functions.
extended common utility functions
cc @H-Huang @awgu @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k