pyquil
Guides PyQuil and Quil quantum-programming workflows: author programs, simulate locally, compile and execute through QVM or QPU services, model noise and experiments, and inspect processor topologies and ISA metadata.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- pyquil
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Guides PyQuil and Quil quantum-programming workflows: author programs, simulate locally, compile and execute through QVM or QPU services, model noise and experiments, and inspect processor topologies and ISA metadata.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/concepts-and-runtime-boundaries.md2.7 KB
- 参考文档references/repo-provenance.md2.4 KB
- 参考文档references/repo-routing-metadata.json318 B
- 参考文档references/troubleshooting.md6.0 KB
- 脚本scripts/check_pyquil_install.py3.9 KB
03 SKILL.md 正文
PyQuil
Use this repo skill when a task names PyQuil, pyquil, Quil, Rigetti Forest,
Program, get_qc, QVM, QPU, quilc, QuantumComputer, PyQVM, Pauli
experiments, noise models, or compiler ISA/topology metadata. It is a
versioned, self-contained operating guide for PyQuil 4.18.0; it is not a
replacement for QCS credentials, QVM/quilc binaries, a reservation, or a
physical processor.
First decide the execution boundary
- Author or inspect Quil locally: read
program-authoring. It ownsProgram, gates, declarations, memory, placeholders, control flow, Quil-T, and serialization. - Run numerical simulation without external services: read
simulation. PreferPyQVMor the reference/NumPy simulators. Do not confuse them with the service-backedWavefunctionSimulator. - Compile, submit, or inspect QAM results: read
compile-execute. It ownsQuantumComputer, compiler/QVM/QPU selection, result maps, batching, endpoints, services, and QCS configuration. - Model noise, Pauli observables, or experiments: read
noise-experiments. It owns construction and validation; execution remains a separate backend step. - Inspect connectivity or instruction-set metadata: read
processor-isa. It owns NetworkX topologies,CompilerISA, QCS ISA conversion, and processor compatibility.
For a task crossing routes, start with the first route that creates the artifact, then follow its explicit handoff. Keep these distinctions visible:
| Local artifact or operation | What it proves | What it does not prove |
|---|---|---|
Program(...).out() |
Quil construction and serialization | Compiler acceptance or execution |
PyQVM / reference simulator |
In-process behavior on the selected simulator | QVM/quilc availability or QPU behavior |
qc.compile() / qc.run() |
Backend interaction only when the configured services respond | Physical correctness beyond the returned evidence |
NoiseModel, Experiment, or ISA object |
Model/metadata construction and validation | A run, calibration, reservation, or hardware result |
Install and inspect
Use a supported Python version from the package metadata (Python 3.11 or 3.12 for this release) in an isolated environment:
python -m pip install pyquil
python -c "import pyquil; print(pyquil.__version__)"
The optional latex extra supplies IPython for interactive display helpers:
python -m pip install 'pyquil[latex]'
The package depends on compiled Rust-backed distributions on common platforms;
less common platforms may need a Rust toolchain. QVM/quilc are separate Forest
SDK services and are not installed by the Python package. QCS/QPU workflows
also require authorized configuration and access. Read
references/concepts-and-runtime-boundaries.md
for the dependency and service boundary before installing broad extras.
Run the bundled, service-free installation check from any working directory:
python scripts/check_pyquil_install.py --help
python scripts/check_pyquil_install.py
It reports package metadata/imports and small local capability checks without
starting services, reading secrets, contacting QCS, or writing files. Read
references/troubleshooting.md when the
import, optional dependency, configuration, compiler, service, or credential
boundary is unclear. Read
references/repo-provenance.md before using
this skill against a changed checkout; a changed commit or public API surface
calls for refresh-repo-skill.
Shared operating rules
- Build and validate a
Programbefore handing it to a simulator or compiler. - Declare memory deliberately; validate register names, dimensions, and shot counts before interpreting returned arrays.
- Resolve qubit and label placeholders before submission-shaped serialization.
- Use explicit finite timeouts for compiler/service calls and record whether a service or credential was actually used.
- Treat qubit order, Pauli sign conventions, readout-matrix orientation, and ISA dead-resource flags as data contracts, not presentation details.
- Stop rather than inventing a QPU result when QCS credentials, a reservation,
quilc, or QVM is missing.
Runtime files
All references and helpers linked by the routes above are bundled inside this skill. Review/test records, native candidate maps, environment reports, and verification notes live outside the runtime tree under the construction artifact directory; do not make later Researcher runs depend on them.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).