Skip to content

Commit 38ff210

Browse files
committed
fix: update QDP encoding method and synchronize CUDA device in SVHN IQP scripts
1 parent 2ccffa3 commit 38ff210

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

qdp/qdp-python/benchmark/encoding_benchmarks/README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,16 @@ uv run python benchmark/encoding_benchmarks/pennylane_baseline/svhn_iqp.py \
148148
## SVHN IQP (QDP pipeline)
149149

150150
Pipeline is identical to the baseline except for encoding:
151-
PCA-reduced vectors → QDP `QdpEngine.encode(method="iqp")` (one-shot, GPU) → `StatePrep(state_vector)` → same variational classifier.
151+
PCA-reduced vectors → QDP `QdpEngine.encode(encoding_method="iqp")` (one-shot, GPU) → `StatePrep(state_vector)` → same variational classifier.
152152

153153
```bash
154154
uv run python benchmark/encoding_benchmarks/qdp_pipeline/svhn_iqp.py
155155
```
156156

157157
The CLI mirrors the baseline, plus:
158158

159+
> **Note:** The QDP pipeline always performs the encoding step on a CUDA GPU via QDP. A CUDA-capable device is required even when you select `--backend cpu` for the training backend.
160+
159161
- **QDP-specific flags**
160162
- `--device-id`: CUDA device id (default: 0)
161163

@@ -166,15 +168,9 @@ uv run python benchmark/encoding_benchmarks/qdp_pipeline/svhn_iqp.py \
166168
--n-qubits 6 --n-samples 200 --iters 200 --trials 1 --early-stop 0 --backend cpu
167169
```
168170

169-
## SVHN IQP experiment runner
170-
171-
Run all qubit-scaling, accuracy-parity, and sample-scaling experiments:
172-
173-
```bash
174-
bash benchmark/encoding_benchmarks/run_svhn_iqp_experiments.sh
175-
```
171+
## SVHN IQP experiments
176172

177-
Logs are saved to `benchmark/encoding_benchmarks/logs/`. Results and analysis are in `benchmark/encoding_benchmarks/report.md`.
173+
Experiment logs are saved to `benchmark/encoding_benchmarks/logs/`.
178174

179175
## Full help
180176

qdp/qdp-python/benchmark/encoding_benchmarks/qdp_pipeline/svhn_iqp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,11 +606,11 @@ def main() -> None:
606606
X_train_params = features_to_iqp_params(X_train_pca, n_qubits)
607607
X_test_params = features_to_iqp_params(X_test_pca, n_qubits)
608608

609-
torch.cuda.synchronize()
609+
torch.cuda.synchronize(args.device_id)
610610
t0 = time.perf_counter()
611611
encoded_train = encode_qdp(X_train_params, n_qubits, args.device_id)
612612
encoded_test = encode_qdp(X_test_params, n_qubits, args.device_id)
613-
torch.cuda.synchronize()
613+
torch.cuda.synchronize(args.device_id)
614614

615615
if args.backend == "gpu":
616616
# Zero copy: QDP CUDA tensor -> lightning.gpu StatePrep (stays on GPU)

0 commit comments

Comments
 (0)