Skip to content
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

Raise exceptions when torch distributed is not available #10418

Merged
merged 3 commits into from
Nov 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pytorch_lightning/utilities/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,9 @@ def init_dist_connection(
world_size = world_size if world_size is not None else cluster_environment.world_size()
os.environ["MASTER_ADDR"] = cluster_environment.main_address
os.environ["MASTER_PORT"] = str(cluster_environment.main_port)
if torch.distributed.is_available() and not torch.distributed.is_initialized():
if not torch.distributed.is_available():
raise RuntimeError("Torch distributed is not avalible, can not initialized distributed process group")
kaushikb11 marked this conversation as resolved.
Show resolved Hide resolved
if not torch.distributed.is_initialized():
log.info(f"initializing distributed: GLOBAL_RANK: {global_rank}, MEMBER: {global_rank + 1}/{world_size}")
torch.distributed.init_process_group(
torch_distributed_backend, rank=global_rank, world_size=world_size, **kwargs
Expand Down