MLX
 
Loading...
Searching...
No Matches
distributed.h
Go to the documentation of this file.
1// Copyright © 2024 Apple Inc.
2
3#pragma once
4
5#include <memory>
6
7#include "mlx/array.h"
8
10
11// Forward declaration of the base group implementation.
12namespace detail {
13class GroupImpl;
14};
15
16/* Check if a communication backend is available */
18
24struct Group {
25 Group(std::shared_ptr<detail::GroupImpl> group) : group_(std::move(group)) {}
26
27 int rank() const;
28 int size() const;
29
38 Group split(int color, int key = -1) const;
39
40 const std::shared_ptr<detail::GroupImpl>& raw_group() const {
41 return group_;
42 }
43
44 private:
45 std::shared_ptr<detail::GroupImpl> group_{nullptr};
46};
47
56Group init(bool strict = false, const std::string& bk = "any");
57
58} // namespace mlx::core::distributed
Abstract base class of a distributed group implementation.
Definition distributed_impl.h:12
array std(const array &a, bool keepdims, int ddof=0, StreamOrDevice s={})
Computes the standard deviation of the elements of an array.
Definition distributed.h:12
Definition distributed.h:9
Group init(bool strict=false, const std::string &bk="any")
Initialize the distributed backend and return the group containing all discoverable processes.
A distributed::Group represents a group of independent mlx processes that can communicate.
Definition distributed.h:24
Group(std::shared_ptr< detail::GroupImpl > group)
Definition distributed.h:25
Group split(int color, int key=-1) const
Split the group according to the provided color.
const std::shared_ptr< detail::GroupImpl > & raw_group() const
Definition distributed.h:40