Skip to content

Commit 6e5d83b

Browse files
authored
Feature/ready for real device (#9)
* added tag to hybrid_job * modified role * try setting role with envvar * try getting defautl role * added coverage workflow * moved coveralls integrateion to test workflow * added token and changed to lcov format for coverage * upload cov only on python 3.10 * added coverage badge to readme * updated name of TrackHHL toymodel to reflect number of detectors and particles * added python version to precommit-autopdate * updated classiq to latest version
1 parent de06932 commit 6e5d83b

File tree

6 files changed

+26
-5
lines changed

6 files changed

+26
-5
lines changed

.github/workflows/actions.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,11 @@ jobs:
4848
- name: Install the project dependencies
4949
run: poetry install
5050
- name: Run the automated tests (ignore deprecation errors )
51-
run: poetry run pytest -m "not requires_auth" -W ignore::DeprecationWarning --cov-report xml --cov=quantum_linear_systems tests/
51+
run: poetry run pytest -m "not requires_auth" -W ignore::DeprecationWarning --cov-report=lcov --cov=quantum_linear_systems tests/
52+
- name: Upload results to Coveralls (only on Python3.10 job)
53+
if: matrix.python-version == '3.10'
54+
env:
55+
NODE_COVERALLS_DEBUG: 1
56+
uses: coverallsapp/github-action@v2
57+
with:
58+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/precommit_autoupd.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v3
1515
- uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.10'
1618
- name: Pre-commit autoupdate
1719
uses: browniebroke/pre-commit-autoupdate-action@main
1820
- uses: peter-evans/create-pull-request@v5

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Coverage Status](https://coveralls.io/repos/github/SURFQuantum/qc-quantum-linear-systems/badge.svg?branch=main)](https://coveralls.io/github/SURFQuantum/qc-quantum-linear-systems?branch=main)
2+
13
# quantum-linear-systems
24
Quantum algorithms to solve linear systems of equations.
35

quantum_linear_systems/execution/aws_execution.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typing import Tuple
88

99
import boto3
10+
from braket.aws import AwsSession
1011
from braket.devices import Devices
1112
from braket.jobs import OutputDataConfig
1213
from braket.jobs.hybrid_job import hybrid_job
@@ -131,14 +132,20 @@ def aws_s3_folder(folder_name: str) -> Tuple[str, str]:
131132
)
132133

133134
# Define the role ARN for executing the hybrid job (replace with your actual role ARN)
134-
role_arn = "arn:aws:iam::123456789012:role/YourBraketHybridJobRole"
135+
# role_arn = "arn:aws:iam::815925483357:role/surf-administrator"
136+
os.environ[
137+
"BRAKET_JOBS_ROLE_ARN"
138+
] = "arn:aws:iam::815925483357:role/src-workspace-AmazonBraketJobsExecutionRole"
139+
aws_session = AwsSession()
140+
print("Default role", aws_session.get_default_jobs_role())
135141

136142
@hybrid_job(
137143
device=device_arn,
138-
role_arn=role_arn,
144+
# role_arn=role_arn,
139145
output_data_config=output_data_config,
140146
dependencies="aws_requirements.txt",
141147
local=args.local,
148+
tags=get_tags(),
142149
) # choose priority device
143150
def execute_hybrid_job() -> None:
144151
# define hybrid job

quantum_linear_systems/implementations/hhl_classiq_implementation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def solve_hhl_classiq(
334334

335335
gen_circ = GeneratedCircuit.parse_raw(circuit_hhl)
336336
circuit_depth = gen_circ.transpiled_circuit.depth
337-
circuit_width = len(gen_circ.analyzer_data.qubits)
337+
circuit_width = gen_circ.data.width
338338
print("depth = ", circuit_depth)
339339
print("width = ", circuit_width)
340340

quantum_linear_systems/toymodels.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,10 @@ def __init__(self, num_detectors: int = 3, num_particles: int = 2) -> None:
359359
matrix_a, vector_b = upscale_pow2(matrix_a, vector_b)
360360
csol = np.linalg.solve(matrix_a, vector_b)
361361
super().__init__(
362-
name="HEPSimpleHamiltonian", matrix=matrix_a, vector=vector_b, csol=csol
362+
name=f"HEPSimpleHamiltonianD{num_detectors}P{num_particles}",
363+
matrix=matrix_a,
364+
vector=vector_b,
365+
csol=csol,
363366
)
364367

365368

0 commit comments

Comments
 (0)