Ascend/msagent / skills/profiler/ascend-prof-compare
ascend-prof-compare
VerifiedCompares two Prof datasets (GPU vs NPU / NPU vs NPU) by auto-installing and calling msprof-analyze compare, then parses the result xlsx into HTML report and Chinese xlsx. Invoke when user provides two prof dirs to compare, or has a compare result xlsx to analyze/translate.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.2 KB |
| references/analysis_methodology.md | markdown | 15.1 KB |
| references/compare_quickstart.md | markdown | 3.6 KB |
| scripts/csv_translator.py | script | 8.2 KB |
| scripts/html_generator.py | script | 38.7 KB |
| scripts/main_analyzer.py | script | 11.8 KB |
| scripts/parsers/__init__.py | script | 35 B |
| scripts/parsers/api_compare.py | script | 3.1 KB |
| scripts/parsers/common.py | script | 1.6 KB |
| scripts/parsers/communication.py | script | 2.5 KB |
| scripts/parsers/kernel.py | script | 13.3 KB |
| scripts/parsers/memory.py | script | 3.6 KB |
| scripts/parsers/module.py | script | 4.1 KB |
| scripts/parsers/operator.py | script | 4.0 KB |
| scripts/parsers/overall_metrics.py | script | 5.9 KB |
| scripts/run_compare.py | script | 9.3 KB |
scripts/parsers/memory.py
View on GitHub"""内存比对解析器(合并 memory_statistic + memory_compare)
分析思路:
- Statistic:按 Diff Memory(MB) 降序,检测全零内存场景
- Detail:关联统计页 Top 算子,提取内存分配详情
"""
from parsers.common import safe_float, safe_int, get_sheet_data
def parse_statistic(wb) -> dict:
"""MemoryCompareStatistic 内存统计比对"""
headers, rows = get_sheet_data(wb, 'MemoryCompareStatistic')
if not rows:
return {'sheet_name': 'MemoryCompareStatistic', 'available': False, 'reason': 'Sheet不存在或为空'}
operators = []
for row in rows:
if len(row) < 10:
continue
op_name = row[1].strip() if row[1] else ''
if not op_name or op_name == 'Operator Name':
continue
operators.append({
'name': op_name,
'base_duration': safe_float(row[2]),
'base_memory': safe_float(row[3]),
'base_number': safe_int(row[4]),
'comp_duration': safe_float(row[5]),
'comp_memory': safe_float(row[6]),
'comp_number': safe_int(row[7]),
'diff_memory': safe_float(row[8]),
'diff_ratio': safe_float(row[9]),
})
all_zero = all(o['base_memory'] == 0 and o['comp_memory'] == 0 for o in operators)
operators.sort(key=lambda x: abs(x['diff_memory']), reverse=True)
top10 = operators[:10]
if not all_zero:
increased = [o for o in operators if o['diff_memory'] > 0]
decreased = [o for o in operators if o['diff_memory'] < 0]
total_diff = sum(o['diff_memory'] for o in operators)
else:
increased = []
decreased = []
total_diff = 0
return {
'sheet_name': 'MemoryCompareStatistic',
'available': True,
'total_operators': len(operators),
'total_diff_memory': round(total_diff, 2),
'increased_count': len(increased),
'decreased_count': len(decreased),
'top10': top10,
'all_zero_memory': all_zero,
'zero_memory_note': '所有算子内存占用均为 0,可能未开启 profile_memory 采集或为 NPU vs NPU 无内存差异场景' if all_zero else None,
}
def parse_compare(wb, top_op_names=None) -> dict:
"""MemoryCompare 内存明细比对"""
headers, rows = get_sheet_data(wb, 'MemoryCompare')
if not rows:
return {'sheet_name': 'MemoryCompare', 'available': False, 'reason': 'Sheet不存在或为空'}
all_details = []
for row in rows:
if len(row) < 13:
continue
base_name = row[1].strip() if row[1] else ''
comp_name = row[6].strip() if row[6] else ''
op_name = base_name or comp_name
if not op_name:
continue
all_details.append({
'order': row[0],
'base_name': base_name,
'base_shape': row[2],
'base_type': row[3],
'base_details': row[4],
'base_size': safe_float(row[5]),
'comp_name': comp_name,
'comp_shape': row[7],
'comp_type': row[8],
'comp_details': row[9],
'comp_size': safe_float(row[10]),
'diff_size': safe_float(row[11]),
'diff_ratio': safe_float(row[12]),
})
if top_op_names:
top_set = set(top_op_names)
filtered = [d for d in all_details if d['base_name'] in top_set or d['comp_name'] in top_set]
else:
all_details.sort(key=lambda x: x['diff_size'], reverse=True)
filtered = all_details[:10]
return {
'sheet_name': 'MemoryCompare',
'available': True,
'total_rows': len(all_details),
'top_details': filtered[:10],
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |