MPS Environment Variables#
Created On: Jun 11, 2025 | Last Updated On: Jun 11, 2025
PyTorch Environment Variables
Variable | Description |
|---|---|
| If set to |
| Set log options bitmask to |
| Set profile and signpost bitmasks to |
| High watermark ratio for MPS allocator. Default is 1.7. |
| Low watermark ratio for MPS allocator. Default is 1.4 (unified) or 1.0 (discrete). |
| If |
| If |
| If |
Note
high watermark ratio is a hard limit for the total allowed allocations
0.0: disables high watermark limit (may cause system failure if system-wide OOM occurs)1.0: recommended maximum allocation size (i.e., device.recommendedMaxWorkingSetSize)>1.0: allows limits beyond the device.recommendedMaxWorkingSetSize
e.g., value 0.95 means we allocate up to 95% of recommended maximumallocation size; beyond that, the allocations would fail with OOM error.
low watermark ratio is a soft limit to attempt limiting memory allocations up to the lower watermarklevel by garbage collection or committing command buffers more frequently (a.k.a, adaptive commit).Value between 0 to m_high_watermark_ratio (setting 0.0 disables adaptive commit and garbage collection)e.g., value 0.9 means we ‘attempt’ to limit allocations up to 90% of recommended maximumallocation size.