-
Notifications
You must be signed in to change notification settings - Fork 582
Add more elasticity goodput tests #4846
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |||||||||||||||||||||||||
| from maxtext.utils import gcs_utils | ||||||||||||||||||||||||||
| from maxtext.utils import max_logging | ||||||||||||||||||||||||||
| import pathwaysutils | ||||||||||||||||||||||||||
| from pathwaysutils.elastic import elastic | ||||||||||||||||||||||||||
| from pathwaysutils.elastic import manager | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| elastic_manager: manager.Manager | None = None | ||||||||||||||||||||||||||
|
|
@@ -39,11 +40,11 @@ def record_slice_state(recorder, active_slices_override: int | None = None) -> N | |||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| available_slices = len(pathwaysutils.elastic.get_active_slice_indices()) | ||||||||||||||||||||||||||
| available_slices = len(elastic.get_active_slice_indices()) | ||||||||||||||||||||||||||
| active_slices = ( | ||||||||||||||||||||||||||
| active_slices_override if active_slices_override is not None else len(elastic_manager.active_slice_indices) | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
| total_slices = len(pathwaysutils.elastic.get_slice_to_devices(jax.devices())) | ||||||||||||||||||||||||||
| total_slices = len(elastic.get_slice_to_devices(jax.devices())) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| recorder.record_elastic_slice_counts( | ||||||||||||||||||||||||||
| available_slices=available_slices, | ||||||||||||||||||||||||||
|
|
@@ -57,7 +58,7 @@ def record_elastic_event_start(recorder, config) -> None: | |||||||||||||||||||||||||
| global pending_elastic_event_type | ||||||||||||||||||||||||||
| event_type = "elastic_scale_up" if is_scale_up_event(config) else "elastic_slice_down" | ||||||||||||||||||||||||||
| pending_elastic_event_type = event_type | ||||||||||||||||||||||||||
| if recorder: | ||||||||||||||||||||||||||
| if recorder and hasattr(recorder, "record_elastic_wait_start_time"): | ||||||||||||||||||||||||||
| recorder.record_elastic_wait_start_time(event_type=event_type) | ||||||||||||||||||||||||||
| record_slice_state(recorder, active_slices_override=0) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -69,7 +70,7 @@ def record_elastic_wait_end_and_reinit_start(recorder) -> None: | |||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||
| event_type = pending_elastic_event_type | ||||||||||||||||||||||||||
| pending_elastic_event_type = None | ||||||||||||||||||||||||||
| if recorder: | ||||||||||||||||||||||||||
| if recorder and hasattr(recorder, "record_elastic_wait_end_time"): | ||||||||||||||||||||||||||
| recorder.record_elastic_wait_end_time(event_type=event_type) | ||||||||||||||||||||||||||
| recorder.record_elastic_reinit_start_time() | ||||||||||||||||||||||||||
| record_slice_state(recorder) | ||||||||||||||||||||||||||
|
Comment on lines
+73
to
76
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. To ensure robust defensive programming, we should verify that the recorder implements both
Suggested change
|
||||||||||||||||||||||||||
|
|
@@ -79,10 +80,10 @@ def record_elastic_wait_end_and_reinit_start(recorder) -> None: | |||||||||||||||||||||||||
| def record_elastic_reinit_end() -> None: | ||||||||||||||||||||||||||
| """Records end of elastic reinitialization event.""" | ||||||||||||||||||||||||||
| global pending_reinit_recorder | ||||||||||||||||||||||||||
| if pending_reinit_recorder is not None: | ||||||||||||||||||||||||||
| if pending_reinit_recorder is not None and hasattr(pending_reinit_recorder, "record_elastic_reinit_end_time"): | ||||||||||||||||||||||||||
| pending_reinit_recorder.record_elastic_reinit_end_time() | ||||||||||||||||||||||||||
| record_slice_state(pending_reinit_recorder) | ||||||||||||||||||||||||||
| pending_reinit_recorder = None | ||||||||||||||||||||||||||
| pending_reinit_recorder = None | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def elastic_enabled(config) -> bool: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
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.
Thanks for taking care of this!