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

Add cuQuantum-based TFQ native ops and layers #774

Closed
wants to merge 138 commits into from

Conversation

QuantumJaeYoo
Copy link
Collaborator

This has large changes and requires some deps error, rewrite documentations, and fixed internal bugs inside random ops, and so forth.

Please look at the PR descriptions in my repo to understand the procedures : https://github.com/jaeyoo/quantum/pulls?q=is%3Apr+is%3Aclosed

Breaking Changes

Major Features and Improvements

  • Significant performance improvements by introducing cuQuantum support for circuit execution on Nvidia GPUs:
    • TensorFlow Quantum Keras layers can now be executed on GPU by setting the optional arguement use_cuquantum=True at layer instantiation. Examples:
      • tfq.layers.Expectation(use_cuquantum=True)
      • tfq.layers.SampledExpectation(use_cuquantum=True) (note that cuQuantum runtime is unsupported for any noisy circuit operations
      • tfq.layers.State(use_cuquantum=True)
      • tfq.layers.Sample(use_cuquantum=True)
      • tfq.layers.PQC(model_circuit, operators, use_cuquantum=True)
      • tfq.layers.ControlledPQC(model_circuit, operators, use_cuquantum=True)
    • Important notes:
      • CuQuantum execution is currently only supported for source distributions meaning that the user must build TensorFlow Quantum & tensorFlow-cpu from source following the instructions in install.md.
        • Ensure that the first entry is "N" in the configure.sh script at this step of building. This ensures that you build upon tensorflow-cpu as tensorflow-gpu is unnecessary for CuQuantum support in TensorFlow Quantum.
      • The cuQuantum SDK must be installed locally. See installation instructions for details. As part of the installation process, ensure that the CUQUANTUM_ROOT environment variable is set (referred to in the installation instructions). If not set, bazel will attempt to automatically locate the folder containing the cuQuantum installation upon running configure.sh at this step.
      • Quantum concurrency (global context option) should be turned off when use_cuquantum=True. This can be done by running: tfq.python.quantum_context.set_quantum_concurrent_op_mode(False)

Source: https://github.com/Sinestro38/quantum/blob/master/tensorflow_quantum/release.md
cc: @MichaelBroughton @QuantumJaeYoo

Sinestro38 and others added 30 commits March 29, 2023 06:18
Upgrade bazel version 5.3.0 and fix some typo in tf version (tensorflow#755)
@QuantumJaeYoo
Copy link
Collaborator Author

@MichaelBroughton Hi Michael, @Sinestro38 and I could reduce the number of files in this PR for you to review this PR easily. PTAL.

@zaqqwerty
Copy link
Contributor

Just a note, could it make sense to squash-merge instead of merge? Noticed commit history getting cluttered on main

@QuantumJaeYoo QuantumJaeYoo reopened this Jun 9, 2023
@QuantumJaeYoo
Copy link
Collaborator Author

@zaqqwerty Thank you for the idea. I squashed all commits. Could you please also review this PR?
@MichaelBroughton Please feel free to add kokoro:run tag and then let's debug it together.

@QuantumJaeYoo
Copy link
Collaborator Author

@zaqqwerty @MichaelBroughton After fixing the merge conflict, the squashed commits reverted... I hope we could use "Squash and merge" button before merging this PR.
스크린샷 2023-06-08 오후 7 33 20

@QuantumJaeYoo
Copy link
Collaborator Author

I will split this PR into multiple easier and shorter PRs.

@mhucka mhucka added the area/ci Concerns continuous integration workflows and infrastructure label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci Concerns continuous integration workflows and infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants