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

Adding a function to handle attribute access dynamically #1942

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sacpis
Copy link
Collaborator

@sacpis sacpis commented Jul 17, 2024

For issue #1855 raised by @mmvandieren

Adding a function getattr to handle attribute access dynamically

Test

root@d3f2e548b5a6:/workspaces/cuda-quantum# python3 examples/python/test.py 
AttributeError: 'adjoint' is not supported for CUDA-Q in Python

@sacpis sacpis enabled auto-merge (squash) July 17, 2024 00:58
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jul 17, 2024
def __getattr__(name):
if hasattr(cudaq_runtime, name):
return getattr(cudaq_runtime, name)
raise AttributeError(f"'{name}' is not supported for CUDA-Q in Python")
Copy link
Collaborator

Choose a reason for hiding this comment

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

The real issue is that there are functions that can only be called within cuda-q kernel code and not from host code. its not really about the function not being supported in Python.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @amccaskey. Seems like this needs a bit of thinking as to get functions for the host and the kernel code. And then check against those to determine the error.

@sacpis sacpis disabled auto-merge July 17, 2024 03:19
@sacpis sacpis marked this pull request as draft July 17, 2024 03:19
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.

None yet

2 participants