deepspeedai / deepspeedai/DeepSpeed

Question: sync multi-node distributed processes

Open
#583 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

I'm using BertBing example to train BERT on a multi-node setup, I've also added a custom validation step that runs after X steps and not at the end of the epoch (as in the example). I'm using the dataset provider (by nvidia) in order to run in parallel on all GPUs.
The loss is synced to rank = 0 but once the training loop ends the whole process freezes.

What is the proper way of syncing the tensors in distributed mode in Deepspeed?
I've tried dist.reduce, dist.all_reduce, adding dist.barrier. Gets stuck every time.
Thanks!

for b_i, batch_index in enumerate(tqdm(dataset_iterator, smoothing=1)):
    batch = validation_dataset_provider.get_batch(batch_index)
    batch = tuple(t.to(args.device) for t in batch)  # Move to GPU
    loss = model.network(batch)
    dist.reduce(loss, 0)
    curr_eval_loss += (loss / dist.get_world_size()).mean().item()

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 with the BertBing example and the custom validation loop shown in the issue, then trace how the dataset provider and distributed ranks enter and leave validation. Reproduce the multi-node freeze while comparing the attempted reduce, all_reduce, and barrier calls. Done means the validation loop completes on every rank and the loss is synchronized without hanging.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
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.