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

CDR Tutorial with Qrack #2451

Merged
merged 26 commits into from
Aug 5, 2024

Conversation

bdg221
Copy link
Collaborator

@bdg221 bdg221 commented Jul 25, 2024

Description

Fixes #2368

This PR is to add a tutorial to the documentation using CDR with Qrack as the Near-Clifford simulator.

I started with the CDR section of the User Guide and replaced compute_density_matrix with Qrack for the Near-Clifford simulation and a Qiskit Fake Backend that uses a snapshot of the configurations and noise of the Yorktown device.


License

  • I license this contribution under the terms of the GNU GPL, version 3 and grant Unitary Fund the right to provide additional permissions as described in section 7 of the GNU GPL, version 3.

@bdg221 bdg221 self-assigned this Jul 25, 2024
Copy link

codecov bot commented Jul 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.70%. Comparing base (02ebc4b) to head (3796a67).
Report is 45 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2451   +/-   ##
=======================================
  Coverage   98.70%   98.70%           
=======================================
  Files          88       88           
  Lines        4083     4083           
=======================================
  Hits         4030     4030           
  Misses         53       53           

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

@bdg221
Copy link
Collaborator Author

bdg221 commented Jul 25, 2024

@WrathfulSpatula and @natestemen I would appreciate if you could check this PR.

Dan, does everything look good from the Qrack side?

For the doc build in the PR, pyqrack is not included in the environment. I'm not sure how to do the install (since it requires a python kernel reboot.)

@purva-thakre
Copy link
Collaborator

purva-thakre commented Jul 26, 2024

@bdg221 I haven't dug into what the error message says exactly.

I looked through the diff and I think you should add pyqrack as a dependency in mitiq/requirements/.

@bdg221
Copy link
Collaborator Author

bdg221 commented Jul 26, 2024

@purva-thakre exactly. The error is coming from the os._exit(00) call after the pip install pyqrack --quiet.

I don't think it makes sense to include pyqrack as a dependency, but is there a way to include it for building the docs?

@purva-thakre
Copy link
Collaborator

purva-thakre commented Jul 26, 2024

@bdg221 Yes, I get what you are saying but there's an easy way to install it.

List your dependency below:

# Documentation and examples.

You can see certain dependencies are only for some docs examples.

@bdg221
Copy link
Collaborator Author

bdg221 commented Jul 26, 2024

@WrathfulSpatula when the docs are getting built and pyqrack is imported, the following error is seeing https://mitiq--2451.org.readthedocs.build/en/2451/examples/cdr_qrack.html:

/usr/lib/qrack/libqrack_pinvoke.so: cannot open shared object file: No such file or directory

You can see info about the environment (linux, python 3.12, pyqrack 1.30.0) here: https://github.com/unitaryfund/mitiq/actions/runs/10116764224/job/27980295325?pr=2451

@WrathfulSpatula
Copy link

WrathfulSpatula commented Jul 29, 2024 via email

@WrathfulSpatula
Copy link

WrathfulSpatula commented Jul 29, 2024 via email

Copy link
Member

@natestemen natestemen left a comment

Choose a reason for hiding this comment

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

Great start Brian!

Biggest thing is a little more explanation is needed before the definition of the three executors as to what they're needed for. I would generally expect a reader to have a basic idea of the CDR workflow, but always good to quickly remind people.

docs/source/examples/cdr_qrack.md Outdated Show resolved Hide resolved
docs/source/examples/cdr_qrack.md Outdated Show resolved Hide resolved
docs/source/examples/cdr_qrack.md Outdated Show resolved Hide resolved
docs/source/examples/cdr_qrack.md Outdated Show resolved Hide resolved
docs/source/examples/cdr_qrack.md Outdated Show resolved Hide resolved
docs/source/examples/cdr_qrack.md Show resolved Hide resolved
docs/source/examples/cdr_qrack.md Outdated Show resolved Hide resolved
@bdg221 bdg221 requested a review from natestemen August 1, 2024 17:16
Copy link
Member

@natestemen natestemen left a comment

Choose a reason for hiding this comment

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

Nice updates Brian! Just two smaller requests and then should be good to go.

docs/source/examples/cdr_qrack.md Outdated Show resolved Hide resolved
docs/source/examples/cdr_qrack.md Show resolved Hide resolved
@bdg221 bdg221 requested a review from natestemen August 2, 2024 21:41
Copy link
Member

@natestemen natestemen left a comment

Choose a reason for hiding this comment

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

Great work @bdg221!!!

@natestemen natestemen merged commit 8e0d5be into unitaryfund:main Aug 5, 2024
15 of 16 checks passed
natestemen added a commit that referenced this pull request Aug 5, 2024
* New example md file from ipynb

* New thumbnail for tutorial

* Add CDR with Qrack to Examples TOC

* Match thumbnail to tutorial

* Update md file to install Qrack

* Restart kernel if qrack needs to be install

* Add pyqrack to for building docs

* Removed pip install but added information in markdown

* Set the latest pyqrack

* Update with PYQRACK_SHARED_LIB_PATH

* Build Qrack for docs build remove  PYQRACK_SHARED_LIB_PATH

* Installing openCL per suggestion

* Adding sudo to apt calls

* Move apt call out of requirements

* Update apt format

* Put apt info back into docs build

* Cleaned up links to be relative and removed unnecessary line

* Remove unnecessary sentence about density matrices

Co-authored-by: nate stemen <[email protected]>

* Update execute_with_cdr to full function call

Co-authored-by: nate stemen <[email protected]>

* Remove unnecessary code explanation

Co-authored-by: nate stemen <[email protected]>

* Remove observable=None from execute_with_cdr

Co-authored-by: nate stemen <[email protected]>

* Update random_state and conclusion

* Add section explaining executors

* Added final sentences with other references and contact info

---------

Co-authored-by: nate stemen <[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.

Tutorial using CDR with Qrack as the near-Clifford circuit simulator
5 participants