Command Palette

Search for a command to run...

Назад к скиллам
скилл № 45796

cpp-hpc-optimization

Evidence-driven C++ high-performance computing design, profiling, and optimization across algorithmic time/space complexity, data layout, cache and memory…

БесплатноБез исполняемых скриптов
archibateот archibate★ 42 звезды на GitHub

Установить cpp-hpc-optimization в Claude Code и Claude Desktop

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

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

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

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

C++ HPC Optimization

Optimize the measured data path, not the code that merely looks low-level. Preserve a simple reference implementation and make every optimization earn its complexity with correctness evidence and a representative benchmark.

Non-negotiable rules

  1. Define the contract first. Record inputs, sizes, distributions, target hardware, accuracy, determinism, memory, latency, and throughput objectives.
  2. Pass the complexity gate. Compare the best practical algorithmic families for the actual size range before tuning constants inside one family.
  3. Profile before kernel redesign. Identify the hot path with end-to-end evidence.
  4. Keep an oracle. Retain a scalar or otherwise obviously-correct reference implementation and compare every optimized path against it.
  5. Model before tuning. Estimate useful operations, bytes transferred, working set, dependency depth, synchronization, and launch overhead.
  6. Change one axis at a time. Measure after each transformation and revert changes that do not win on the target workload.
  7. Never encode a benchmark accident as a law. Cache sizes, SIMD width, thread count, tile size, padding, and crossover thresholds are target- and workload-dependent.
  8. Make ISA requirements explicit. Use feature dispatch and a compatible fallback when targets vary, or a verified fixed ISA for controlled deployments. Both require tail handling and equivalence tests.

Workflow

1. Frame the performance contract

Write down:

  • the semantic result and accepted numerical error;
  • representative and adversarial input shapes and distributions;
  • steady-state throughput, single-item latency, tail latency, or deadline;
  • memory-footprint and allocation constraints;
  • target CPUs, accelerators, compilers, build flags, and deployment topology;
  • whether batching, reordering, nondeterministic reductions, or preprocessing are permitted.

Do not optimize an unspecified target. Throughput and latency often demand opposite choices: batching and deep queues improve throughput but add waiting.

2. Pass the algorithmic time/space complexity gate

Before applying cache, SIMD, threading, or instruction-level techniques:

  • identify lower bounds and the best mature practical algorithm families for the declared sizes, distributions, sparsity, dimensionality, accuracy, update/query ratio, and number of timesteps or solves;
  • compare total time, peak/live space, preprocessing, communication, numerical behavior, worst/expected cases, and implementation maturity;
  • benchmark crossover regions and retain a size/shape-dependent portfolio when different algorithms win in different regimes.

An asymptotically better method may lose at small n; an asymptotically worse regular kernel may exploit the target exceptionally well. Conversely, no amount of constant-factor kernel tuning rescues an avoidable complexity class at scale. Choose the industrially useful family for the declared range first, then use the rest of this skill to reduce its realized cost. Preserve the declared semantic or numerical contract; optimization need not be bit-exact when the contract permits an approximate, reordered, or mixed-precision algorithm.

3. Establish correctness and measurement baselines

  • Build a readable reference path before intrinsics, lossy precision, relaxed math, or concurrency.
  • Create correctness tests covering empty, tiny, tail, misaligned, extreme, NaN/Inf, sparse/dense, and aliasing cases that the contract permits.
  • Benchmark the actual hot operation with realistic data. Warm up, prevent dead-code elimination, report distribution rather than one lucky sample, and retain end-to-end measurements beside microbenchmarks.
  • Inspect generated code and compiler optimization remarks before assuming the compiler failed.

Read references/profiling-and-cost-model.md before profiling, benchmarking, or declaring a bottleneck.

4. Classify the limiting resource

Calculate at least an approximate per-item model:

  • useful operations and transcendental/divide cost;
  • compulsory input, output, metadata, and intermediate bytes;
  • working-set size at each reuse distance;
  • independent operations versus loop-carried dependency chains;
  • tasks, locks, atomics, barriers, launches, copies, and queue transitions;
  • scaling versus threads, vector width, batch size, and problem size.

Classify the current regime as memory-bandwidth, cache-capacity/latency, compute/issue, dependency-latency, synchronization, task-granularity, launch, or transfer bound. A kernel can move between regimes after each optimization.

5. Evaluate change scope and ROI

Record the currently authorized edit boundary, but do not mistake it for the root-cause boundary. When evidence places the limiting work upstream or in data representation, ownership, or construction, compare:

  • the best optimization inside the current boundary;
  • the smallest upstream
Полный SKILL.md на GitHub

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

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

Без ограничений — скилл может использовать любой инструмент.

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

  • LICENSE
  • agents/openai.yaml
  • references/accelerator-throughput.md
  • references/allocation-and-memory-resources.md
  • references/data-layout-and-memory.md
  • references/hotpath-polymorphism.md
  • references/numerics-and-quantization.md
  • references/parallel101-case-studies.md
  • references/parallel101/course/04/3_pointers/01_pointer_aliasing/main.cpp
  • references/parallel101/course/04/3_pointers/02_restrict_pointer/main.cpp
  • references/parallel101/course/04/5_loops/01_worry_pointer_aliasing/main.cpp
  • references/parallel101/course/04/5_loops/02_no_pointer_aliasing/main.cpp
  • references/parallel101/course/04/5_loops/04_no_pointer_aliasing_ivdep/main.cpp
  • references/parallel101/course/04/5_loops/06_loop_with_external_call/main.cpp
  • references/parallel101/course/04/5_loops/07_loop_with_inlineable_call/main.cpp
  • references/parallel101/course/04/5_loops/08_loop_with_random_access/main.cpp
  • references/parallel101/course/04/5_loops/09_loop_with_skip_access/main.cpp
  • references/parallel101/course/04/5_loops/10_loop_with_ordered_access/main.cpp
  • references/parallel101/course/04/5_loops/11_loop_invariant_motion/main.cpp
  • references/parallel101/course/04/5_loops/12_loop_invariant_failed/main.cpp
  • references/parallel101/course/04/5_loops/13_loop_unrolling/main.cpp
  • references/parallel101/course/04/6_structs/01_vec2_simd_ok/main.cpp
  • references/parallel101/course/04/6_structs/02_vec3_simd_fail/main.cpp
  • references/parallel101/course/04/6_structs/03_vec3_with_padding_ok/main.cpp
  • references/parallel101/course/04/6_structs/04_vec3_with_alignas_ok/main.cpp
  • references/parallel101/course/04/6_structs/05_vec3_aos/main.cpp
  • references/parallel101/course/04/6_structs/06_vec3_soa/main.cpp
  • references/parallel101/course/04/6_structs/07_vec3_aosoa/main.cpp
  • references/parallel101/course/04/6_structs/08_benchmark/aos.cpp
  • references/parallel101/course/04/6_structs/08_benchmark/aos_aligned.cpp
  • references/parallel101/course/04/6_structs/08_benchmark/aos_parallel.cpp
  • references/parallel101/course/04/6_structs/08_benchmark/aosoa.cpp
  • references/parallel101/course/04/6_structs/08_benchmark/common.h
  • references/parallel101/course/04/6_structs/08_benchmark/main.cpp
  • references/parallel101/course/04/6_structs/08_benchmark/profile.h
  • references/parallel101/course/04/6_structs/08_benchmark/soa.cpp
  • references/parallel101/course/04/6_structs/08_benchmark/soa_parallel.cpp
  • references/parallel101/course/04/6_structs/08_benchmark/soa_simd.cpp
  • references/parallel101/course/04/6_structs/08_benchmark/soa_size_t.cpp
  • references/parallel101/course/04/6_structs/08_benchmark/soa_unroll.cpp

FAQ

Что делает скилл cpp-hpc-optimization?

Evidence-driven C++ high-performance computing design, profiling, and optimization across algorithmic time/space complexity, data layout, cache and memory behavior, numerics, SIMD, multicore scheduling, and CPU/accelerator pipelines. Use before designing or changing computation-intensive kernels, high-throughput data structures, performance-critical loops, SIMD/OpenMP/TBB/CUDA code, mixed-precision or sparse representations, or when investigating throughput, latency, scaling, cache, bandwidth, compiler-vectorization, or profiling problems.

Как установить скилл cpp-hpc-optimization?

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

Скилл cpp-hpc-optimization запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить cpp-hpc-optimization с