Skip to content

Commit

Permalink
fix distributed tests with pt main (#1452)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-vi authored Nov 19, 2024
1 parent 0205c73 commit 8d1637f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion thunder/tests/distributed/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from functools import partial
from functools import wraps
from typing import ClassVar, TYPE_CHECKING
import inspect
import math
import os
import sys
Expand Down Expand Up @@ -129,10 +130,14 @@ def _run(cls, rank, test_name, file_name, pipe, *, fake_pg=False):
local_rank = self.rank % torch.cuda.device_count()
torch.cuda.set_device(local_rank)
os.environ["LOCAL_RANK"] = str(local_rank)
if "destroy_process_group" in inspect.signature(self.run_test).parameters:
run_test_kwargs = {"destroy_process_group": False}
else:
run_test_kwargs = {}

torch.distributed.barrier()
try:
self.run_test(test_name, pipe)
self.run_test(test_name, pipe, **run_test_kwargs)
except Exception:
raise
finally:
Expand Down

0 comments on commit 8d1637f

Please sign in to comment.