-
Notifications
You must be signed in to change notification settings - Fork 533
Add ut for test_communicator.py #1897
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
Add ut for test_communicator.py #1897
Conversation
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
|
test_communicator.py is assigned to me by @FieeFlip. |
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
|
@MengqingCao @Yikun help me to review my UT code |
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
| rank=rank, | ||
| timeout=timedelta(seconds=30)) | ||
|
|
||
| torch.npu.set_device(rank) |
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.
ut rans on CPU machine. I think this doesn't work. You can use mock for npu action.
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.
The NPU actions have been mocked.
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1897 +/- ##
===========================================
+ Coverage 60.17% 76.91% +16.74%
===========================================
Files 71 115 +44
Lines 7989 13079 +5090
===========================================
+ Hits 4807 10060 +5253
+ Misses 3182 3019 -163
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| return decorator | ||
|
|
||
|
|
||
| def test_all_to_all_with_sizes(): |
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.
move all test func to Test class. Thanks.
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.
The tests have been modified to be wrapped in a Test class
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
| @patch("torch.distributed.is_initialized", return_value=True) | ||
| @patch("torch.distributed.get_rank", return_value=1) | ||
| @patch("torch.distributed.is_initialized", return_value=True) | ||
| @patch("torch.distributed.get_backend", return_value="nccl") |
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.
| @patch("torch.distributed.get_backend", return_value="nccl") | |
| @patch("torch.distributed.get_backend", return_value="hccl") |
| @patch("torch.distributed.is_initialized", return_value=True) | ||
| @patch("torch.distributed.get_rank", return_value=1) | ||
| @patch("torch.distributed.is_initialized", return_value=True) | ||
| @patch("torch.distributed.get_backend", return_value="nccl") |
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.
| @patch("torch.distributed.get_backend", return_value="nccl") | |
| @patch("torch.distributed.get_backend", return_value="hccl") |
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.
Okay, that's changed
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
Signed-off-by: yangqinghao-cmss <yangqinghao_yewu@cmss.chinamobile.com>
|
I have added unit tests for the dispatch and combine functions. @MengqingCao @wangxiyuan |
What this PR does / why we need it?
Add ut for test_communicator.py
Does this PR introduce any user-facing change?
How was this patch tested?
pytest test_communicator.py