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

Fix incorrect/missing Google Colab Links #20

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

j3soon
Copy link
Contributor

@j3soon j3soon commented Jan 8, 2025

No description provided.

@j3soon
Copy link
Contributor Author

j3soon commented Jan 8, 2025

2025/01/09 Update: Thanks to @Squirtle007, I'm able to confirm the following is a upstream (CUDA-Q) issue, and not due to this cuda-q-academic repo. Just opened a upstream issue: NVIDIA/cuda-quantum#2500

The following content is kept for potential reference:

In addition, I observed an issue on Colab that will require restarting the session every time when a error occurs in a CUDA-Q kernel. This makes REPL trial-and-error editing difficult on Colab.

Minimal reproducible steps:

  • Open the quick start notebook 1: https://colab.research.google.com/github/NVIDIA/cuda-q-academic/blob/main/quick-start-to-quantum/01_quick_start_to_quantum.ipynb
  • Correctly install cudaq by uncommenting the pip install command
  • Run all the way until 1.2.3 Using CUDA-Q to define and visualize a quantum state
  • Observe the two immediate cells below
    1. Defining the minus state in CUDA-Q and
    2. Visualizing a state in CUDA-Q
  • Modify the kernel in the first cell to cause error when executed, such as:
    # Define a cudaq.kernel to represent the minus state
    @cudaq.kernel
    def minus_state():
        q = cudaq.qvector(c)
        hi # will cause error
    
  • Run the second cell and observe the uninterruptible cell that can only be stopped by restarting the session
{A9AB8256-59AB-4C2E-8F05-C9030108C1C8} {1D8EFA05-B020-4A51-B851-42679B069CFC}

Full error message:

ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

cudaq.kernel.ast_bridge.CompilerError: <ipython-input-10-e9b73a23e14d>:13: error: Invalid variable name requested - 'hi' is not defined within the quantum kernel it is used in.
	 (offending source -> hi)

During handling of the above exception, another exception occurred:

AttributeError: 'CompilerError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

AssertionError
cudaq.kernel.ast_bridge.CompilerError: <ipython-input-10-e9b73a23e14d>:13: error: Invalid variable name requested - 'hi' is not defined within the quantum kernel it is used in.
	 (offending source -> hi)

During handling of the above exception, another exception occurred:

AttributeError: 'CompilerError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

TypeError: object of type 'NoneType' has no len()

During handling of the above exception, another exception occurred:

AttributeError: 'TypeError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

AssertionError
cudaq.kernel.ast_bridge.CompilerError: <ipython-input-10-e9b73a23e14d>:13: error: Invalid variable name requested - 'hi' is not defined within the quantum kernel it is used in.
	 (offending source -> hi)

During handling of the above exception, another exception occurred:

AttributeError: 'CompilerError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

TypeError: object of type 'NoneType' has no len()

During handling of the above exception, another exception occurred:

AttributeError: 'TypeError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

TypeError: object of type 'NoneType' has no len()

During handling of the above exception, another exception occurred:

AttributeError: 'TypeError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

AssertionError

This issue doesn't seem to occur when running a python script locally, or using a self-hosted jupyter lab.

@mmvandieren mmvandieren merged commit ec59bf7 into NVIDIA:main Jan 15, 2025
@j3soon j3soon deleted the fix/colab-links branch January 15, 2025 16:29
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