-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Distributed initialization process for single process
- Loading branch information
1 parent
c5b4d58
commit 5485a79
Showing
2 changed files
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
tests/pytorch_pfn_extras_tests/distributed_tests/test_initialize.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import torch.distributed | ||
from pytorch_pfn_extras.distributed import initialize_ompi_environment | ||
|
||
|
||
def test_initialize_ompi_environment_with_single_process(): | ||
assert not torch.distributed.is_initialized() | ||
world_size, rank, local_rank = initialize_ompi_environment( | ||
backend="gloo", init_method="tcp" | ||
) | ||
assert torch.distributed.is_initialized() | ||
torch.distributed.destroy_process_group() | ||
assert not torch.distributed.is_initialized() |