Skip to content

Expose backend parameter in mlx_distributed_init() and mlx_distributed_is_available() #108

Closed

Description

@ronaldmannak

The C++ distributed API supports backend selection:

// mlx/distributed/distributed.h
Group init(bool strict = false, const std::string& bk = "any");
bool is_available(const std::string& bk = "");

However, the MLX-C wrappers hardcode the default and don't expose the backend parameter:

// mlx/c/distributed_group.h
mlx_distributed_group mlx_distributed_init(bool strict);

// mlx/c/distributed.h
bool mlx_distributed_is_available(void);

In distributed_group.cpp, the implementation calls:

mlx::core::distributed::init(strict)  // always uses bk="any"

Request:

Add the backend parameter to both functions:

mlx_distributed_group mlx_distributed_init(bool strict, const char* backend);
bool mlx_distributed_is_available(const char* backend);

Where passing NULL or "any" preserves the current default behavior.

Motivation:

I'm interested in adding distributed support to mlx-swift. Without this parameter, applications that compile multiple backends (e.g., ring + JACCL) cannot select a specific one at runtime through the C API. This is the only gap preventing full distributed feature parity between the Python and C/Swift bindings.

Activity

  1. andresy commented on Mar 20, 2026

    @andresy
    Member

    Thanks for reminding me this one!
    Now fixed in #109

  2. ronaldmannak commented on Mar 20, 2026

    @ronaldmannak
    ContributorAuthor

    Thanks @andresy !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions