Use all gpus available for training#293
Conversation
awaelchli
left a comment
There was a problem hiding this comment.
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.
| eval_iters = 100 | ||
| log_interval = 100 | ||
| devices = 4 | ||
| devices = torch.cuda.device_count() |
There was a problem hiding this comment.
| devices = torch.cuda.device_count() | |
| devices = "auto" |
| devices = torch.cuda.device_count() | ||
| fabric = L.Fabric(accelerator="cuda", devices=devices, precision="bf16-true") |
There was a problem hiding this comment.
| 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") |
There was a problem hiding this comment.
@Abecid Did multi-gpu training work with this script and how many did you use? Is the loss convergence comparable to single gpu training?
There was a problem hiding this comment.
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.
Use all gpus available for training