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

Feat call maybe reinit diloco #37

Merged
merged 2 commits into from
Oct 4, 2024
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
Prev Previous commit
fix tests comms
  • Loading branch information
samsja committed Oct 4, 2024

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
commit c15f74d5b6733762d9510c8eb0a9cf543837dc73
12 changes: 10 additions & 2 deletions tests/test_dist/test_comms.py
Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@ def foo(**kwargs):
dist.all_reduce(a, op=dist.ReduceOp.SUM, group=edm.global_pg)
assert torch.allclose(a, torch.tensor([0, sum_ints, 2 * sum_ints]))

del edm

processes = []
for rank in range(world_size):
processes.append(
@@ -64,6 +66,8 @@ def foo(**kwargs):
sum_ints = global_world_size * (global_world_size + 1) // 2
assert torch.allclose(a, torch.tensor([0, sum_ints, 2 * sum_ints]) + rank * global_world_size)

del edm

global_ports = [i for i in range(21970, 21970 + world_size)]
master_ports = [i for i in range(31000, 31000 + global_world_size)]
processes = []
@@ -96,8 +100,8 @@ def foo(**kwargs):
pytest.fail(f"Process {p.pid} failed with exit code {p.exitcode}")


@pytest.mark.parametrize("world_size", [1, 2, 8])
@pytest.mark.parametrize("global_world_size", [2, 8])
@pytest.mark.parametrize("world_size", [1, 2])
@pytest.mark.parametrize("global_world_size", [2, 4])
def test_elastic_device_mesh_on_off_ramp(world_size: int, global_world_size: int, mock_env):
ready_event = mp.Event()

@@ -136,6 +140,8 @@ def foo(**kwargs):

dist.barrier(edm.global_pg)

del edm

def bar(**kwargs):
with mock_env(**kwargs):
test_value = int(kwargs["TEST_VALUE"])
@@ -163,6 +169,8 @@ def bar(**kwargs):

dist.barrier(edm.global_pg)

del edm

global_ports = [i for i in range(21970, 21970 + world_size)]
master_ports = [i for i in range(31000, 31000 + global_world_size + 1)]
processes = []