Skip to content

Add distributed usage to ImageNet example's README #1001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions imagenet/README.md
Original file line number Diff line number Diff line change
@@ -45,6 +45,15 @@ Node 1:
python main.py -a resnet50 --dist-url 'tcp://IP_OF_NODE0:FREEPORT' --dist-backend 'nccl' --multiprocessing-distributed --world-size 2 --rank 1 [imagenet-folder with train and val folders]
```

## Distributed Data Parallel Training

If you wish to disable PyTorch's multiprocessing module and manually manage processes yourself (e.g. with MPI), you must specify the `world-size`, `rank` and `gpu` values yourself. For example:

```bash
python main.py ... --world-size 2 --rank 0 --gpu 0 [imagenet-folder with train and val folders] &
python main.py ... --world-size 2 --rank 1 --gpu 1 [imagenet-folder with train and val folders] &
Comment on lines +53 to +54
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Quentin-Anthony noob question: why do you need the trailing "&"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hudeven -- It launches the line in the background so that bash can run the next command immediately

```

## Usage

```