| 488 | } |
| 489 | |
| 490 | std::shared_ptr<GroupImpl> init(bool strict /* = false */) { |
| 491 | if (!mpi().init_safe()) { |
| 492 | if (strict) { |
| 493 | throw std::runtime_error("Cannot initialize MPI"); |
| 494 | } |
| 495 | return nullptr; |
| 496 | } |
| 497 | |
| 498 | return std::make_shared<MPIGroup>(mpi().world(), true); |
| 499 | } |
| 500 | |
| 501 | } // namespace mlx::core::distributed::mpi |