pyqcu-cpp-qcu
当任务涉及 cpp/cuda/qcu 的 CUDA 内核、MPI halo、MultiGrid 或 C++ 参数与显存生命周期时使用。
Skill by ZhangXin8069
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/zhangxin8069-pyqcu-cpp-qcu
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/pyqcu-cpp-qcu
What's inside
- Skill name
pyqcu-cpp-qcu- Description
- 当任务涉及 cpp/cuda/qcu 的 CUDA 内核、MPI halo、MultiGrid 或 C++ 参数与显存生命周期时使用。
- License
- MIT
- Instructions
- 192 lines in SKILL.md · view on GitHub
Files (2)
- AGENTS.md
- SKILL.md
SKILL.md (first lines)
# cpp/cuda/qcu
Primary C++ CUDA backend for PyQCU. Hand-tuned CUDA kernels with MPI halo exchange for Wilson/Clover Dirac operators, BiStabCG/CG solvers, multigrid, and gauge field generation.
Production execution topology is fixed:
```text
one Python process = one MPI rank = one GPU/DCU/GPGPU
```
Cross-device solves use MPI domain decomposition and C++ halo/global-reduction
paths. The Python-level `pyqcu.cuda._multi_gpu.MultiGpuMultigrid` driver is a
test-only, explicitly constructed exception and must not be used as the default
template for new CUDA programs.
Normative project rules:
[`docs/cuda_execution_topology.md`](../../docs/cuda_execution_topology.md).
## Build
```bash
source ./env.sh # CUDA toolkit paths, MPI, etc.
bash ./make.sh # symlinks CMakeLists-nv.txt → CMakeLists.txt, then cmake + make
```
Output: `libqcu.so` — dynamically linked library loaded by the Cython bridge.
CMake 默认自动使用 `env.sh` 探测到的 GPU compute capability(cubin + PTX),
不需要为单一 GPU 型号锁死架构;V100 生产基准仍可显式设置:
```bash
QCU_CUDA_ARCHITECTURES='70-real;70-virtual' bash ./build.sh
cuobjdump --list-elf cpp/cuda/qcu/libqcu.so | head
```
`cuobjdump` 必须显示 `sm_70.cubin`,而不是仅显示 `sm_60.cubin`。不要把
sm_60 JIT 与 sm_70 native 的 solve 数字混在同一速度比中;至少记录
`QCU_CUDA_ARCHITECTURES`、libqcu SHA256 和实际 `cuobjdump` 架构。当前
V100 side-only 复测中 sm70 大 c64 为 `0.657074 s`、大 c128 为
`2.062569 s`;随后 full formal 独立复测大 c64 为 `0.655570 s`。
sm70 相对默认 sm60 JIT 改善有限,但必须保留架构 provenance。
benchmark worker 已自动写入 `provenance.pyqcu_library`;不要依赖口头
记录或只看 `LD_LIBRARY_PATH`。
## Source Organization
```
include/ — 24 header files (templated C++ with CUDA kernels inline)
├── define.h — Parameter index constants (must mirror pyqcu/cuda/define.py)
├── include.h — 系统/第三方头聚合(cuda/cublas/curand/mpi/chrono/...)
├── lattice_complex.h — Complex number arithmetic (operator*= was fixed for overwrite bug)
├── lattice_set.h — Lattice geometry, grid layout, site indexing
├── lattice_cuda.h — CUDA utility functions (stream management, etc.)
├── lattice_mpi.h — MPI halo exchange helpers (blocking Sendrecv)
├── qcu.h — Top-level include aggregator
├── dslash.h — Dslash dispatch
├── wilson_dslash.h — Wilson dslash kernel
├── clover_dslash.h — Clover dslash entry
├── lattice_wilson_dslash.h — Wilson dslash implementation
├── lattice_clover_dslash.h — Clover dslash implementation
├── bistabcg.h — BiCGStab algorithm (GPU kernels)
├── cg.h — Conjugate gradient algorithm
├── lattice_wilson_bistabcg.h — Wilson BiStabCG solver
├── lattice_wilson_cg.h — Wilson CG solver
├── lattice_clover_bistabcg.h — Clover BiStabCG solver
├── lattice_sap.h — SAP(Schwarz 交替过程)mask/update 内核,5-stream MG 的平滑器
├── multigrid.h — MG restrict/prolong/coarse-dslash
├── lattice_multigrid.h — MG implementation
├── lattice_clover_multigrid.h — Clover multigrid solver(5745 行,5-stream 架构)
├── laplacian.h / lattice_laplacian.h — Laplacian operator
└── gauss_gauge.h — Gaussian gauge field generation
src/ — 32 个 .cu 文件:#include 对应头并做模板实例化与启动封装
python/
└── pyqcu.h — C API declarations (extern "C",37 个入口); must match pyqcu/cuda/qcu/qcu_api.pxd
```
## Parameter Protocol
Parameters are passed from Python as flat arrays. Index constants in `include/define.h` must stay in sync with `pyqcu/cuda/define.py`:
- **`params`** (CPU int32[58]): lattice dims, grid sizes, data types, iteration counts, plan selection, MG level configs and controls. Slots 54–57 are `_MG_USE_GCR_`, `_MG_USE_DEFLATE_`, `_MG_MU_PRE_`, and `_MG_USE_INIT_GUESS_`; slot 57 is the 0/1 warm-start flag and the ABI remains length 58.
- **`argv`** (real[8]): mass, atol, sigma, MG tolerances, csw;c64 为 float32,
c128 为 float64。csw 位于槽 7,Clover 系数为 `-kappa*csw/8`。
- **`set_ptrs`** (CPU int64[100]): LatticeSet/scratch pointers. Per strict transition `t`, slots `60+4*t+0..3` are blocked `V`, optional raw `Y`, `Yhat`, and onsite pair `(X,X^-1)`; slot `80` is the persistent hierarchy handle.
`_SET_PLAN_` (params[16]) selects the kernel plan:
- `-2` = Laplacian, `-1` = Gauss gauge, `0` = Wilson dslash, `1` = BiStabCG/CG, `2` = Clover dslash
## Strict QUDA-style MultiGrid
The strict path is parallel to the retained legacy MG implementation. Select it with `hierarchy_mode="strict"` or `StrictMultigrid`; `setup_operator="schur"` belongs to the legacy compact odd-Schur path and is not a synonym for Strict. The currently supported all-level mode is `coarse_grid_solution_type=matpc` with `smoother_solve_type=direct_pc`. At level `l`, split the full operator as
\[
D_l=X_l+H_l,\qquad \widehat D_l=X_l^{-1}D_l,\qquad
D_{l+1}=R_l\widehat D_lP_l.
\]
The full/raw coarse onsite block and directional links are dense
\(E\times E\) matrices, not \(SU(3)\) links:
\[
X_C(X)=\sum_{x\in\mathcal A_X}V_X^\dagger C V_X,
\]
\[
Y^{\rm f}_{\mu}(X)=-\kappa\sum_{x\in\mathcal A_X}
(AV_X)^\dagger U_\mu V_{X+\hat\mu},
\]
\[
Y^{\rm b}_{\mu}(X-\hat\mu)=-\kappa\sum_{x\in\mathcal A_X}
V_X^\dagger U^\dagger_\mu AV_{X-\hat\mu},
\]
where \(AV=C^{-1}V\) for Clover-PC and \(AV=V\) for the raw path.
For a Wilson-like operator the onsite contribution also includes the
identity \(I_E\); a coarse-to-coarse construction projects the current
\(X_\ell\), not the fine Clover tensor. In the current Strict left-
preconditioned path, \(AV\) is constructed first and the coarse local
operator is based on \(X_f^{-1}D_f\); therefore \(V^\dagger CV\) describes
the full/raw Clover construction and must not be stated as an unconditional
formula for the Strict PC path.
The raw coarse action isFrom ZhangXin8069/PyQCU, MIT.
More from ZhangXin8069/PyQCU
- 0.611score
pyqcu-docs
ZhangXin8069
当需要定位 PyQCU 的权威项目文档、把 docs/ 内容提取或同步到 skills/、查询安装/ 环境/维度/测试入口、判断正式文档与阶段报告的生命周期,或追踪 CUDA、MultiGrid、 KUPL、benchmark 与 profiler 知识来源时使用。
SkillAFreshness: A★ 4Claude Code +9 - 0.608score
pyqcu-report
ZhangXin8069
当用户要求制作或修改 PyQCU 中文横版 Beamer、竖版完整讲稿或同源 PPTX, 或说“做汇报 PPT”“生成讲稿”“横版改 LaTeX”“补充公式/算法页”时使用。 纯性能基准、算法分析或代码修复任务不使用本技能。
SkillAFreshness: A★ 4Claude Code +9 - 0.606score
pyqcu-kupl
ZhangXin8069
当维护或验证 cpp/kupl/qcu、pyqcu.kupl、pyqcu/testing/kupl,处理鲲鹏/NUMA CPU 版 QCU,MPI+OpenMP Wilson/Clover dslash、Clover BiStabCG、csw、 Wilson BiStabCG/CG、3D…
SkillAFreshness: A★ 4Claude Code +9 - 0.606score
pyqcu-md-tex-sync
ZhangXin8069
{除非用户明确要求,否则不启用}。仅当当前用户明确点名 `pyqcu-md-tex-sync` / `~pyqcu-md-tex-sync`(或全局 `md-tex-sync`),或明确要求 Markdown 与 LaTeX/PDF 同源维护、双格式同步交付、全文全集与全附件归档时使用;普通…
SkillAFreshness: A★ 4Claude Code +9 - 0.605score
pyqcu-benchmark
ZhangXin8069
当需要运行或解释 PyQCU/QCU/QUDA 性能基准、公平计时、显存或容量证据时使用。
SkillAFreshness: A★ 4Claude Code +9 - 0.603score
pyqcu-cpp-qcu-include
ZhangXin8069
当任务涉及 cpp/cuda/qcu/include、模板化 CUDA 头文件或 define.h/define.py 同步时使用。
SkillAFreshness: A★ 4Claude Code +9 - 0.603score
pyqcu-dslash
ZhangXin8069
当任务涉及 pyqcu.torch.dslash、Wilson/Clover dslash、hopping/sitting/operator 或奇偶预处理时使用。
SkillAFreshness: A★ 4Claude Code +9 - 0.603score
pyqcu-cpp-qcu-python
ZhangXin8069
当任务涉及 cpp/cuda/qcu/python、C API、qcu_api.pxd、qcu.pyx 或 qcu.pyi 同步时使用。
SkillAFreshness: A★ 4Claude Code +9 - 0.603score
pyqcu-api
ZhangXin8069
当任务涉及 pyqcu.api、后端无关配置/结果/能力/资产 manifest、公共 Protocol 或 Multigrid.solve_result 兼容层时使用。
SkillAFreshness: A★ 4Claude Code +9 - 0.603score
pyqcu-cuda
ZhangXin8069
当任务涉及 pyqcu.cuda、libqcu.so Cython 桥、params/argv/set_ptrs ABI 或 CUDA 显存生命周期时使用。
SkillAFreshness: A★ 4Claude Code +9 - 0.603score
pyqcu-cann
ZhangXin8069
当任务涉及 pyqcu.cann、Ascend/NPU 复数兼容层、force_use_npu 或复数 einsum 分解时使用。
SkillAFreshness: A★ 4Claude Code +9 - 0.603score
pyqcu-form
ZhangXin8069
当用户要求审计或整改 PyQCU 的命名、目录结构、代码框架、文档、日志、数据、 测试布局、仓库清洁度与 Git 交付格式时使用;入口为 `~form` 或 `form`。
SkillAFreshness: A★ 4Claude Code +9
Signals
- Stars
- 4
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 22, 2026 (6 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/ZhangXin8069/PyQCU
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from ZhangXin8069
- 0.611score
pyqcu-docs
ZhangXin8069
当需要定位 PyQCU 的权威项目文档、把 docs/ 内容提取或同步到 skills/、查询安装/ 环境/维度/测试入口、判断正式文档与阶段报告的生命周期,或追踪 CUDA、MultiGrid、 KUPL、benchmark 与 profiler 知识来源时使用。
SkillAFreshness: A★ 4Claude Code +9 - 0.608score
pyqcu-report
ZhangXin8069
当用户要求制作或修改 PyQCU 中文横版 Beamer、竖版完整讲稿或同源 PPTX, 或说“做汇报 PPT”“生成讲稿”“横版改 LaTeX”“补充公式/算法页”时使用。 纯性能基准、算法分析或代码修复任务不使用本技能。
SkillAFreshness: A★ 4Claude Code +9 - 0.606score
pyqcu-kupl
ZhangXin8069
当维护或验证 cpp/kupl/qcu、pyqcu.kupl、pyqcu/testing/kupl,处理鲲鹏/NUMA CPU 版 QCU,MPI+OpenMP Wilson/Clover dslash、Clover BiStabCG、csw、 Wilson BiStabCG/CG、3D…
SkillAFreshness: A★ 4Claude Code +9 - 0.606score
pyqcu-md-tex-sync
ZhangXin8069
{除非用户明确要求,否则不启用}。仅当当前用户明确点名 `pyqcu-md-tex-sync` / `~pyqcu-md-tex-sync`(或全局 `md-tex-sync`),或明确要求 Markdown 与 LaTeX/PDF 同源维护、双格式同步交付、全文全集与全附件归档时使用;普通…
SkillAFreshness: A★ 4Claude Code +9 - 0.605score
pyqcu-benchmark
ZhangXin8069
当需要运行或解释 PyQCU/QCU/QUDA 性能基准、公平计时、显存或容量证据时使用。
SkillAFreshness: A★ 4Claude Code +9 - 0.603score
pyqcu-cpp-qcu-include
ZhangXin8069
当任务涉及 cpp/cuda/qcu/include、模板化 CUDA 头文件或 define.h/define.py 同步时使用。
SkillAFreshness: A★ 4Claude Code +9
Cite this page
pyqcu-cpp-qcu skill. Agent Mart. https://agentmart.dev/skills/zhangxin8069-pyqcu-cpp-qcu (last updated 2026-10-24)