Skip to content
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

Use all gpus available for training #293

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Abecid
Copy link

@Abecid Abecid commented May 19, 2023

Use all gpus available for training

Copy link
Contributor

@awaelchli awaelchli left a comment

Choose a reason for hiding this comment

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

Thanks for the suggestion @Abecid. In general the changes look good but it won't make much difference because we are keeping the batch size constant globally to keep it easy to reproduce results. In fact, if training fits in a single GPU and torch.cuda.device_count() selects more devices, it may actually be slower because of the reduced per-device batch size and communication overhead.

I vote for keeping the values as they are and instead advise users to scale both devices and batch size to their setup to maximize efficiency. We could add this info to the how-to guides. Let me know what you think.

@@ -31,7 +31,7 @@
save_interval = 1000
eval_iters = 100
log_interval = 100
devices = 4
devices = torch.cuda.device_count()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
devices = torch.cuda.device_count()
devices = "auto"

Comment on lines +53 to +54
devices = torch.cuda.device_count()
fabric = L.Fabric(accelerator="cuda", devices=devices, precision="bf16-true")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
devices = torch.cuda.device_count()
fabric = L.Fabric(accelerator="cuda", devices=devices, precision="bf16-true")
fabric = L.Fabric(accelerator="cuda", devices="auto", precision="bf16-true")

Copy link
Contributor

Choose a reason for hiding this comment

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

@Abecid Did multi-gpu training work with this script and how many did you use? Is the loss convergence comparable to single gpu training?

Choose a reason for hiding this comment

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

i ran this with two NVIDIA Tesla T4 cards with devices="auto" and got this error:

RuntimeError: [1] is setting up NCCL communicator and retrieving ncclUniqueId from [0] via c10d key-value store by key '0', but store->get('0') got error: Broken pipe. This may indicate a possible application crash on rank 0 or a network set up issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants