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

change: Remove PythonCall dep and extension #51

Merged
merged 3 commits into from
Sep 24, 2024
Merged

Conversation

kshyatt-aws
Copy link
Member

Issue #, if available: N/A

Description of changes: Use JSON strings to pass inputs and results back and forth to external callers (inc. Python). Means we no longer need a PythonCall extension. Use mmaped files for large datasets (e.g. state vectors or density matrices) to avoid very expensive inter-process communication.

Testing done: Unit tests passed locally and works with coming branch for Python wrapper.

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.

@kshyatt-aws kshyatt-aws requested a review from a team as a code owner September 18, 2024 15:45
Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.04%. Comparing base (df54745) to head (9157693).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #51   +/-   ##
=======================================
  Coverage   99.04%   99.04%           
=======================================
  Files          23       22    -1     
  Lines        3339     3367   +28     
=======================================
+ Hits         3307     3335   +28     
  Misses         32       32           
Flag Coverage Δ
99.04% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +399 to +408
mmap_files = String[]
obj_lengths = Int[]
for r_ix in to_mmap
push!(obj_lengths, length(results.resultTypes[r_ix].value))
tmp_path, io = mktemp()
write(io, results.resultTypes[r_ix].value)
empty!(results.resultTypes[r_ix].value)
close(io)
push!(mmap_files, tmp_path)
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own understanding: you're using the variable name mmap_files, but actually these are just temp files on disk, is that correct? Or is there something else happening here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmap_files is the path to each file where the big array is mmap-ed. These files are in /tmp and are deleted when the Julia process exits.

rmshaffer
rmshaffer previously approved these changes Sep 24, 2024
@kshyatt-aws kshyatt-aws merged commit 23991af into main Sep 24, 2024
14 checks passed
@kshyatt-aws kshyatt-aws deleted the ksh/nopythoncall branch September 24, 2024 18:05
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.

2 participants