Skip to content
qctrlPublic

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Fire Opal for fault-tolerant quantum computing

A centralized location for Fire Opal's tools for fault-tolerant quantum computing (FTQC).

Installation

Python

All four packages are available on PyPI. Choose the packages that match your inputs and goals:

Package Purpose Installation
fo-synth-core Synthesize numerical single-qubit and two-qubit unitaries into Clifford+T gate words without a circuit framework. pip install fo-synth-core
fo-synth-qiskit Synthesize Qiskit circuits and OpenQASM inputs into Clifford+T circuits using single-qubit or two-qubit-block strategies. pip install fo-synth-qiskit
fo-synth-cudaq Add optimized Clifford+T synthesis to the CUDA-Q compiler through the fo-synth-ftqc-clifford-t target. pip install fo-synth-cudaq
fo-synth-benchmarks Compare synthesis runtime and T counts against gridsynth-based alternatives across the core, Qiskit, and CUDA-Q integrations, and generate reports and plots. pip install fo-synth-benchmarks

fo-synth-core and fo-synth-qiskit support Python 3.11 or newer on Linux and macOS. fo-synth-cudaq requires Python 3.12 to 3.14 on Linux (x86_64 or aarch64) and installs CUDA-Q and CUDA-Q Logical as dependencies; macOS and Windows are not supported. The benchmarking package uses Python 3.12, with core and Qiskit benchmarks on Linux or macOS and CUDA-Q benchmarks on Linux only.

Rust

The fo-synth-core crate provides Rust-level access to the same synthesizer used by the same-named Python package. It supports Linux x86_64 and aarch64 with glibc 2.28 or newer, and macOS on Apple silicon. You need a Rust toolchain with Cargo; you do not need to build the synthesizer itself.

Download fo-synth-core-X.Y.Z.crate and SHA256SUMS from the matching Fire Opal Synthesizer Core release on the public Releases page. These releases also include Python wheels. Replace X.Y.Z below with the downloaded version. Compare the checksum printed by the first command with the crate's entry in SHA256SUMS before extracting:

shasum -a 256 fo-synth-core-X.Y.Z.crate
tar xzf fo-synth-core-X.Y.Z.crate
cargo new synthesis-example
cd synthesis-example

Add the extracted crate as a local dependency in the new project's Cargo.toml:

[dependencies]
fo-synth-core = { path = "../fo-synth-core-X.Y.Z" }

Usage

Python

Follow the tutorial for your chosen package:

Package Tutorial
fo-synth-core Synthesize unitaries to Clifford+T
fo-synth-qiskit Synthesize Qiskit circuits to Clifford+T
fo-synth-cudaq Synthesize CUDA-Q kernels to Clifford+T
fo-synth-benchmarks Benchmark Clifford+T synthesis

Rust

The Rust interface exposes single-qubit synthesis through fo_synth_core::synthesize_su2 and two-qubit synthesis through fo_synth_core::synthesize_su4. Both accept a row-major unitary matrix with each entry represented as a (real, imaginary) pair, and an error tolerance in (0, 1]. Use a 2x2 matrix for single-qubit synthesis and a 4x4 matrix for two-qubit synthesis, with qubit 0 as the most significant bit of the row and column index. Single-qubit synthesis uses operator-norm error; for two-qubit synthesis, pass GateMetric::OperatorNorm to use the same metric, or GateMetric::Fidelity for trace-modulus distance. Both measure approximation error up to global phase and return a CliffordTWord containing gates, t_count, cnot_count, and operator_error (the error under the chosen metric).

Replace src/main.rs in the project created above with this example synthesizing a Hadamard and a CNOT:

use fo_synth_core::{synthesize_su2, synthesize_su4, GateMetric};

fn main() -> Result<(), fo_synth_core::Error> {
    let h = std::f64::consts::FRAC_1_SQRT_2;
    let hadamard = [[(h, 0.0), (h, 0.0)], [(h, 0.0), (-h, 0.0)]];
    let word = synthesize_su2(hadamard, 1e-6)?;

    println!("Hadamard gates: {}", word.gates);
    println!("T-count: {}", word.t_count);
    println!("Operator error: {}", word.operator_error);

    let zero = (0.0, 0.0);
    let one = (1.0, 0.0);
    let cnot = [
        [one, zero, zero, zero],
        [zero, one, zero, zero],
        [zero, zero, zero, one],
        [zero, zero, one, zero],
    ];
    let word = synthesize_su4(cnot, 1e-6, GateMetric::OperatorNorm)?;

    println!("CNOT gates: {}", word.gates);
    println!("T-count: {}", word.t_count);
    println!("CNOT count: {}", word.cnot_count);
    println!("Operator error: {}", word.operator_error);
    Ok(())
}

Run the example with:

cargo run

Single-qubit gate words are matrix products written left to right: the rightmost gate acts first. Two-qubit gate words instead contain space-separated tokens applied left to right, with qubit indices on single-qubit gates (H0, T1) and control and target indices on CNOTs (CX0,1). Synthesis failures are returned as errors rather than as approximations outside the requested tolerance.

cargo run and cargo test locate the bundled shared library automatically. For standalone deployment, distribute lib_fo_synth_core.so on Linux or lib_fo_synth_core.dylib on macOS alongside your binary and configure its runtime library search path. See the README included in the extracted crate for deployment instructions.

Contributing

See Contributing.

Credits

See Contributors.

License

The software is proprietary to Q-CTRL. Use is subject to the Q-CTRL Terms of Service.

Version

This project follows the Semantic Versioning standard.

Releases

Packages

Used by

Contributors