Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

performance-profiling

БесплатноЗапускает вложенные скриптыНе проверен

Identify computational bottlenecks, analyze parallel scaling, estimate memory requirements, and generate optimization recommendations for materials…

HeshamFSот HeshamFS★ 95 звёзд на GitHub1 установка в других каталогах

Об этом скилле

Performance Profiling

Goal

Provide tools to analyze simulation performance, identify bottlenecks, and recommend optimization strategies for computational materials science simulations.

Requirements

  • Python 3.10+
  • No external dependencies (uses Python standard library only)
  • Works on Linux, macOS, and Windows

Inputs to Gather

Before running profiling scripts, collect from the user:

Input Description Example
Simulation log Log file with timing information simulation.log
Scaling data JSON with multi-run performance data scaling_data.json
Simulation parameters JSON with mesh, fields, solver config params.json
Available memory System memory in GB (optional) 16.0

Decision Guidance

When to Use Each Script

Need to identify slow phases?
├── YES → Use timing_analyzer.py
│         └── Parse simulation logs for timing data
│
Need to understand parallel performance?
├── YES → Use scaling_analyzer.py
│         └── Analyze strong or weak scaling efficiency
│
Need to estimate memory requirements?
├── YES → Use memory_profiler.py
│         └── Estimate memory from problem parameters
│
Need optimization recommendations?
└── YES → Use bottleneck_detector.py
          └── Combine analyses and get actionable advice

Choosing Analysis Thresholds

Metric Good Acceptable Poor
Phase dominance <30% 30-50% >50%
Parallel efficiency >0.80 0.70-0.80 <0.70
Memory usage <60% 60-80% >80%

Script Outputs (JSON Fields)

All scripts wrap their payload in a top-level object with two keys: inputs and results. The fields below live under results.

Script Key Outputs (under results)
timing_analyzer.py results.phases, results.slowest_phase, results.total_time
scaling_analyzer.py results.results, results.efficiency_threshold_processors, results.average_efficiency, results.baseline
memory_profiler.py results.total_memory_gb, results.per_process_gb, results.field_memory_gb, results.solver_workspace_gb, results.matrix_storage_gb, results.warnings
bottleneck_detector.py results.bottlenecks, results.recommendations

Workflow

Complete Profiling Workflow

  1. Analyze timing from simulation logs
  2. Analyze scaling from multi-run data (if available)
  3. Profile memory from simulation parameters
  4. Detect bottlenecks and get recommendations
  5. Implement optimizations based on recommendations
  6. Re-profile to verify improvements

Quick Profiling (Timing Only)

  1. Run timing analyzer on simulation log
  2. Identify dominant phases (>50% of runtime)
  3. Apply targeted optimizations to dominant phases

CLI Examples

Timing Analysis

# Basic timing analysis
python3 scripts/timing_analyzer.py \
    --log simulation.log \
    --json

# Custom timing pattern
python3 scripts/timing_analyzer.py \
    --log simulation.log \
    --pattern 'Step\s+(\w+)\s+took\s+([\d.]+)s' \
    --json

Scaling Analysis

# Strong scaling (fixed problem size)
python3 scripts/scaling_analyzer.py \
    --data scaling_data.json \
    --type strong \
    --json

# Weak scaling (constant work per processor)
python3 scripts/scaling_analyzer.py \
    --data scaling_data.json \
    --type weak \
    --json

Memory Profiling

# Estimate memory requirements
python3 scripts/memory_profiler.py \
    --params simulation_params.json \
    --available-gb 16.0 \
    --json

Bottleneck Detection

# Detect bottlenecks from timing only
python3 scripts/bottleneck_detector.py \
    --timing timing_results.json \
    --json

# Comprehensive analysis with all inputs
python3 scripts/bottleneck_detector.py \
    --timing timing_results.json \
    --scaling scaling_results.json \
    --memory memory_results.json \
    --json

Conversational Workflow Example

User: My simulation is taking too long. Can you help me identify what's slow?

Agent workflow:

  1. Ask for simulation log file
  2. Run timing analyzer:
    python3 scripts/timing_analyzer.py --log simulation.log --json
    
  3. Interpret results (the detector flags solver/assembly phases above 50% and I/O phases above 30%; >70% is high severity):
    • If solver dominates (>50%, high above 70%): Recommend preconditioner tuning
    • If assembly dominates (>50%): Recommend caching or vectorization
    • If I/O dominates (>30%): Recommend reducing output frequency
  4. If user has multi-run data, analyze scaling:
    python3 scripts/scaling_analyzer.py --data scaling.json --type strong --json
    
  5. Generate comprehensive recommendations:
    python3 scripts/bottleneck_detector.py --timing timing.json --scaling scaling.json --json
    

Interpretation Guidance

Timing Analysis

The detector applies per-type

Полный SKILL.md на GitHub

Установить performance-profiling в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Grep
Glob

Вложенные файлы

CHANGELOG.mdevals/evals.jsonevals/files/custom_format.logevals/files/memory_params.jsonevals/files/scaling.jsonevals/files/scaling_results.jsonevals/files/simulation.logevals/files/timing.jsonreferences/optimization_strategies.mdreferences/profiling_guide.mdscripts/bottleneck_detector.pyscripts/memory_profiler.pyscripts/scaling_analyzer.pyscripts/timing_analyzer.py

FAQ

Что делает скилл performance-profiling?

Identify computational bottlenecks, analyze parallel scaling, estimate memory requirements, and generate optimization recommendations for materials simulations — parse timing logs to find dominant phases (solver, assembly, I/O), evaluate strong and weak scaling efficiency, profile memory from mesh and field parameters, and detect bottlenecks with actionable fix suggestions. Use when a simulation is running slower than expected, investigating MPI scaling efficiency, planning HPC resource allocation, deciding whether to tune the preconditioner or reduce I/O frequency, or estimating if a problem fits in available RAM, even if the user only says "my simulation is too slow" or "how many nodes do I need."

Как установить скилл performance-profiling?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл performance-profiling запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить performance-profiling с