Skip to content

Commit f123097

Browse files
authored
Use shots for all QED-C benchmarks (#645) (#654)
1 parent 034a64e commit f123097

File tree

8 files changed

+24
-20
lines changed

8 files changed

+24
-20
lines changed

metriq_gym/benchmarks/qedc_benchmarks.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333

3434
"""
3535
Type: QEDC_Metrics
36-
Description:
37-
The structure for all returned QED-C circuit metrics.
36+
Description:
37+
The structure for all returned QED-C circuit metrics.
3838
The first key represents the number of qubits for the group of circuits.
39-
The second key represents the unique identifier for a circuit in the group.
40-
- This may be a secret string for Bernstein-Vazirani, theta value for Phase-Estimation,
41-
and so on. Benchmark specific documentation can be found in QED-C's
39+
The second key represents the unique identifier for a circuit in the group.
40+
- This may be a secret string for Bernstein-Vazirani, theta value for Phase-Estimation,
41+
and so on. Benchmark specific documentation can be found in QED-C's
4242
QC-App-Oriented-Benchmarks repository.
4343
The third key represents the metric being stored.
4444
Example for Bernstein-Vazirani:
@@ -201,8 +201,12 @@ def get_circuits_and_metrics(
201201
benchmark = import_benchmark_module(benchmark_name)
202202

203203
# Call the QED-C submodule to get the circuits and creation information.
204+
# Conver to QED-C parameter naming conventions.
205+
qedc_params = params.copy()
206+
if "shots" in qedc_params:
207+
qedc_params["num_shots"] = qedc_params.pop("shots")
204208
circuits, circuit_metrics = benchmark.run(
205-
**params,
209+
**qedc_params,
206210
api="qiskit",
207211
get_circuits=True,
208212
)

metriq_gym/schemas/bernstein_vazirani.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"_comment": "TODO (424)",
33
"$id": "metriq-gym/bernstein_vazirani.schema.json",
4-
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"$schema": "https://json-schema.org/draft/2020-12/schema",
55
"title": "Bernstein-Vazirani",
66
"description": "Bernstein-Vazirani benchmark schema definition, describing parameters for the benchmark.",
77
"type": "object",
@@ -11,7 +11,7 @@
1111
"const": "Bernstein-Vazirani",
1212
"description": "Name of the benchmark. Must be 'Bernstein-Vazirani' for this schema."
1313
},
14-
"num_shots": {
14+
"shots": {
1515
"type": "integer",
1616
"description": "Number of measurement shots (repetitions) to use for each circuit in the benchmark.",
1717
"default": 1000,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"benchmark_name": "Bernstein-Vazirani",
3-
"num_shots": 1000,
3+
"shots": 1000,
44
"min_qubits": 2,
55
"max_qubits": 6,
66
"skip_qubits": 1,
77
"max_circuits": 3,
88
"method": 1
9-
}
9+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"benchmark_name": "Hidden Shift",
3-
"num_shots": 1000,
3+
"shots": 1000,
44
"min_qubits": 2,
55
"max_qubits": 6,
66
"skip_qubits": 1,
77
"max_circuits": 3,
88
"method": 1
9-
}
9+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"benchmark_name": "Phase Estimation",
3-
"num_shots": 1000,
3+
"shots": 1000,
44
"min_qubits": 2,
55
"max_qubits": 6,
66
"skip_qubits": 1,
77
"max_circuits": 3,
88
"method": 1,
99
"use_midcircuit_measurement": false
10-
}
10+
}

metriq_gym/schemas/hidden_shift.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"_comment": "TODO (424)",
33
"$id": "metriq-gym/hidden_shift.schema.json",
4-
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"$schema": "https://json-schema.org/draft/2020-12/schema",
55
"title": "Hidden Shift",
66
"description": "Hidden Shift benchmark schema definition, describing parameters for the benchmark.",
77
"type": "object",
@@ -11,7 +11,7 @@
1111
"const": "Hidden Shift",
1212
"description": "Name of the benchmark. Must be 'Hidden Shift' for this schema."
1313
},
14-
"num_shots": {
14+
"shots": {
1515
"type": "integer",
1616
"description": "Number of measurement shots (repetitions) to use for each circuit in the benchmark.",
1717
"default": 1000,

metriq_gym/schemas/phase_estimation.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"_comment": "TODO (424)",
33
"$id": "metriq-gym/phase_estimation.schema.json",
4-
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"$schema": "https://json-schema.org/draft/2020-12/schema",
55
"title": "Phase Estimation",
66
"description": "Phase Estimation benchmark schema definition, describing parameters for the benchmark.",
77
"type": "object",
@@ -11,7 +11,7 @@
1111
"const": "Phase Estimation",
1212
"description": "Name of the benchmark. Must be 'Phase Estimation' for this schema."
1313
},
14-
"num_shots": {
14+
"shots": {
1515
"type": "integer",
1616
"description": "Number of measurement shots (repetitions) to use for each circuit in the benchmark.",
1717
"default": 1000,

metriq_gym/schemas/quantum_fourier_transform.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"_comment": "TODO (424)",
33
"$id": "metriq-gym/quantum_fourier_transform.schema.json",
4-
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"$schema": "https://json-schema.org/draft/2020-12/schema",
55
"title": "Quantum Fourier Transform",
66
"description": "Quantum Fourier Transform benchmark schema definition, describing parameters for the benchmark.",
77
"type": "object",
@@ -11,7 +11,7 @@
1111
"const": "Quantum Fourier Transform",
1212
"description": "Name of the benchmark. Must be 'Quantum Fourier Transform' for this schema."
1313
},
14-
"num_shots": {
14+
"shots": {
1515
"type": "integer",
1616
"description": "Number of measurement shots (repetitions) to use for each circuit in the benchmark.",
1717
"default": 1000,

0 commit comments

Comments
 (0)