-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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 GPU first scheduling that is not working with placement group #19141
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
56b18f0
done
rkooo567 e30743c
Merge branch 'master' into fix-gpu-scheduling
rkooo567 a34c90b
Revert "done"
rkooo567 56e22bf
ip
rkooo567 aebea12
Revert "Revert "done""
rkooo567 b675c34
Done
rkooo567 54bd763
Remove unnecessary log message
rkooo567 614db0a
Merge branch 'master' into fix-gpu-scheduling
rkooo567 79ec2c8
skip test on windows
rkooo567 e28eadf
Handle the code review.
rkooo567 5e8498f
Merge branch 'master' into fix-gpu-scheduling
rkooo567 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -550,8 +550,8 @@ def __init__(self): | |
def get_location(self): | ||
return ray.worker.global_worker.node.unique_id | ||
|
||
@ray.remote | ||
def task_cpu(num_cpus=0.5): | ||
@ray.remote(num_cpus=0.5) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. another. bug in tests |
||
def task_cpu(): | ||
time.sleep(10) | ||
return ray.worker.global_worker.node.unique_id | ||
|
||
|
@@ -618,6 +618,61 @@ def g(): | |
time.sleep(1) | ||
|
||
|
||
@pytest.mark.skipif(sys.platform == "win32", reason="Fails on windows") | ||
def test_gpu_scheduling_liveness(ray_start_cluster): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I verified this doesn't work when the change wasn't added |
||
"""Check if the GPU scheduling is in progress when | ||
it is used with the placement group | ||
Issue: https://github.com/ray-project/ray/issues/19130 | ||
""" | ||
cluster = ray_start_cluster | ||
# Start a node without a gpu. | ||
cluster.add_node(num_cpus=6) | ||
ray.init(address=cluster.address) | ||
|
||
NUM_CPU_BUNDLES = 10 | ||
|
||
@ray.remote(num_cpus=1) | ||
class Worker(object): | ||
def __init__(self, i): | ||
self.i = i | ||
|
||
def work(self): | ||
time.sleep(0.1) | ||
print("work ", self.i) | ||
|
||
@ray.remote(num_cpus=1, num_gpus=1) | ||
class Trainer(object): | ||
def __init__(self, i): | ||
self.i = i | ||
|
||
def train(self): | ||
time.sleep(0.2) | ||
print("train ", self.i) | ||
|
||
bundles = [{"CPU": 1, "GPU": 1}] | ||
bundles += [{"CPU": 1} for _ in range(NUM_CPU_BUNDLES)] | ||
|
||
pg = ray.util.placement_group(bundles, strategy="PACK") | ||
o = pg.ready() | ||
# Artificial delay to simulate the real world workload. | ||
time.sleep(3) | ||
print("Scaling up.") | ||
cluster.add_node(num_cpus=6, num_gpus=1) | ||
ray.get(o) | ||
|
||
workers = [ | ||
Worker.options(placement_group=pg).remote(i) | ||
for i in range(NUM_CPU_BUNDLES) | ||
] | ||
trainer = Trainer.options(placement_group=pg).remote(0) | ||
|
||
# If the gpu scheduling doesn't properly work, the below | ||
# code will hang. | ||
ray.get( | ||
[workers[i].work.remote() for i in range(NUM_CPU_BUNDLES)], timeout=30) | ||
ray.get(trainer.train.remote(), timeout=30) | ||
|
||
|
||
if __name__ == "__main__": | ||
import pytest | ||
sys.exit(pytest.main(["-v", __file__])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a bug. I can remove it if you don't like it to be included here