Fix broadcast use cuda device lead to memory capacity unbalanced (#5416)
This commit is contained in:
@@ -846,9 +846,12 @@ def broadcast_pyobj(
|
||||
rank: int,
|
||||
dist_group: Optional[torch.distributed.ProcessGroup] = None,
|
||||
src: int = 0,
|
||||
force_cpu_device: bool = True,
|
||||
):
|
||||
"""Broadcast inputs from rank=0 to all other ranks with torch.dist backend."""
|
||||
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
||||
device = torch.device(
|
||||
"cuda" if torch.cuda.is_available() and not force_cpu_device else "cpu"
|
||||
)
|
||||
|
||||
if rank == 0:
|
||||
if len(data) == 0:
|
||||
|
||||
Reference in New Issue
Block a user