Skip to content

Commit 63abe03

Browse files
Add option to enable on-demand profiling server in MaxText ML Diagnostics
- Add `managed_mldiagnostics_on_demand_profiling` configuration flag to `base.yml` (enabled by default) and `types.py`. - Pass `on_demand_xprof` parameter to `mldiag.machinelearning_run(...)` in `managed_mldiagnostics.py` to allow users to toggle on-demand profiling at runtime. Fixes AI-Hypercomputer#4129. PiperOrigin-RevId: 932303562
1 parent 53b276b commit 63abe03

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/maxtext/common/managed_mldiagnostics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,6 @@ def should_log_key(key, value):
7272
run_group=config.managed_mldiagnostics_run_group,
7373
configs=config_dict,
7474
gcs_path=config.managed_mldiagnostics_dir,
75+
on_demand_xprof=config.managed_mldiagnostics_on_demand_profiling,
7576
region=region,
7677
)

src/maxtext/configs/base.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ tpu_num_sparse_cores_to_trace: 2
838838
# - upload xplane profiling, if it is enabled.
839839
# - upload training metrics, at the defined log_period interval.
840840
managed_mldiagnostics: false # Whether to enable the managed diagnostics
841+
managed_mldiagnostics_on_demand_profiling: true # Enable on-demand profiling server by default
841842
managed_mldiagnostics_run_group: "" # Optional. Used to group multiple runs.
842843
managed_mldiagnostics_region: "" # Optional. GCP region for managed mldiagnostics. If empty, it will be auto-detected by the SDK.
843844

src/maxtext/configs/types.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,10 @@ class ManagedMLDiagnostics(BaseModel):
17851785
"""Configuration for managed mldiagnostics."""
17861786

17871787
managed_mldiagnostics: bool = Field(False, description="Enable managed mldiagnostics.")
1788+
managed_mldiagnostics_on_demand_profiling: bool = Field(
1789+
True,
1790+
description=("Enable on-demand profiling server when managed mldiagnostics is" " enabled."),
1791+
)
17881792
managed_mldiagnostics_run_group: str = Field("", description="Name used to group multiple runs.")
17891793
managed_mldiagnostics_region: str = Field("", description="GCP region for managed mldiagnostics.")
17901794

0 commit comments

Comments
 (0)