ml-explore / ml-explore/mlx-examples

Distributed only utilizing the GPU on the host machine

Open
#1,218 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I have been playing with distributed training and generation and am running into a weird issue where only the computer that runs mpirun actually utilizes the GPU. The rest load the models into memory but do not actually use any GPU.

Image

The command I am using to run the training is:

mpirun \
    --mca btl_tcp_links 4 \
    --mca btl_tcp_if_include bridge0 \
    --verbose \
    --mca btl_base_verbose 100 \
    -np 4 \
    -x PATH=$(pwd)/.venv/bin:$PATH \
    -x PYTHONPATH=$(pwd)/.venv/lib/python3.12/site-packages  \
    --hostfile ./hosts.txt \
    /opt/homebrew/bin/uv run mlx_lm.lora \
        --model mlx-community/Llama-3.3-70B-Instruct-4bit \
        --data ./converted \
        --train \
        --iters 1000 \
        --batch-size 1

I have tried not using thunderbolt etc and still the same issue. If I run the mpirun from any of my hosts I get the host that I start the program on using it's gpu but no other computer does.

my hosts.txt is pretty simple, ssh works, everything connects and training runs it just runs at 30 tokens / second and no distribution.

ai-mac-1.local  slots=1
ai-mac-2.local  slots=1
ai-mac-3.local  slots=1
ai-mac-4.local  slots=1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the distributed run through the mlx_lm.lora entry point with the provided hosts.txt and mpirun command. Compare GPU utilization across all four hosts and inspect how the distributed training configuration is initialized. Done means each host loads and uses its GPU during training, rather than only the mpirun host.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.