-
Notifications
You must be signed in to change notification settings - Fork 7.2k
[RLlib] Create resource bundle per learner #59620
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
Changes from 5 commits
fccebe7
50810c6
b5c783b
48e4405
0023e50
12d7714
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,47 +179,40 @@ def _get_offline_eval_runner_bundles(config): | |
|
|
||
|
|
||
| def _get_learner_bundles(config): | ||
| try: | ||
| from ray.rllib.extensions.algorithm_utils import _get_learner_bundles as func | ||
|
|
||
| return func(config) | ||
| except Exception: | ||
| pass | ||
|
|
||
| if config.num_learners == 0: | ||
| if config.num_aggregator_actors_per_learner > 0: | ||
| return [{"CPU": config.num_aggregator_actors_per_learner}] | ||
| return [{"CPU": 1} for _ in range(config.num_aggregator_actors_per_learner)] | ||
| else: | ||
| return [] | ||
|
|
||
| num_cpus_per_learner = ( | ||
| config.num_cpus_per_learner | ||
| if config.num_cpus_per_learner != "auto" | ||
| else 1 | ||
| if config.num_gpus_per_learner == 0 | ||
| else 0 | ||
| ) | ||
| if config.num_cpus_per_learners != "auto": | ||
| num_cpus_per_learner = config.num_cpus_per_learner | ||
| elif config.num_gpus_per_learner == 0: | ||
| num_cpus_per_learner = 1 | ||
| else: | ||
| num_cpus_per_learner = 0 | ||
|
|
||
| # aggregator actors are co-located with learners and use 1 CPU each | ||
| bundles = [ | ||
| { | ||
| "CPU": config.num_learners | ||
| * (num_cpus_per_learner + config.num_aggregator_actors_per_learner), | ||
| "GPU": config.num_learners * config.num_gpus_per_learner, | ||
| "CPU": num_cpus_per_learner + config.num_aggregator_actors_per_learner, | ||
| "GPU": config.num_gpus_per_learner, | ||
| } | ||
| for _ in range(config.num_learners) | ||
|
Contributor
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. This looks more correct than before, but I am wondering, if this would still not ensure that |
||
| ] | ||
|
|
||
| return bundles | ||
|
|
||
|
|
||
| def _get_main_process_bundle(config): | ||
| if config.num_learners == 0: | ||
| num_cpus_per_learner = ( | ||
| config.num_cpus_per_learner | ||
| if config.num_cpus_per_learner != "auto" | ||
| else 1 | ||
| if config.num_gpus_per_learner == 0 | ||
| else 0 | ||
| ) | ||
| if config.num_cpus_per_learners != "auto": | ||
| num_cpus_per_learner = config.num_cpus_per_learner | ||
| elif config.num_gpus_per_learner == 0: | ||
| num_cpus_per_learner = 1 | ||
| else: | ||
| num_cpus_per_learner = 0 | ||
|
|
||
| bundle = { | ||
| "CPU": max(num_cpus_per_learner, config.num_cpus_for_main_process), | ||
| "GPU": config.num_gpus_per_learner, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.