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

First pass of support for C++ operators #2511

Open
wants to merge 54 commits into
base: experimental/operators
Choose a base branch
from

Conversation

anthony-santana
Copy link
Collaborator

Description

This is an initial commit to the experimental branch containing a first pass of work towards operator support in C++

bmhowe23 and others added 5 commits January 13, 2025 08:05
This PR fixes an LLVM discrepancy in our Docker images vs our Python wheels. This should fix NVIDIA#1421 and NVIDIA#1799 for our Python wheels. (The Docker images were already correct.)
* Docs for trajectory simulation

Signed-off-by: Thien Nguyen <[email protected]>

* Fix spelling and code format

Signed-off-by: Thien Nguyen <[email protected]>

* Update mgpu hash: include fixes for 2434

Signed-off-by: Thien Nguyen <[email protected]>

* Update docs/sphinx/snippets/cpp/using/backends/trajectory.cpp

Co-authored-by: Eric Schweitz <[email protected]>
Signed-off-by: Thien Nguyen <[email protected]>

* Update docs/sphinx/snippets/cpp/using/backends/trajectory.cpp

Co-authored-by: Eric Schweitz <[email protected]>
Signed-off-by: Thien Nguyen <[email protected]>

* Update docs/sphinx/snippets/cpp/using/backends/trajectory_observe.cpp

Co-authored-by: Eric Schweitz <[email protected]>
Signed-off-by: Thien Nguyen <[email protected]>

* Update docs/sphinx/snippets/cpp/using/backends/trajectory_observe.cpp

Co-authored-by: Eric Schweitz <[email protected]>
Signed-off-by: Thien Nguyen <[email protected]>

* Update python/cudaq/runtime/observe.py

Co-authored-by: Eric Schweitz <[email protected]>
Signed-off-by: Thien Nguyen <[email protected]>

---------

Signed-off-by: Thien Nguyen <[email protected]>
Signed-off-by: Thien Nguyen <[email protected]>
Co-authored-by: Eric Schweitz <[email protected]>
For small controlled ops, i.e., singly controlled, expand the gate
matrix and use cutensornetStateApplyTensorOperator.

Add CUDAQ_TENSORNET_CONTROLLED_RANK threshold to determine when cutensornetStateApplyControlledTensorOperator is used.
For MPS, this is fixed at 1 as it cannot handle gate ops with more than
2 qubits.

Add doc for the setting and also remove some stale notes about random
seeds in the docs.

Signed-off-by: Thien Nguyen <[email protected]>
Copy link

copy-pr-bot bot commented Jan 15, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Copy link
Collaborator

@sacpis sacpis left a comment

Choose a reason for hiding this comment

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

LGTM if all tests are running successfully.

1tnguyen and others added 3 commits January 18, 2025 07:14
…de (NVIDIA#2516)

* Fix a bug in default init of scratchpad: it must allocate memory after we've set the device

Signed-off-by: Thien Nguyen <[email protected]>

* Add test

Signed-off-by: Thien Nguyen <[email protected]>

* Add a check to prevent multiple allocate calls

Signed-off-by: Thien Nguyen <[email protected]>

---------

Signed-off-by: Thien Nguyen <[email protected]>
@sacpis sacpis force-pushed the dynamics_cpp_operators branch from 752fed1 to d55814d Compare January 21, 2025 17:11
khalatepradnya and others added 2 commits January 22, 2025 07:54
* Fix the behavior of `quera` backend with C++ frontend by showing appropriate error message.
  (Behavior prior to this change - default simulator was invoked)
* Tell nvq++ to generate glue for `quera`
* Simplify libraries - combine 'libcudaq-quera-qpu.so' and 'libcudaq-serverhelper-quera.so' into one.

Signed-off-by: Pradnya Khalate <[email protected]>
Changes:

- cuda-quantum/cuquantum-mgpu!36: fix a bug in trajectory simulation

- cuda-quantum/cuquantum-mgpu!37: fix a bug in applyExpPauli: invalid
  value errors when the pauli word is acting on a subset of qubits.

Signed-off-by: Thien Nguyen <[email protected]>
@sacpis sacpis force-pushed the dynamics_cpp_operators branch from 0ebeed5 to b592f8a Compare January 23, 2025 17:42
sacpis and others added 5 commits January 23, 2025 17:53
* Upgrading notebook version to 7.3.2 from 7.1.3

Signed-off-by: Sachin Pisal <[email protected]>

* updating jupyterlab version to 4.3.4

Signed-off-by: Sachin Pisal <[email protected]>

---------

Signed-off-by: Sachin Pisal <[email protected]>
* [WIP] dynamics mgmn

Signed-off-by: Thien Nguyen <[email protected]>

* Fix a copy and paste error

Signed-off-by: Thien Nguyen <[email protected]>

* Handle initial state enum

Signed-off-by: Thien Nguyen <[email protected]>

* Update initial state enum example

Signed-off-by: Thien Nguyen <[email protected]>

* Add uniform state init

Signed-off-by: Thien Nguyen <[email protected]>

* Add uniform state init

Signed-off-by: Thien Nguyen <[email protected]>

* Update examples

Signed-off-by: Thien Nguyen <[email protected]>

* Code format

Signed-off-by: Thien Nguyen <[email protected]>

* Spelling

Signed-off-by: Thien Nguyen <[email protected]>

* Add more MPI API to CUDAQ comm plugin interface

Signed-off-by: Thien Nguyen <[email protected]>

* Refactor for dependency isolation

Signed-off-by: Thien Nguyen <[email protected]>

* Code format

Signed-off-by: Thien Nguyen <[email protected]>

* More isolation

Signed-off-by: Thien Nguyen <[email protected]>

* connect cuda-q mpi plugin to cudensitymat

Signed-off-by: Thien Nguyen <[email protected]>

* Fix for CI

Signed-off-by: Thien Nguyen <[email protected]>

* Code format: python

Signed-off-by: Thien Nguyen <[email protected]>

* Support initial state enum for non-dynamics case and add test

Signed-off-by: Thien Nguyen <[email protected]>

* Code tidy up and add docs

Signed-off-by: Thien Nguyen <[email protected]>

* Add MPI tests

Signed-off-by: Thien Nguyen <[email protected]>

* Add a link to the example directory

Signed-off-by: Thien Nguyen <[email protected]>

* Fix a typo

Signed-off-by: Thien Nguyen <[email protected]>

* Address CR: docs and comments edits; refactor to reduce code duplicate

Signed-off-by: Thien Nguyen <[email protected]>

---------

Signed-off-by: Thien Nguyen <[email protected]>
* Add non path reuse option

Signed-off-by: Thien Nguyen <[email protected]>

* Add docs and test

Signed-off-by: Thien Nguyen <[email protected]>

* Code review: add a note about observe with tensornet and update code comments

Signed-off-by: Thien Nguyen <[email protected]>

---------

Signed-off-by: Thien Nguyen <[email protected]>
@sacpis sacpis force-pushed the dynamics_cpp_operators branch from 97bd0d6 to 3f00f9f Compare January 25, 2025 19:57
@sacpis sacpis force-pushed the dynamics_cpp_operators branch from bbec3ed to 5b14fad Compare January 28, 2025 00:12
sacpis added 29 commits January 29, 2025 08:29
* Removing base_operator class, as operator_sum will act as a base class

Signed-off-by: Sachin Pisal <[email protected]>
	* Aggregating parameters
	* Extracting documentation
	* Extracting positional and keyword arguments
	* Generating all quantum states for given degrees and dimensions
	* Permuting a given matrix
	* Canonicalizing degrees
* Adding test cases for the above functions
* Formatting

Signed-off-by: Sachin Pisal <[email protected]>
Signed-off-by: Sachin Pisal <[email protected]>
Signed-off-by: Sachin Pisal <[email protected]>
Signed-off-by: Sachin Pisal <[email protected]>
* Adding unitests for Rydberg hamiltonian operator
* Making evaluate function in scalar_operator const

Signed-off-by: Sachin Pisal <[email protected]>
Signed-off-by: Sachin Pisal <[email protected]>
Signed-off-by: Sachin Pisal <[email protected]>
* Using CUDA_C_64F data type for complex

Signed-off-by: Sachin Pisal <[email protected]>
  the cudensitymatElementaryOperator_t
* Fetching subspace_extents using elementary_op degrees
* Adding a vector with correct action duality

Signed-off-by: Sachin Pisal <[email protected]>
Signed-off-by: Sachin Pisal <[email protected]>
Signed-off-by: Sachin Pisal <[email protected]>
* Adding create_initial_state method to create initial state based on
  the passed InitialStateArgT

Signed-off-by: Sachin Pisal <[email protected]>
@sacpis sacpis force-pushed the dynamics_cpp_operators branch from 5169445 to 337fa80 Compare January 30, 2025 00:01
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.

7 participants