Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 3 additions & 4 deletions mlx/distributed/distributed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,11 @@ get_backends() {
}

Group register_group(std::shared_ptr<detail::GroupImpl> group, std::string bk) {
auto& backends = get_backends();
if (group == nullptr) {
group = std::make_shared<detail::EmptyGroup>();
} else {
backends.insert({"any", group});
return Group(std::make_shared<detail::EmptyGroup>());
}
auto& backends = get_backends();
backends.insert({"any", group});
backends.insert({std::move(bk), group});
return Group(group);
}
Expand Down
10 changes: 10 additions & 0 deletions python/tests/ring_test_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ def test_groups(self):
with self.assertRaises(RuntimeError):
sub = world.split(world.rank() % 2)

def test_strict_init_after_fallback(self):
with mlx_tests.scoped_env(
JACCL_IBV_DEVICES=None,
MLX_IBV_DEVICES=None,
):
self.assertEqual(mx.distributed.init(backend="jaccl").size(), 1)

with self.assertRaises(RuntimeError):
mx.distributed.init(backend="jaccl", strict=True)

def test_all_reduce_extra(self):
world = mx.distributed.init()
dtypes = [
Expand Down