Python module
max.profiler
Performance profiling and tracing utilities for MAX.
This module provides tools for profiling and tracing MAX operations to analyze performance characteristics. Profiling captures timing information for code execution, which helps identify bottlenecks and optimize your models.
To enable profiling, set the MODULAR_ENABLE_PROFILING=1 environment
variable before running your code. Without this variable, profiling calls will
be no-ops with minimal overhead.
The profiler supports three usage patterns:
- Context manager: Use
Traceras a context manager to profile a code block. - Decorator: Use
@tracedto profile entire functions. - Manual stack: Use
Tracermethods to explicitly control profiling spans.
Tracing
Tracer | A stack-based profiling manager for creating nested profiling spans. |
|---|
traced | Decorator for creating a profiling span for a function. |
|---|
Configuration
is_profiling_enabled | is_profiling_enabled() -> bool |
|---|---|
set_gpu_profiling_state | str, /) -> None |
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!