MCPcopy Create free account
hub / github.com/ml-explore/mlx / main

Function main

examples/cpp/distributed.cpp:9–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace mx = mlx::core;
8
9int main() {
10 if (!mx::distributed::is_available()) {
11 std::cout << "No communication backend found" << std::endl;
12 return 1;
13 }
14
15 auto global_group = mx::distributed::init();
16 std::cout << global_group.rank() << " / " << global_group.size() << std::endl;
17
18 mx::array x = mx::ones({10});
19 mx::array out = mx::distributed::all_sum(x, global_group);
20
21 std::cout << out << std::endl;
22}

Callers

nothing calls this directly

Calls 6

is_availableFunction · 0.50
initFunction · 0.50
onesFunction · 0.50
all_sumFunction · 0.50
rankMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected