Metadata-Version: 2.4
Name: qctrl-fire-opal-riken-client
Version: 1.2.1
Summary: Fire Opal RIKEN client
License: https://q-ctrl.com/terms
Keywords: black opal,boulder opal,fire opal,ironstone opal,nisq,open controls,q control,q ctrl,q-control,q-ctrl,qcontrol,qctrl,quantum,quantum algorithms,quantum circuits,quantum coding,quantum coding software,quantum computing,quantum control,quantum control software,quantum control theory,quantum engineering,quantum error correction,quantum firmware,quantum fundamentals,quantum navigation,quantum sensing,qubit,qudit,riken
Author: Q-CTRL
Author-email: support@q-ctrl.com
Maintainer: Q-CTRL
Maintainer-email: support@q-ctrl.com
Requires-Python: >=3.11,<3.14
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: Other/Proprietary License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Software Development :: Embedded Systems
Classifier: Topic :: System :: Distributed Computing
Provides-Extra: ibm
Provides-Extra: sqc
Requires-Dist: grpcio (>=1.60.0,<2.0.0)
Requires-Dist: grpcio-tools (>=1.60.0,<2.0.0)
Requires-Dist: protobuf (>=5.26.0,<6.0.0)
Requires-Dist: protovalidate (>=0.7.0,<0.8.0)
Requires-Dist: qctrl-fire-opal-riken-commons (>=0.9.0)
Requires-Dist: qiskit (>=2.4.0,<3)
Requires-Dist: qiskit-ibm-runtime (>=0.43.1,<0.48.0) ; extra == "ibm"
Requires-Dist: qiskit-ibm-runtime-jhpcq (>=0.47.0) ; extra == "sqc"
Requires-Dist: qiskit-sqc-runtime (>=1.3) ; extra == "sqc"
Requires-Dist: types-protobuf (<4.25.0.20240417)
Project-URL: Documentation, https://docs.q-ctrl.com
Project-URL: Facebook, https://www.facebook.com/qctrl
Project-URL: GitHub, https://github.com/qctrl
Project-URL: Homepage, https://q-ctrl.com
Project-URL: LinkedIn, https://www.linkedin.com/company/q-ctrl/
Project-URL: Source, https://github.com/qctrl/fire-opal-riken-client
Project-URL: X, https://x.com/qctrlHQ
Project-URL: YouTube, https://www.youtube.com/qctrl
Description-Content-Type: text/markdown

# 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:

```bash
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:

```bash
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.

```python
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]}")
```

