Skip to content

Commit 774abb0

Browse files
fduwjjpytorchmergebot
authored andcommitted
[ptd] Fix test config in destroy_pg (pytorch#166463)
Summary: When device_type is CPU we will not use device id from CUDA which is enabled in pytorch#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: pytorch#166463 Approved by: https://github.com/mori360, https://github.com/fegin
1 parent 0e19561 commit 774abb0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torch/testing/_internal/distributed/_tensor/common_dtensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ def destroy_pg(self, device_id: Optional[int] = None) -> None:
447447
torch.cuda.current_device() if self.device_type == "cuda" else self.rank
448448
)
449449

450-
if self.device_type == "cpu" and torch._C._get_accelerator().type != "cpu":
450+
if self.device_type == "cpu":
451451
# NOTE: when `device_id` is not None, barrier() will choose the accelerator
452452
# of the most pripority, which means if the test specifies to use CPU for
453453
# testing while CUDA is available on the host, the barrier() will use CUDA.

0 commit comments

Comments
 (0)