Skip to content

Commit a2dc2a8

Browse files
Merge pull request #4514 from Shuwen-Fang:estimate
PiperOrigin-RevId: 950978763
2 parents a64409b + 5f0dabb commit a2dc2a8

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

docs/guides/monitoring_and_debugging/understand_logs_and_metrics.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,11 @@ Before executing training, the program analyzes the resource requirements for yo
159159
We first perform a "dry run" compilation of a training step to [analyze its memory requirement](https://github.com/AI-Hypercomputer/maxtext/blob/28e5097ac467ed8b1d17676d68aa5acc50f9d60d/src/MaxText/train.py#L380-L382). This static analysis is performed by the XLA compiler. The log outputs [memory sizes](https://github.com/AI-Hypercomputer/maxtext/blob/28e5097ac467ed8b1d17676d68aa5acc50f9d60d/src/MaxText/max_utils.py#L672-L690):
160160

161161
```none
162-
Total memory size: 100.4 GB, Output size: 44.5 GB, Temp size: 55.9 GB, Argument size: 44.5 GB, Host temp size: 0.0 GB.
162+
Total estimated memory size: 100.4 GB, estimated output size: 44.5 GB, estimated temp size: 55.9 GB, estimated argument size: 44.5 GB, Estimated host temp size: 0.0 GB.
163+
Note that compiler could over-estimate the HBM usage.
163164
```
164165

165-
The most important number is `Total memory size: 100.4 GB`. This is the total High Bandwidth Memory (HBM) the TPU device needs to execute the program. Here is a breakdown:
166+
The most important number is `Total estimated memory size: 100.4 GB`. This is the estimated total High Bandwidth Memory (HBM) the TPU device needs to execute the program. Note that the compiler could over-estimate the HBM usage. Here is a breakdown:
166167

167168
- `Argument size: 44.5 GB`: This is the memory needed to hold the inputs for your function. This typically includes the batch of data, parameter (master copy), and optimizer state (e.g., moment).
168169
- `Output size: 44.5 GB`: This is the space required to store the results of the computation, such as the updated model weights and updated optimizer states.

src/maxtext/utils/max_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,12 @@ def bytes_to_gb(num_bytes):
816816
total_gb = output_gb + temp_gb + argument_gb - alias_gb
817817

818818
max_logging.log(
819-
f"Total memory size: {total_gb:.1f} GB, Output size: {output_gb:.1f} GB, Temp size: {temp_gb:.1f} GB, "
820-
f"Argument size: {argument_gb:.1f} GB, Host temp size: {host_temp_gb:.1f} GB."
819+
f"Total estimated memory size: {total_gb:.1f} GB, estimated output"
820+
f" size: {output_gb:.1f} GB, estimated temp size: {temp_gb:.1f} GB, "
821+
f"estimated argument size: {argument_gb:.1f} GB, Estimated host temp"
822+
f" size: {host_temp_gb:.1f} GB."
821823
)
824+
max_logging.log("Note that compiler could over-estimate the HBM usage.")
822825

823826

824827
def print_system_information():

0 commit comments

Comments
 (0)