Skip to main content

Fire Opal RIKEN Client

This is the Fire Opal client integration for RIKEN quantum computing infrastructure using a gRPC client.

Architecture Overview

  • Client: Qiskit SamplerV2 implementation that sends circuits to Fire Opal server for optimization
  • Server: gRPC service that performs Fire Opal preprocessing/postprocessing

Installation

Choose the version that matches where you are logged in:

  • Fugaku: install the sqc version.
  • R-CCS cloud: install the ibm version.

Fugaku

Complete these steps before you install:

  1. Create a JHPC Quantum account. Sign up here: https://idp.qc.r-ccs.riken.jp/realms/jhpc-quantum/account
  2. Set up and install your CA certificate and JWT token in your Fugaku home directory. The JWT token must be located at $HOME/.sqc_rpc_sched/jwt.token.
  3. Set up your Python environment by following this guide: https://github.com/jhpc-quantum/documents/blob/main/Qiskit_JHPC_Quantum_user_guide.md

After you finish the steps above, install the sqc version:

pip install 'qctrl-fire-opal-riken-client[sqc]'

R-CCS cloud

The steps above are not required for R-CCS cloud. Install the ibm version:

pip install 'qctrl-fire-opal-riken-client[ibm]'

Usage

Here is a small example of how to use the Fire Opal RIKEN client with Qiskit. This communicates with a gRPC server to perform Fire Opal optimizations on a quantum circuit before executing it. Once the job is complete, post-processed results are returned from the job.result() call.

The only difference between Fugaku (sqc) and R-CCS cloud (ibm) is how the QiskitRuntimeService channel and backend are set up, as noted in the comments below.

from qiskit import QuantumCircuit
from fireopalrikenclient.sampler import FireOpalSampler
from qiskit_ibm_runtime import QiskitRuntimeService

# Create circuit.
circuit = QuantumCircuit(2)
circuit.h(0)
circuit.cx(0, 1)
circuit.measure_all()

# Create sampler with Fire Opal preprocessing.
#
# On Fugaku (`sqc`), use the `jhpc_quantum` channel and the `ibm_sqc` backend.
# No `token` or `instance` is needed here, since those are provided by your
# SQC environment setup.
service = QiskitRuntimeService(channel="jhpc_quantum")
sampler = FireOpalSampler(mode=service.backend("ibm_sqc"))
#
# On R-CCS cloud (`ibm`), use the `ibm_quantum_platform` channel and the
# `ibm_kobe` backend. Replace `token` and `instance` with your `ibm_kobe`
# credentials provided by RIKEN.
# service = QiskitRuntimeService(token="...", instance="...", channel="ibm_quantum_platform")
# sampler = FireOpalSampler(mode=service.backend("ibm_kobe"))

# Run circuit with 1024 shots using Fire Opal optimization.
sampler_pub = (circuit, None, 1024)
job = sampler.run([sampler_pub])
result = job.result()

# Access the results
print(f"Number of pub results: {len(result)}")
print(f"Metadata: {result.metadata}")

# Access individual pub results by iterating over the result
for i, pub_result in enumerate(result):
    print(f"Pub {i}: {pub_result}")

# Or access a single pub result directly by index
print(f"First pub result: {result[0]}")

Simulate dynamics (preview)

Note: Simulate Dynamics is a preview feature. It is currently only supported on R-CCS cloud with the ibm version of the client (ibm_kobe). Importing fireopalrikenclient.dynamics with the sqc version installed raises a NotImplementedError.

FireOpalSimulateDynamics simulates the time evolution of a 1D Fermi-Hubbard model on the device and returns the error-mitigated expectation values of the requested observables at each time step. Fire Opal compiles the simulation into a set of circuits, which are run on the device. Once the job is complete, job.result() post-processes the device results and returns a FermiHubbardSolution.

from fireopalrikenclient.simulate_dynamics import (
    FireOpalSimulateDynamics,
    ModelType,
    SimulationType,
    SparseOccupationOperators,
)
from qiskit_ibm_runtime import QiskitRuntimeService

# Replace `token` and `instance` with your `ibm_kobe` credentials provided by RIKEN.
service = QiskitRuntimeService(token="...", instance="...", channel="ibm_quantum_platform")
backend = service.backend("ibm_kobe")

# Define the 1D Fermi-Hubbard model and the time-evolution scheme.
model = ModelType(hopping_amplitude=1.0, on_site_interaction=4.0, chemical_potential=0.0)
simulation = SimulationType(time_step=0.1, step_count=10)

# The initial state has one character per site (at most 64 sites):
# "u" (spin up), "d" (spin down), "b" (both) or "e" (empty).
initial_state = "udbe"

# Measure the spin-up occupation of site 0 and the total occupation of site 1.
observables = [
    SparseOccupationOperators(operators=[[("Nup", 0)]], coefficients=[1.0]),
    SparseOccupationOperators(
        operators=[[("Nup", 1)], [("Ndn", 1)]], coefficients=[1.0, 1.0]
    ),
]

job = FireOpalSimulateDynamics(mode=backend).run(
    model=model,
    initial_state=initial_state,
    simulation=simulation,
    observables=observables,
    shot_count=1024,
)
solution = job.result()

# One list of expectation values (one per time step) for each observable.
for observable, values in zip(solution.observables, solution.observable_expectation_values):
    print(f"{observable}: {values}")

print(f"Provider job IDs: {solution.provider_job_ids}")
print(f"Warnings: {solution.warnings}")

Metadata

Release files for qctrl-fire-opal-riken-client 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qctrl-fire-opal-riken-client 1.5.0
File Size Uploaded
qctrl_fire_opal_riken_client-1.5.0.tar.gz 119.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qctrl-fire-opal-riken-client 1.5.0
File Interpreter ABI Platform
qctrl_fire_opal_riken_client-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 255.6 kB

Release files / qctrl_fire_opal_riken_client-1.5.0.tar.gz

Download URL qctrl_fire_opal_riken_client-1.5.0.tar.gz
Size 119.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d1df18282cc13dae2786572656bf92238f449050b553f3f41926d47d5f5520a4
BLAKE2b-256 checksum
How to use checksums
5cf1848fa60b4e951f04e938a2b08745c795ffb43783aa725ade7b5dac181967
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.0 CPython/3.11.16 Linux/6.17.0-1022-azure

Release files / qctrl_fire_opal_riken_client-1.5.0-py3-none-any.whl

Download URL qctrl_fire_opal_riken_client-1.5.0-py3-none-any.whl
Size 136.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86c2f1dcebfe62c9d0876ed9fedb025f413ee7c0d5bffcac466d4be540468e70
BLAKE2b-256 checksum
How to use checksums
8c594bcfe3ce2a0fafff16ee23420edcfcb8530de6332af5dcacbacff15374f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.0 CPython/3.11.16 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

1.6.0

2 release files

This release

1.5.0 This release

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page