Skip to content

Commit

Permalink
Merge pull request #470 from SRI-International/compiler-opt-changes-h…
Browse files Browse the repository at this point in the history
…amsim

Enhance Ham Sim for resiliency; Add support for HamLib simulations
  • Loading branch information
rtvuser1 authored Aug 14, 2024
2 parents 50f8d17 + abf82c9 commit 87a1325
Show file tree
Hide file tree
Showing 27 changed files with 46,341 additions and 1,587 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
- name: Install hydrogen lattice dependencies
run: pip install -r hydrogen-lattice/qiskit/requirements.txt
working-directory: ./

- name: Run tests
- name: Install hamiltonian simulation dependencies
run: pip install -r hamiltonian-simulation/qiskit/requirements.txt
working-directory: ./

- name: Run hydrogen lattice tests
run: pytest
working-directory: ./hydrogen-lattice/qiskit

- name: Run hamiltonian simulation tests
run: pytest
working-directory: ./hamiltonian-simulation/qiskit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Python
# Byte-compiled / optimized / DLL files
__pycache__/
downloaded_hamlib_files/
*.py[cod]
*$py.class

Expand Down
95 changes: 48 additions & 47 deletions benchmarks-qiskit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"min_qubits=2\n",
Expand Down Expand Up @@ -112,7 +110,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false,
"tags": []
},
"outputs": [],
Expand All @@ -136,9 +133,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -162,7 +157,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false,
"tags": []
},
"outputs": [],
Expand All @@ -187,9 +181,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -211,9 +203,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -236,9 +226,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -261,9 +249,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -285,9 +271,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -309,9 +293,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -337,9 +319,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -361,9 +341,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -379,22 +357,44 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Hamiltonian Simulation"
"### Hamiltonian Simulation - Method 1 "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.insert(1, \"hamiltonian-simulation/qiskit\")\n",
"import hamiltonian_simulation_benchmark\n",
"hamiltonian_simulation_benchmark.run(min_qubits=min_qubits, max_qubits=max_qubits, skip_qubits=skip_qubits,\n",
" max_circuits=max_circuits, num_shots=num_shots,\n",
" method=1,\n",
" backend_id=backend_id, provider_backend=provider_backend,\n",
" hub=hub, group=group, project=project, exec_options=exec_options)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Hamiltonian Simulation - Method 2 "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.insert(1, \"hamiltonian-simulation/qiskit\")\n",
"import hamiltonian_simulation_benchmark\n",
"hamiltonian_simulation_benchmark.run(min_qubits=min_qubits, max_qubits=max_qubits, skip_qubits=skip_qubits,\n",
" max_circuits=max_circuits, num_shots=num_shots,\n",
" method=2,\n",
" backend_id=backend_id, provider_backend=provider_backend,\n",
" hub=hub, group=group, project=project, exec_options=exec_options)"
]
Expand All @@ -409,9 +409,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -435,9 +433,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand All @@ -459,9 +455,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
Expand Down Expand Up @@ -497,11 +491,18 @@
"\n",
"metrics.plot_all_app_metrics(backend_id, do_all_plots=False, include_apps=None)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -515,7 +516,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 87a1325

Please sign in to comment.