Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: support local simulators for jobs #309

Merged
merged 14 commits into from
May 4, 2022
Merged

feature: support local simulators for jobs #309

merged 14 commits into from
May 4, 2022

Conversation

ajberdy
Copy link
Contributor

@ajberdy ajberdy commented Mar 4, 2022

Issue #, if available:

Description of changes:

Support device arg for job creation of the form "local:provider.device.name".

Testing done:

Tox, added unit tests, ran a job and verified AMZN_BRAKET_DEVICE_ARN is as expected

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ajberdy ajberdy requested a review from kshitijc March 4, 2022 20:13
@ajberdy ajberdy requested a review from a team as a code owner March 4, 2022 20:13
@codecov
Copy link

codecov bot commented Mar 4, 2022

Codecov Report

Merging #309 (429fc38) into main (be3b639) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #309   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           66        66           
  Lines         4561      4579   +18     
  Branches       635       640    +5     
=========================================
+ Hits          4561      4579   +18     
Impacted Files Coverage Δ
src/braket/jobs/local/local_job.py 100.00% <ø> (ø)
.../jobs/metrics_data/cwl_insights_metrics_fetcher.py 100.00% <ø> (ø)
src/braket/aws/aws_quantum_job.py 100.00% <100.00%> (ø)
src/braket/jobs/config.py 100.00% <100.00%> (ø)
src/braket/jobs/image_uris.py 100.00% <100.00%> (ø)
src/braket/jobs/metrics_data/log_metrics_parser.py 100.00% <100.00%> (ø)
src/braket/jobs/quantum_job_creation.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be3b639...429fc38. Read the comment docs.

src/braket/aws/aws_quantum_job.py Outdated Show resolved Hide resolved
test/unit_tests/braket/aws/test_aws_quantum_job.py Outdated Show resolved Hide resolved
@ajberdy ajberdy requested a review from kshitijc March 7, 2022 20:45
@ajberdy ajberdy requested a review from kshitijc March 7, 2022 23:30
kshitijc
kshitijc previously approved these changes Mar 8, 2022
@ajberdy
Copy link
Contributor Author

ajberdy commented Mar 8, 2022

Tested e2e:

def run_job():
    print(os.environ.get("AMZN_BRAKET_DEVICE_ARN"))
    device = LocalSimulator()

    bell = Circuit().h(0).cnot(0, 1)
    num_tasks = 10
    results = []

    for i in range(num_tasks):
        task = device.run(bell, shots=100)
        result = task.result().measurement_counts
        results.append(result)
        print(f"iter {i}: {result}")

    save_job_result({"results": results})


job = AwsQuantumJob.create(
    device="local:provider/simulator",
    source_module="job.py",
    entry_point="job:run_job",
    wait_until_complete=True,
)
print(job.result())

@ajberdy ajberdy requested a review from kshitijc March 8, 2022 18:28
kshitijc
kshitijc previously approved these changes Mar 8, 2022
shpface and others added 5 commits April 26, 2022 14:36
* feat: add convenient selection of data parallelism

* fix spelling

Co-authored-by: Aaron Berdy <[email protected]>

* Rename distribution to 'data_parallel'

Co-authored-by: Aaron Berdy <[email protected]>
* feat: Support jobs metrics with multiple nodes

Co-authored-by: Aaron Berdy <[email protected]>

Co-authored-by: Aaron Berdy <[email protected]>
* fix: Change image_uri

Co-authored-by: Abe Coull <[email protected]>
@shpface shpface merged commit 65d299c into main May 4, 2022
@shpface shpface deleted the local-sim-jobs branch May 4, 2022 20:56
virajvchaudhari added a commit that referenced this pull request Sep 26, 2023
* update: task queue position after refactor

* add queue_position type hint details, change order of info
virajvchaudhari added a commit that referenced this pull request Sep 26, 2023
* feat: add queue position for tasks (#299)

* feat: add queue position for tasks

* update docstring for queue_position

* update docstrings

* update package_name

* update to enums and dataclass

* test: add integ test for task queue_position (#300)

* refactor: dataclass and file naming for queue info (#301)

* refactor: dataclass and file naming for queue info

* apply suggestions

* update: task queue position after refactor (#309)

* update: task queue position after refactor

* add queue_position type hint details, change order of info

* feat: queue position for hybrid jobs (#302)

* feat: queue position for hybrid jobs

* handle message return

* add docstring changes

* update docstring, and return None

* add context in dataclass

* update docstrings

* indent fix

* test: add integ test for jobs queue position (#310)

* feat: queue position for hybrid jobs

* handle message return

* add docstring changes

* update docstring, and return None

* add context in dataclass

* test: add integ test for jobs queue position

* remove comment

* minor fix

* remove unnecessary branching

* fix docstring merge

* remove dataclass redefinition after merge

* feat: queue depth for devices (#306)

* feat: queue depth for devices (dataclass version)

* add unit-test for queue depth

* modify docstrings, remove helper funcs

* add more info to docstrings

* minor test edit

* docstrings

* indent

* update QueuePriority to QueueType

* test: add integ test for queue_depth (#311)

* refactor: job and quantum_task keywords for queue_depth (#312)

* refactor: job and quantum_task keywords for queue_depth

* Update src/braket/aws/queue_information.py

Co-authored-by: Kshitij Chhabra <[email protected]>

---------

Co-authored-by: Kshitij Chhabra <[email protected]>

* deps: update boto3 version for queue visibility (#319)

* sync: public-main changes into feature/queue_visibility (#320)

* feat: add Aria2 enum (#653)

Co-authored-by: Viraj Chaudhari <[email protected]>
Co-authored-by: Cody Wang <[email protected]>

* infra: bump actions/checkout from 3.6.0 to 4.0.0 (#696)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.6.0 to 4.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@f43a0e5...3df4ab1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* prepare release v1.55.0

* update development version to v1.55.1.dev0

* Revert "update: restricting parameter names to not collide with ones we use for OpenQASM generation. (#675)" (#701)

This reverts commit b158736.

* infra: update codeowner file to amazon-braket/braket-dev (#699)

Co-authored-by: Abe Coull <[email protected]>

* doc: Replace aws org with amazon-braket (#705)

* prepare release v1.55.1

* update development version to v1.55.2.dev0

* doc: change the sphinx requirement to be greater than 7.0.0 (#704)

Co-authored-by: Cody Wang <[email protected]>

* doc: add code contributors to the readme (#703)

Co-authored-by: Cody Wang <[email protected]>

* doc: Remove trailing backquotes (#706)

* infra: update the pre-commit hook with linters (#678)

* infra: update the pre-commit hook with linters and secrets check

Co-authored-by: Abe Coull <[email protected]>
Co-authored-by: Cody Wang <[email protected]>

* prepare release v1.55.1.post0

* update development version to v1.55.2.dev0

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: ashlhans <[email protected]>
Co-authored-by: Cody Wang <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ci <ci>
Co-authored-by: Milan <[email protected]>
Co-authored-by: Angela Guo <[email protected]>
Co-authored-by: Abe Coull <[email protected]>
Co-authored-by: Abe Coull <[email protected]>

* Revert "sync: public-main changes into feature/queue_visibility (#320)"

This reverts commit be6460c.

* update github script

* minor fix

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Kshitij Chhabra <[email protected]>
Co-authored-by: ashlhans <[email protected]>
Co-authored-by: Cody Wang <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Milan <[email protected]>
Co-authored-by: Angela Guo <[email protected]>
Co-authored-by: Abe Coull <[email protected]>
Co-authored-by: Abe Coull <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants