Metadata-Version: 2.1
Name: qubestack-cudaq
Version: 1.6.0
Summary: QuREKA target for NVIDIA CUDA-Q: run CUDA-Q kernels on quantum hardware and emulators through the QuREKA platform.
Author: SDT Inc.
Maintainer: SDT Inc.
License: Apache-2.0
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development
Classifier: Topic :: Scientific/Engineering
Project-URL: Homepage, https://qureka.io
Project-URL: Documentation, https://docs.qureka.io
Requires-Python: >=3.12
Requires-Dist: cuda-quantum-cu12==0.14.0
Requires-Dist: cudaq-qec==0.6.0; extra == "academic"
Requires-Dist: cudaq-solvers==0.6.0; extra == "academic"
Requires-Dist: qutip>=5; extra == "academic"
Requires-Dist: galois>=0.3; extra == "academic"
Requires-Dist: pymatching>=2.2; extra == "academic"
Requires-Dist: stim>=1.13; extra == "academic"
Requires-Dist: openfermion>=1.6; extra == "academic"
Requires-Dist: pyscf>=2.8; extra == "academic"
Requires-Dist: cppe>=0.3; extra == "academic"
Requires-Dist: diffusers>=0.27; extra == "academic"
Requires-Dist: transformers>=4.41; extra == "academic"
Requires-Dist: genQC>=0.2; extra == "academic"
Requires-Dist: contfrac>=1.0; extra == "academic"
Provides-Extra: academic
Description-Content-Type: text/markdown

# qubestack-cudaq

QuREKA target for [NVIDIA CUDA-Q](https://developer.nvidia.com/cuda-q).

Run CUDA-Q kernels on quantum hardware and emulators through [QuREKA](https://qureka.io),
SDT's quantum cloud platform. After installation, `cudaq.set_target("qureka", ...)` sends your
kernels to QuREKA, which runs them on the device you choose and returns the results as regular
CUDA-Q objects.

## Requirements

| Item | Requirement |
|------|-------------|
| Python | 3.12 |
| Platform | Linux x86_64 (the package ships a compiled CUDA-Q plugin) |
| CUDA-Q | `cuda-quantum-cu12 0.14.0` — installed automatically |
| QuREKA | An API key issued in the QuREKA console |

## Installation

```bash
pip install qubestack-cudaq
```

Use a fresh virtual environment. The package pins `cuda-quantum-cu12==0.14.0`, so installing it
into an environment that already has another CUDA-Q version replaces that version.

### Optional: `[academic]` extras

To run the [NVIDIA CUDA-Q Academic](https://github.com/NVIDIA/cuda-q-academic) notebooks
(QEC, chemistry simulations, QAOA, dynamics, AI for quantum, ...):

```bash
pip install "qubestack-cudaq[academic]"
```

This adds `cudaq-qec` and `cudaq-solvers` with ABI-compatible pins, plus the libraries the
notebooks import (`qutip`, `galois`, `pymatching`, `stim`, `openfermion`, `pyscf`, `cppe`,
`diffusers`, `transformers`, `genQC`, `contfrac`). The base install does not include them.

The latest upstream Academic notebooks also import `cudaq_algorithms`, which requires CUDA-Q 0.15
or later and is not available with the current `0.14.0` pin.

## Quick start

```python
import cudaq

cudaq.set_target("qureka", backend="sdt.qubesim-mimiq", api_key="<QUREKA_API_KEY>")

@cudaq.kernel
def bell():
    q = cudaq.qvector(2)
    h(q[0])
    x.ctrl(q[0], q[1])
    mz(q)

result = cudaq.sample(bell, shots_count=1000)
print(result)  # { 00:~500 11:~500 }
```

## Devices

| Device | Provider | Type | Device code |
|--------|----------|------|-------------|
| IonQ Forte | IonQ | QPU | `ionq.forte-1` |
| IonQ Forte Enterprise | IonQ | QPU | `ionq.forte-enterprise-1` |
| IQM Garnet | IQM | QPU | `iqm.garnet` |
| IQM Emerald | IQM | QPU | `iqm.emerald` |
| QPerfect MIMIQ | QPerfect | Emulator | `sdt.qubesim-mimiq` |

Pass the device code as `backend`. The devices your workspace can use, with their shot limits and
prices, are listed in the QuREKA console under **Quantum Resources**. An unknown device code is
rejected before anything is submitted.

## Configuration

Arguments of `cudaq.set_target("qureka", ...)`:

| Argument | Required | Description |
|----------|----------|-------------|
| `backend` | Yes | Device code from the table above. |
| `api_key` | Yes | QuREKA API key. May be omitted inside QuREKA notebooks. |
| `url` | No | API endpoint. Default: `https://openapi.qureka.io`. |
| `option` | No | Device-specific options as a JSON string. |

Environment variables:

| Variable | Default | Description |
|----------|---------|-------------|
| `QUREKA_QUIET` | `false` | Set to `true` to hide progress lines such as `[QuREKA] submitting to …`. |
| `QUBESTACK_CUDAQ_AUTOLOAD` | `1` | Set to `0` to turn off the QuREKA layer described below. |

### What the package adds to CUDA-Q

`import cudaq` is enough. The package installs a start-up hook that loads its QuREKA layer right
after CUDA-Q is imported:

- waiting for a result retries transient lookup failures and, if it finally gives up, prints the
  job ID so the result can be found in the console;
- `cudaq.observe` with a list of operators or a list of argument values returns the correct values;
- `cudaq.get_state` on a remote device raises a clear `QurekaError` instead of crashing.

## Using it in QuREKA notebooks

QuREKA notebooks come with this package installed, and it behaves exactly as described here. The
only difference is that `api_key` may be omitted: the notebook session signs the request.

## CUDA-Q compatibility

`qubestack-cudaq`, `cuda-quantum-cu12`, `cudaq-qec` and `cudaq-solvers` must be ABI-compatible,
so each `qubestack-cudaq` release pins all three.

| `qubestack-cudaq` | `cuda-quantum-cu12` | `cudaq-qec` | `cudaq-solvers` |
|-------------------|---------------------|-------------|-----------------|
| 1.0.x – 1.6.0 | `0.14.0` | `0.6.0` | `0.6.0` |

## Versioning

From 1.6.0, the package version is the QuREKA platform release it ships with:
`qubestack-cudaq 1.6.0` belongs to QuREKA 1.6.0, and `1.6.0.1` is a hotfix of that release.
Earlier releases were published as `1.0.<build>`:

| QuREKA release | `qubestack-cudaq` |
|----------------|-------------------|
| 1.5.0 | 1.0.178 |
| 1.4.0.1 | 1.0.163 |
| 1.4.0 | 1.0.160 |

`1.6.0` sorts above `1.0.178`, so `pip install -U qubestack-cudaq` moves to the new numbering.

## Links

- QuREKA: <https://qureka.io>
- Documentation: <https://docs.qureka.io>

## License

Apache License 2.0 (`Apache-2.0`). The license text is included in the package.
