Skip to content

Ascend/msagent / skills/profiler/ascend-profiler-data-validation

ascend-profiler-data-validation

Verified

当用户提供 MindStudio profiler 采集的性能数据(框架 profiler、msprof 命令行)时,对数据完整性、采集状态及关键配置进行校验,确保后续分析工具能正常运行。

FileKindSize
SKILL.mdskill md5.0 KB
scripts/offline_parse_mindspore.pyscript1.4 KB
scripts/offline_parse_pytorch.pyscript1.5 KB

scripts/offline_parse_pytorch.py

View on GitHub
"""Offline parser for Ascend PyTorch Profiler data (_ascend_pt)."""
import argparse
import os
import shutil
import sys


def _check_msprof() -> None:
    """Ensure msprof is in PATH; required by CANN/profiler analyse."""
    if shutil.which("msprof") is None:
        print(
            "Error: msprof command not found. Please source the correct CANN environment, e.g.:\n"
            "  source /usr/local/Ascend/ascend-toolkit/set_env.sh"
        )
        sys.exit(1)


def main() -> None:
    parser = argparse.ArgumentParser(
        description="Offline parser for Ascend PyTorch Profiler data (_ascend_pt)."
    )
    parser.add_argument(
        "profiler_path",
        type=str,
        help="Path to the profiler result directory (e.g., ./result_data)",
    )
    args = parser.parse_args()

    profiler_path = args.profiler_path
    if not os.path.exists(profiler_path):
        print(f"Error: Profiler path '{profiler_path}' does not exist.")
        sys.exit(1)

    _check_msprof()

    try:
        from torch_npu.profiler.profiler import analyse
    except ImportError as e:
        print(f"Error: torch_npu not installed or analyse unavailable: {e}")
        sys.exit(1)

    print(f"Starting offline analysis for: {profiler_path}")
    try:
        analyse(profiler_path=profiler_path)
        print("Analysis completed successfully.")
    except Exception as e:
        print(f"Error during analysis: {e}")
        sys.exit(1)


if __name__ == "__main__":
    main()
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 193kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 193kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 193kUpdated Claude CodeCodexVerifiedInstall