Skip to content

Commit

Permalink
fix: init_process_group_dummy on non-gpu devices (regression)
Browse files Browse the repository at this point in the history
  • Loading branch information
sehoffmann committed Apr 2, 2024
1 parent b472055 commit 4276453
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dmlcloud/util/distributed.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from contextlib import contextmanager

import torch
import torch.distributed as dist

from .tcp import find_free_port, get_local_ips
Expand Down Expand Up @@ -87,7 +88,7 @@ def init_process_group_dummy(**kwargs):
"""
backend = kwargs.get('backend', None)
if backend is None:
backend = 'cpu:gloo,cuda:nccl' if dist.is_nccl_available() else 'gloo'
backend = 'cpu:gloo,cuda:nccl' if dist.is_nccl_available() and torch.cuda.is_available() else 'gloo'
store = dist.HashStore()
dist.init_process_group(store=store, rank=0, world_size=1, backend=backend, **kwargs)

Expand Down

0 comments on commit 4276453

Please sign in to comment.