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

Don't throw fatal exception during 'import cudaq' if missing dependencies #1152

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

bmhowe23
Copy link
Collaborator

@bmhowe23 bmhowe23 commented Jan 31, 2024

If the user has GPUs but doesn't have all the right dependencies installed, we should not throw fatal exceptions in that case. Rather, we should fallback on qpp-cpu and log an info message that we are not selecting the nvidia target because dependencies are missing.

Helps mitigate the impact of missing dependencies as encountered in #1096.

Testing this in CI is difficult so I did standalone testing as follows:

First perform the following to force missing dependencies:

$ mv /usr/local/cuda/targets/x86_64-linux/lib/libcublas.so.11 /usr/local/cuda/targets/x86_64-linux/lib/libcublas.so.11.ignore

Without this change, it behaves as follows:

$ python3 -c "import cudaq"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/cudaq/cudaq/__init__.py", line 28, in <module>
    from ._pycudaq import *
ImportError: Invalid simulator requested: custatevec_fp32

With this change, it behaves as follows:

$ python3 -c "import cudaq"
<no errors>

If the user has GPUs but doesn't have all the right dependencies, we
should not throw fatal exceptions in that case.
@bmhowe23 bmhowe23 added this to the release 0.7.0 milestone Jan 31, 2024
@bmhowe23 bmhowe23 added the bug Something isn't working label Jan 31, 2024
@bmhowe23 bmhowe23 added bug fix To be listed under Bug Fixes in the release notes and removed bug Something isn't working labels Jan 31, 2024
Copy link
Collaborator

@khalatepradnya khalatepradnya left a comment

Choose a reason for hiding this comment

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

👍

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 Jan 31, 2024
@bmhowe23 bmhowe23 enabled auto-merge (squash) January 31, 2024 21:02
@bmhowe23 bmhowe23 merged commit 9fff5cf into NVIDIA:main Jan 31, 2024
133 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2024
@bmhowe23 bmhowe23 deleted the pr-better-handling-for-missing-deps branch January 31, 2024 21:28
@bettinaheim bettinaheim added build The issue related to the CUDA Quantum build and removed build The issue related to the CUDA Quantum build labels Mar 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fix To be listed under Bug Fixes in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants