hpc-petsc
Build, review, debug, and tune PETSc-based solver workflows. Use when working with PETSc `Vec`, `Mat`, `KSP`, `PC`, `SNES`, `TS`, options-database tuning, MPI-distributed assembly, external package integration, or PETSc build and runtime failures.
- License 许可
- MIT
- 最近更新
- 2026-11-09
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- hpc-petsc
- risk
- low
- domain
- high-performance-computing
- source
- { "commit": "4ea8069188", "license": "MIT", "repository": "SciMate-AI/HPC-Skills", "imported_at": "2026-09-20" }
- license
- MIT
- version
- 1.0.0
- category
- high-performance-computing
- platforms
- [ "claude-code", "cursor", "codex", "gemini", "antigravity", "copilot" ]
- subdomain
- general
- description
- Build, review, debug, and tune PETSc-based solver workflows. Use when working with PETSc `Vec`, `Mat`, `KSP`, `PC`, `SNES`, `TS`, options-database tuning, MPI-distributed assembly, external package integration, or PETSc build and runtime failures.
02 资源文件 15
- 资产文件assets/templates/ksp_poisson_minimal.c1.3 KB
- 脚本assets/templates/petsc_build_example.sh589 B
- 脚本assets/templates/petsc_ksp_slurm.sh428 B
- 脚本assets/templates/petsc4py_ksp_minimal.py619 B
- 参考文档references/build-and-integration.md1.5 KB
- 参考文档references/dm-and-discretization-playbook.md860 B
- 参考文档references/error-pattern-dictionary.md1.1 KB
- 参考文档references/error-recovery.md1.0 KB
- 参考文档references/external-backend-matrix.md1.4 KB
- 参考文档references/ksp-and-pc-matrix.md1.4 KB
- 参考文档references/options-and-ksp-snes-playbook.md2.3 KB
- 参考文档references/parallel-and-runtime-debugging.md1.6 KB
- 参考文档references/runtime-option-matrix.md1.4 KB
- 参考文档references/snes-and-ts-patterns.md1.0 KB
- 参考文档references/solver-stack-and-object-model.md2.3 KB
03 SKILL.md 正文
HPC PETSc
Treat PETSc as a layered solver toolkit. Start from the highest-level object that matches the mathematical problem and only drop lower when there is a clear reason.
Start
- Read
references/solver-stack-and-object-model.mdbefore creating or repairing a PETSc-based solve path. - Read
references/ksp-and-pc-matrix.mdwhen selecting Krylov methods, direct solves, or preconditioner families. - Read
references/snes-and-ts-patterns.mdwhen the application is nonlinear or time-dependent. - Read
references/options-and-ksp-snes-playbook.mdwhen translating runtime options into code or debugging prefix handling. - Read
references/runtime-option-matrix.mdwhen selecting monitors, residual diagnostics, or common options-database switches. - Read
references/dm-and-discretization-playbook.mdwhenDM, nullspaces, multigrid layout, or field decomposition matter. - Read
references/external-backend-matrix.mdwhen deciding whether to route through HYPRE, direct solvers, or matrix-free paths. - Read
references/build-and-integration.mdwhen configuring PETSc, enabling external packages, or integrating PETSc into another codebase. - Read
references/parallel-and-runtime-debugging.mdwhen a distributed run shows assembly, ownership, convergence, or monitoring problems. - Read
references/error-recovery.mdwhen configure, setup, or solve phases fail.
Work sequence
- Classify the problem first:
- linear system ->
KSP - nonlinear residual ->
SNES - time-dependent problem ->
TS
- linear system ->
- Choose the data model before tuning the solver:
Vecfor distributed unknownsMator matrix-free operator for the linearizationDMwhen mesh, hierarchy, or field layout must drive assembly and coarsening
- Get a robust baseline solve working before tuning for scale.
- Move configuration into the options database whenever practical so runs stay inspectable and reproducible.
- Read convergence reason and monitor output before changing algorithms.
Guardrails
- Do not hand-roll nonlinear or time-stepping logic that
SNESorTSalready manages unless the application truly needs it. - Do not tune preconditioners before checking operator correctness, boundary conditions, and assembly completion.
- Do not mix compiler, MPI, and external solver stacks casually across PETSc and the host application.
- Do not treat options prefixes or convergence reasons as optional diagnostics.
Additional References
Load these on demand:
references/ksp-and-pc-matrix.mdfor operator-class to solver-family mappingreferences/snes-and-ts-patterns.mdfor nonlinear and transient workflow designreferences/runtime-option-matrix.mdfor monitor, logging, and option-database baselinesreferences/dm-and-discretization-playbook.mdforDMDA,DMPlex, field splits, and hierarchy-aware setupreferences/external-backend-matrix.mdfor HYPRE, direct-solver, and matrix-free integration tradeoffsreferences/build-and-integration.mdfor external package wiring such as HYPRE or direct-solver backendsreferences/parallel-and-runtime-debugging.mdfor ownership ranges, assembly ordering, monitors, and distributed diagnosticsreferences/error-pattern-dictionary.mdfor fast matching of common PETSc failure classes
Reusable Templates
Use assets/templates/ when a concrete starting point is faster than rebuilding the solve path from scratch, especially:
ksp_poisson_minimal.cpetsc4py_ksp_minimal.pypetsc_build_example.shpetsc_ksp_slurm.sh
Outputs
Summarize:
- problem class and chosen PETSc layer
- matrix or operator strategy
- solver and preconditioner baseline
- runtime options or code-path decisions
- the exact failure phase if the workflow is being repaired
04 同仓库更多 Skills
dei-assessment
Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.
dei-action-plan
Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.
culture-fit-assessment
Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.
cowork-to-code-bridge
Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.
counter-offer-response
Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.
continuous-feedback-system
Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.