用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ZhangXin8069/PyQCU --skill lattice命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
PyQCU 性能基准 skill:覆盖 examples/benchmark 的通用基准,以及 dev87 strict MultiGrid 对 QUDA 的可复现公平计时与显存口径。
pyqcu.cuda 目录的完整生成 skill:C++ CUDA 后端(libqcu.so)的 Cython 桥接包;含 strict QUDA-style MultiGrid、params/argv/set_ptrs 参数协议与显存生命周期约束。
cpp/cuda/qcu/include 目录的完整生成 skill:26 个模板化 CUDA 头文件(内核内联),define.h 须镜像 pyqcu/cuda/define.py。
正在显示 SKILL.md
| name | lattice |
| description | pyqcu.lattice 目录的完整生成 skill:gamma/Gell-Mann 矩阵、SU(3) 检查、规范场生成与 Ward 负索引约定。 |
Lattice QCD fundamentals: gamma matrices, Gell-Mann matrices, SU(3) group utilities, and gauge field generation.
gamma — 4×4×4 gamma matrices γ₀, γ₁, γ₂, γ₃ in the Dirac-Pauli representation (γ₀ anti-hermitian, γ_i hermitian). Shape [4, 4, 4].gamma_5 — γ₅ = γ₀γ₁γ₂γ₃. Shape [4, 4].gamma_gamma — six γ_μ γ_ν products: [γ_x,γ_y], [γ_x,γ_z], [γ_x,γ_t], [γ_y,γ_z], [γ_y,γ_t], [γ_z,γ_t]. Shape [6, 4, 4]. Used as σ_{μν} matrices in the clover term.I — 4×4 identity matrix (complex64)minus_I — −I (precomputed)gell_mann — eight Gell-Mann matrices λ₁…λ₈ (SU(3) generators, traceless hermitian). Shape [8, 3, 3]. λ₁,λ₄,λ₆ are real; λ₂,λ₅,λ₇ are i×real.Ward indices use negative indexing because spacetime dimensions are always the last four axes (...xyzt layout):
wards['x'] = -4 # last 4th axis
wards['y'] = -3 # last 3rd axis
wards['z'] = -2 # last 2nd axis
wards['t'] = -1 # last axis
wards['t_p'] = -1 # parity-split temporal (same index as t)
This makes indexing robust regardless of prefix dimensions (spin, color, parity, etc.).
ward_keys = ['x', 'y', 'z', 't'] — standard 4D directionsward_p_keys = ['x', 'y', 'z', 't_p'] — parity-aware (t_p for temporal with even/odd mask)ward_ward_keys = ['xy', 'xz', 'xt', 'yz', 'yt', 'zt'] — 6 plane directions for cloverward_wards['xy'] = {'mu': -4, 'nu': -3, 'ward': -6} # gamma_gamma index 0
ward_wards['xz'] = {'mu': -4, 'nu': -2, 'ward': -5} # gamma_gamma index 1
# ... etc.
check_su3(U, tol=1e-3, verbose=True) → boolVerifies SU(3) properties of a gauge field:
_torch.allclose with atol=tol)torch.linalg.det — no NPU equivalent needed)Returns True only if all three checks pass.
generate_gauge_field(U, sigma=0.1, seed=None, verbose=False) → torch.TensorGenerates random SU(3) gauge links via exponential map:
torch.matrix_exp[3, 3, 4, Lx, Ly, Lz, Lt] layoutWrites result in-place into U. Returns U.
give_support_multi() → boolReturns True if MPI.COMM_WORLD.size > 1 (multi-process run).
Gauge field U: shape [3, 3, 4, Lx, Ly, Lz, Lt] = [color, color, direction, x, y, z, t]
In addition to the matrix data above, the module imports mpi4py.MPI, pyqcu.cann as _torch, and raw torch (for torch.linalg.det and torch.matrix_exp which have no NPU wrappers).