|
| 1 | +# ESMF Profiling tool |
| 2 | +The **ESMF Profiling tool** is a Python-based tool designed to read and process performance profile data from ESMF profiling log files. It provides a structured way to extract hierachical timing and computational stats for various regions within ESMF log files, enabling detailed performance analysis. |
| 3 | + |
| 4 | +## Directory structure |
| 5 | +``` |
| 6 | +├── esmfFileParser.py |
| 7 | +├── esmfRegion.py |
| 8 | +└── README.md |
| 9 | +``` |
| 10 | + |
| 11 | +### Components: |
| 12 | + 1. `esmfFileParser.py`: |
| 13 | + - handles the input ESMF profile files. |
| 14 | + - constructs the hierarchical data structure. |
| 15 | + - outputs runtimes for specific regions. |
| 16 | + 2. `esmfRegion.py`: |
| 17 | + - defines the ESMFRegion class. |
| 18 | + - represents individual ESMF regions, capturing performance metrics. |
| 19 | + |
| 20 | +The tool supports two profiling data formats, where metrics are included in the brackets for indexing: |
| 21 | + 1. `ESMF_Profile.xxxx`: (0. count, 1. total, 2. self_time, 3. mean , 4. min_time, 5. max_time ) |
| 22 | + 2. `ESMF_Profile.summary`: (0. count, 1. PETs , 2. mean , 3. min_time, 4. max_time, 5. min_PET, 6. max_PET) |
| 23 | + |
| 24 | +## Usage |
| 25 | +Simply specify the path to the profiling logs, along with any specific regions of interest. |
| 26 | + |
| 27 | +One example for demonstration: |
| 28 | +---------- |
| 29 | +```python |
| 30 | +# Collect runtime info for specific regions |
| 31 | +ESMF_path = ['/path/to/your/ESMF/output/files'] |
| 32 | +region_names = ['[ESMF]', '[ESMF]/[ensemble] RunPhase1/[ESM0001] RunPhase1/[OCN] RunPhase1'] |
| 33 | +profile_prefix = 'ESMF_Profile.' |
| 34 | +esmf_summary = True # Set to True for summary profiling |
| 35 | +index = 2 # Choose the metric above to extract (e.g., mean time for summary profiling) |
| 36 | +runtime_totals = collect_runtime_tot(ESMF_path, regionNames=region_names, profile_prefix=profile_prefix, esmf_summary=esmf_summary, index=index) |
| 37 | +print(runtime_totals) |
| 38 | +``` |
0 commit comments