Download ml-stable-diffusion/mlx/examples/cpp/distributed.cpp from Fahad-S/FastVLM_SANA: direct link, hf CLI and curl.
- Browser
- Download file 499 Bytes
-
https://huggingface.co/Fahad-S/FastVLM_SANA/resolve/main/ml-stable-diffusion/mlx/examples/cpp/distributed.cpp
- Command line
-
hf download hf://Fahad-S/FastVLM_SANA/ml-stable-diffusion/mlx/examples/cpp/distributed.cpp
-
curl -L -o distributed.cpp https://huggingface.co/Fahad-S/FastVLM_SANA/resolve/main/ml-stable-diffusion/mlx/examples/cpp/distributed.cpp
499 Bytes
| // Copyright © 2024 Apple Inc. | |
| namespace mx = mlx::core; | |
| int main() { | |
| if (!mx::distributed::is_available()) { | |
| std::cout << "No communication backend found" << std::endl; | |
| return 1; | |
| } | |
| auto global_group = mx::distributed::init(); | |
| std::cout << global_group.rank() << " / " << global_group.size() << std::endl; | |
| mx::array x = mx::ones({10}); | |
| mx::array out = mx::distributed::all_sum(x, global_group); | |
| std::cout << out << std::endl; | |
| } | |