mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[ptd] Fix test config in destroy_pg (#166463)
Summary: When device_type is CPU we will not use device id from CUDA which is enabled in https://github.com/pytorch/pytorch/pull/161015. However, we should not exclude the case when the accelerator itself is CPU. This PR fixes it. Test Plan: UT Differential Revision: D85714901 Pull Request resolved: https://github.com/pytorch/pytorch/pull/166463 Approved by: https://github.com/mori360, https://github.com/fegin
This commit is contained in:
parent
0e19561e23
commit
774abb018e
|
|
@ -447,7 +447,7 @@ class DTensorTestBase(MultiProcessTestCase):
|
|||
torch.cuda.current_device() if self.device_type == "cuda" else self.rank
|
||||
)
|
||||
|
||||
if self.device_type == "cpu" and torch._C._get_accelerator().type != "cpu":
|
||||
if self.device_type == "cpu":
|
||||
# NOTE: when `device_id` is not None, barrier() will choose the accelerator
|
||||
# of the most pripority, which means if the test specifies to use CPU for
|
||||
# testing while CUDA is available on the host, the barrier() will use CUDA.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user