Skip to content

[Train] Support returning multiple devices in train.torch.get_device() - #32893

Merged
amogkam merged 8 commits into
ray-project:masterfrom
amogkam:multi-gpu-get-device
Mar 1, 2023
Merged

[Train] Support returning multiple devices in train.torch.get_device()#32893
amogkam merged 8 commits into
ray-project:masterfrom
amogkam:multi-gpu-get-device

Conversation

@amogkam

@amogkam amogkam commented Feb 28, 2023

Copy link
Copy Markdown
Contributor

For model parallel workloads like stable diffusion fine-tuning, we may want to use multiple GPUs per Ray Train worker. This PR implements support for train.torch.get_device() returning a List of devices for these use cases so that users do not need to manage device setting themselves.

Why are these changes needed?

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: amogkam <amogkamsetty@yahoo.com>

@krfricke krfricke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, LGTM.

This will still require us to change the prepare_model() methods to allow to select a specific device. We can update this in a follow-up (we may just want to pass in the cuda device ID directly and otherwise default to get_device()[0]

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
@amogkam

amogkam commented Feb 28, 2023

Copy link
Copy Markdown
Contributor Author

Good point, updated

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: amogkam <amogkamsetty@yahoo.com>
@Yard1

Yard1 commented Feb 28, 2023

Copy link
Copy Markdown
Member

Isn't this technically a breaking change that would require a deprecation cycle?

@amogkam

amogkam commented Feb 28, 2023

Copy link
Copy Markdown
Contributor Author

I think it should be fine since this is only affecting the multi-GPU case and this is still beta API, but I will update to log a warning about the change.

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: amogkam <amogkamsetty@yahoo.com>
@amogkam
amogkam merged commit ae665a3 into ray-project:master Mar 1, 2023
@amogkam
amogkam deleted the multi-gpu-get-device branch March 1, 2023 23:16
ProjectsByJackHe pushed a commit to ProjectsByJackHe/ray that referenced this pull request Mar 21, 2023
…()` (ray-project#32893)

For model parallel workloads like stable diffusion fine-tuning, we may want to use multiple GPUs per Ray Train worker. This PR implements support for train.torch.get_device() returning a List of devices for these use cases so that users do not need to manage device setting themselves.

---------

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: Jack He <jackhe2345@gmail.com>
edoakes pushed a commit to edoakes/ray that referenced this pull request Mar 22, 2023
…()` (ray-project#32893)

For model parallel workloads like stable diffusion fine-tuning, we may want to use multiple GPUs per Ray Train worker. This PR implements support for train.torch.get_device() returning a List of devices for these use cases so that users do not need to manage device setting themselves.

---------

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
peytondmurray pushed a commit to peytondmurray/ray that referenced this pull request Mar 22, 2023
…()` (ray-project#32893)

For model parallel workloads like stable diffusion fine-tuning, we may want to use multiple GPUs per Ray Train worker. This PR implements support for train.torch.get_device() returning a List of devices for these use cases so that users do not need to manage device setting themselves.

---------

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
elliottower pushed a commit to elliottower/ray that referenced this pull request Apr 22, 2023
…()` (ray-project#32893)

For model parallel workloads like stable diffusion fine-tuning, we may want to use multiple GPUs per Ray Train worker. This PR implements support for train.torch.get_device() returning a List of devices for these use cases so that users do not need to manage device setting themselves.

---------

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: elliottower <elliot@elliottower.com>
ProjectsByJackHe pushed a commit to ProjectsByJackHe/ray that referenced this pull request May 4, 2023
…()` (ray-project#32893)

For model parallel workloads like stable diffusion fine-tuning, we may want to use multiple GPUs per Ray Train worker. This PR implements support for train.torch.get_device() returning a List of devices for these use cases so that users do not need to manage device setting themselves.

---------

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: Jack He <jackhe2345@gmail.com>
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.

3 participants