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

[Core] Fix incorrect gpu ids if placement group bundle index specified #44385

Conversation

wuxibin89
Copy link
Contributor

@wuxibin89 wuxibin89 commented Apr 1, 2024

Why are these changes needed?

This PR fix incorrect CUDA_VISIBLE_DEVICES when placement_group_bundle_index is specified.

Related issue number

Closes #29811

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 added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • 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 :(

cc @jjyao

@wuxibin89 wuxibin89 changed the title fix incorrect gpu ids if placement group bundle index specified [core] Fix incorrect gpu ids if placement group bundle index specified Apr 1, 2024
@wuxibin89 wuxibin89 changed the title [core] Fix incorrect gpu ids if placement group bundle index specified [Core] Fix incorrect gpu ids if placement group bundle index specified Apr 1, 2024
@jjyao jjyao self-assigned this Apr 12, 2024
Copy link
Collaborator

@jjyao jjyao left a comment

Choose a reason for hiding this comment

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

Nice!

python/ray/_private/worker.py Outdated Show resolved Hide resolved
python/ray/runtime_context.py Outdated Show resolved Hide resolved
@jjyao
Copy link
Collaborator

jjyao commented Apr 16, 2024

Oh actually I think this PR will cause issue if user uses both bundle index and non-bundle index in the same PG.

For example:

ray.init(num_gpus=2) # Two GPUs: 0, 1
pg = placement_group([{"GPU": 1}, {"GPU": 1}])

@ray.remote(num_gpus=1)
class Actor:
  pass

actor1 = Actor.options(scheduling_strategy=PlacementGroupSchedulingStrategy(placement_group=pg)).remote()
actor2 = Actor.options(scheduling_strategy=PlacementGroupSchedulingStrategy(placement_group=pg, bundle_index=0)).remote()

It's possible that both actors are assigned to GPU 0.

This is not an easy fix unfortunately given how placement group is implemented now.

@wuxibin89
Copy link
Contributor Author

Oh actually I think this PR will cause issue if user uses both bundle index and non-bundle index in the same PG.

@jjyao Yes, I can reproduce this problem, I will take a look how to fix it.

@anyscalesam anyscalesam added triage Needs triage (eg: priority, bug/not-bug, and owning component) core Issues that should be addressed in Ray Core labels Apr 29, 2024
@anyscalesam anyscalesam assigned wuxibin89 and unassigned jjyao Apr 29, 2024
@anyscalesam anyscalesam added bug Something that is supposed to be working; but isn't @external-author-action-required Alternate tag for PRs where the author doesn't have labeling permission. labels Apr 29, 2024
@jjyao jjyao self-assigned this Apr 29, 2024
@jjyao
Copy link
Collaborator

jjyao commented Apr 29, 2024

@wuxibin89 I think this is not easy to fix right now. This problem will be fixed automatically once we re-implemented PG using labels and virtual clusters (ray-project/enhancements#49)

@wuxibin89
Copy link
Contributor Author

wuxibin89 commented May 22, 2024

@jjyao Hi, is there any plan that re-implementing PG with labels and virtual clusters? It seems like there's a lot work to do and may not available in short term. We have a project(will open soon) that heavily relay on this fix to colocate multiple actor groups on the same PG.

So can we fix this first and give user a warning not to use bundle index and non-bundle index in the same PG?

cc @anyscalesam

@anyscalesam
Copy link
Contributor

@wuxibin89 grabbed some time to chat about this further as full fledged VC implementation will be difficult and perhaps overkill.

I think what would make more sense is for us to sit down for 15m and understand your use case well and than brainstorm on a solution that perhaps you can contribute back to.

I setup time for later this week. cc @jjyao

@rkooo567 rkooo567 assigned rkooo567 and unassigned jjyao and wuxibin89 Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is supposed to be working; but isn't core Issues that should be addressed in Ray Core @external-author-action-required Alternate tag for PRs where the author doesn't have labeling permission. triage Needs triage (eg: priority, bug/not-bug, and owning component)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core] GPU placement group doesn't honor the bundle index
4 participants