Skip to content

Commit ec128cb

Browse files
Update tests/backends/skyrl_train/distributed/test_chunked_logprob_backward_streaming.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 07df484 commit ec128cb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/backends/skyrl_train/distributed/test_chunked_logprob_backward_streaming.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ def tp_group():
8585
inside ``_compute_distributed_log_softmax`` is the identity. This isolates
8686
the streamed-buffer refactor from the (separately tested) TP reduction.
8787
"""
88+
initialized_here = False
8889
if not dist.is_initialized():
8990
os.environ["MASTER_ADDR"] = "localhost"
9091
os.environ["MASTER_PORT"] = str(get_free_port())
9192
os.environ["RANK"] = "0"
9293
os.environ["WORLD_SIZE"] = "1"
9394
dist.init_process_group(backend="gloo", rank=0, world_size=1)
95+
initialized_here = True
9496
yield dist.group.WORLD
95-
if dist.is_initialized():
97+
if initialized_here and dist.is_initialized():
9698
dist.destroy_process_group()
9799

98100

0 commit comments

Comments
 (0)