-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fixes for speedier Python-Julia interaction #32
Conversation
def setup_pool(): | ||
global __JULIA_POOL__ | ||
__JULIA_POOL__ = Pool(processes=1) | ||
__JULIA_POOL__.apply(setup_julia) | ||
atexit.register(__JULIA_POOL__.join) | ||
atexit.register(__JULIA_POOL__.close) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this thread safe? what if two Python threads call this at the same time? (i.e. should you wrap this in some kind of lock?)
Co-authored-by: Ryan Shaffer <[email protected]>
Co-authored-by: Ryan Shaffer <[email protected]>
.github/workflows/benchmark.yml
Outdated
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to benchmark across multiple python version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We certainly can, I just wanted to be sparing with the amount of resource use at first.
|
||
def setup_pool(): | ||
global __JULIA_POOL__ | ||
__JULIA_POOL__ = Pool(processes=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming this will be used by the batched executions, should this take in a param for setup_pool
called processes
which has a default of 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because Julia handles the batches itself behind the scenes. We only need one process to chat back and forth with Julia.
Moved benchmarking to a new PR: #35 |
* change: nobraket branch * change: Remove threading tests thanks to new pythoncall version * fix: make tests compatible with xdist * fix: Use proper BraketSimulator.jl version * Use a `ProcessPoolExecutor` to talk to Julia (#30) * fix: Use new BraketSimulator.jl version * fix: Force a Julia registry update in CI to catch new versions * update tests (#31) * update tests * add a test optimization * refactor pyproject file to have test dependencies in their own file * Update requirements-test.txt * Update requirements-test.txt --------- Co-authored-by: Coull <[email protected]> * Fixes for speedier Python-Julia interaction (#32) * change: Use multiprocessing Pool rather than ProcessPoolExecutor * fix: No sigterm screaming * fix: Force close and join at exit * fix: Faster * fix: handle julia error in serializable way * change: Add benchmark workflow to CI * change: Point to latest unblocking branch * fix: linting * fix: Don't turn off juliapkg in tox * Update src/braket/simulator_v2/julia_workers.py Co-authored-by: Ryan Shaffer <[email protected]> * Update src/braket/simulator_v2/julia_workers.py Co-authored-by: Ryan Shaffer <[email protected]> * fix: one-line pip in benchmark * fix: typo * fix: Use benchmark-json option correctly * change: Add initial output.json * fix: Actually include benchmark script * fix: Don't deploy benchmark results to gh-pages * fix: restore GH token * fix: Remove benchmarks for now * change: Point to new BraketSimulator 0.0.4 --------- Co-authored-by: Ryan Shaffer <[email protected]> * fix: Don't turn off pyjuliapkg to make sure dpes do install * fix: Don't return the julia Main module to unlock jupyter * fix: Return to not using JuliaError type in case Julia isn't loaded --------- Co-authored-by: Coull <[email protected]> Co-authored-by: Abe Coull <[email protected]> Co-authored-by: Ryan Shaffer <[email protected]>
Issue #, if available: N/A
Description of changes:
Testing done:
tox
passed locallyMerge 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
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.