Skip to content

Commit 40bfb5f

Browse files
authored
Merge pull request #74 from lanl-ansi/dev
PR from dev -> Main to add some small patches
2 parents 4ecf733 + 39cc31a commit 40bfb5f

3 files changed

Lines changed: 71 additions & 5 deletions

File tree

README.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,66 @@
1-
![pylint](https://img.shields.io/badge/PyLint-9.01-yellow?logo=python&logoColor=white)
1+
![pylint](https://img.shields.io/badge/PyLint-9.02-yellow?logo=python&logoColor=white)
22

33
# Quantum Computing Application Specifications
44

5-
This projct focuses on the documentation of applications for Quantum Computers.
5+
This project focuses on the documentation of applications for Quantum Computers. Quantum Computing Application (QCA) is a python library for constructing quantum circuits for a set of
6+
kernels and applications from the corresponding paper, and generating a series of resource estimates from it. All resource estimates are in the Clifford + T gateset.
7+
8+
QCA is structured the following:
9+
- notebooks/
10+
- A series of jupyter notebooks corresponding to each chapter in the paper which describes on how the application's workflow would look like. The following is a mapping of the notebook to its corresponding chapter on the report
11+
- ExoticPhasesExample.ipynb -> Chapter 3. Exploring exotic phases of magnetic materials near instabilities
12+
- DickeModelExample.ipynb -> Chapter 4. Driven-dissipative Dicke model in the ultrastrong coupling regime
13+
- HighTemperatureSuperConductorExample.ipynb -> Chapter 5. High-temperature superconductivity and exotic properties of FermiHubbard models
14+
- ArtificialPhotosynthesisExample.ipynb -> Chapter 6. Computational catalysis for artificial photosynthesis
15+
- QuantumChromoDynamicsExample.ipynb -> Chapter 7. Simulations of quantum chromodynamics and nuclear astrophysics
16+
- scripts/
17+
- Python scripts that allows an end user to run an application over the command line
18+
- qca.utils
19+
- Module that contains utility functions regarding constructing circuits for a given application'
20+
- tests/
21+
- Unit test cases to verify QCA's functionality
22+
23+
After running some program, you'd get the following output:
24+
```json
25+
{
26+
[(OPTIONAL) block of metadata information]
27+
[block of resource estimates]
28+
}
29+
```
30+
where the block of metadata information is the following (note that any key below is optional):
31+
```json
32+
{
33+
"name": str, // Name of the experiment
34+
"category": str, // Type of experiment such as scientific or industrial
35+
"size": str, // Size of the Hamiltonian
36+
"task": str, // The computational task such as ground_state_energy_estimation and time_dependent_dynamics
37+
"implementation": str, // Description of the implementation such as block encoding used
38+
"value": float, // The utility estimate in US dollars for the problem
39+
"value_per_t_gate": float, // The utility estimate value per t gate,
40+
"repetitions_per_application": int, // Total number of times to repeat the circuit to realize its utility
41+
"is_extrapolated": bool, // Denoting if the circuit was extrapolated to save compute time
42+
"gate_synth_accuracy": float, // The approximation error to decompose the circuit
43+
"nsteps": int, // Total number of steps taken
44+
"evolution_time": float, // Total evolution time
45+
"energy_precision": float, // Acceptable shift in state energy
46+
}
47+
```
48+
49+
where the block of resource estimations is the following:
50+
```json
51+
{
52+
"num_qubits": int, // number of qubits in the system
53+
"t_count": int, // total number of T gates
54+
"clifford_count": int, // total number of clifford gates
55+
"gate_count": int, // total number of gates
56+
"gate_depth": int, // total gate depth
57+
"subcircuit_occurences": int, // total number of times we come across this subcircuit
58+
"t_depth": int, // total T depth
59+
"max_t_depth_wire": int, // maximum number of T-gates on a wire
60+
}
61+
```
62+
63+
unless stated otherwise, the output will be generated as "{application_name}_re.json"
664

765
# Citation
866

src/qca/utils/utils.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def gen_resource_estimate(
154154
gate_count = count_gates(cpt_circuit)
155155
t_count = count_T_gates(cpt_circuit)
156156
t_depth = get_T_depth(cpt_circuit)
157+
max_t_depth_wire = get_T_depth_wire(cpt_circuit)
157158
clifford_count = gate_count - t_count
158159
circuit_depth = len(cpt_circuit)
159160

@@ -163,6 +164,7 @@ def gen_resource_estimate(
163164
'circuit_depth': circuit_depth,
164165
'gate_count': gate_count,
165166
't_depth': t_depth,
167+
'max_t_depth_wire': max_t_depth_wire,
166168
'clifford_count': clifford_count,
167169
}
168170

@@ -207,7 +209,8 @@ def estimate_cpt_resources(
207209
if nsteps and is_extrapolated:
208210
highest_scope = logical_re['Logical_Abstract']
209211
for key in highest_scope:
210-
highest_scope[key] = scale_resource(highest_scope[key], nsteps)
212+
if key != 'num_qubits':
213+
highest_scope[key] = scale_resource(highest_scope[key], nsteps)
211214

212215
logical_re['Logical_Abstract']['subcircuit_occurences'] = 1
213216
if include_nested_resources and nsteps:
@@ -229,6 +232,7 @@ def grab_single_step_estimates(num_qubits: int, main_estimates: dict, algo_name:
229232
'circuit_depth': main_estimates['circuit_depth']//nsteps,
230233
'gate_count': main_estimates['gate_count']//nsteps,
231234
't_depth': main_estimates['t_depth']//nsteps,
235+
'max_t_depth_wire': main_estimates['max_t_depth_wire']//nsteps,
232236
'clifford_count': main_estimates['clifford_count']//nsteps,
233237
'subcircuit_occurences': nsteps,
234238
'subcircuit_info': {}
@@ -270,7 +274,6 @@ def circuit_estimate(
270274
subcircuit_counts[gate_type][0] += 1
271275
else:
272276
t0 = time.perf_counter()
273-
# decomposed_circuit = cirq.Circuit(cirq.decompose(operation))
274277
decomposed_circuit = complete_decomposition(cirq.Circuit(operation))
275278
t1 = time.perf_counter()
276279
decomposed_elapsed = t1-t0
@@ -297,6 +300,7 @@ def circuit_estimate(
297300
total_gate_count = 0
298301
total_gate_depth = 0
299302
total_T_count = 0
303+
total_max_T_depth_wire = 0
300304
total_T_depth = 0
301305
total_clifford_count = 0
302306
subcircuit_re = []
@@ -315,19 +319,21 @@ def circuit_estimate(
315319
gate_depth = resource_estimate['circuit_depth']
316320
t_depth = resource_estimate['t_depth']
317321
t_count = resource_estimate['t_count']
322+
max_t_depth_wire = resource_estimate['max_t_depth_wire']
318323
clifford_count = resource_estimate['clifford_count']
319324

320325
curr_gate_count = subcircuit_occurences * gate_count
321326
curr_gate_depth = subcircuit_occurences * gate_depth
322327
curr_t_depth = subcircuit_occurences * t_depth
323328
curr_t_count = subcircuit_occurences * t_count
329+
curr_max_t_depth_wire = subcircuit_occurences * max_t_depth_wire
324330
curr_clifford_count = subcircuit_occurences * clifford_count
325-
326331
if (nsteps or bits_precision) and is_extrapolated:
327332
total_gate_count += scale_resource(curr_gate_count, nsteps, bits_precision)
328333
total_gate_depth += scale_resource(curr_gate_depth, nsteps, bits_precision)
329334
total_T_depth += scale_resource(curr_t_depth, nsteps, bits_precision)
330335
total_T_count += scale_resource(curr_t_count, nsteps, bits_precision)
336+
total_max_T_depth_wire += scale_resource(curr_max_t_depth_wire, nsteps, bits_precision)
331337
total_clifford_count += scale_resource(curr_clifford_count, nsteps, bits_precision)
332338

333339
main_estimates = {
@@ -337,6 +343,7 @@ def circuit_estimate(
337343
'circuit_depth': total_gate_depth,
338344
'gate_count': total_gate_count,
339345
't_depth': total_T_depth,
346+
'max_t_depth_wire': total_max_T_depth_wire,
340347
'clifford_count': total_clifford_count,
341348
'subcircuit_occurences': 1,
342349
'subcircuit_info': {}

tests/utils_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def test_get_resource_estimate(self):
8282
't_count': 8,
8383
't_depth': 2,
8484
'gate_count': 20,
85+
'max_t_depth_wire': 2,
8586
'clifford_count': 12,
8687
'circuit_depth': 5}
8788
self.assertEqual(circ_estimate, correct_estimate)

0 commit comments

Comments
 (0)