CUDA-Q sample code Initialization Error

I am an community college professor and I am attempting to use CUDA-Q on the Jetson Orin Nano (Jetpack 6.2). Fresh image. The only thing I had to do was revert snapd back to 2.68.5 to get the browser to run, so I could access the url below.

Following: https://nvidia.github.io/cuda-quantum/latest/using/quick_start.html

I ensured pip version was greater than 24.0 (running 25.1.1)
pip install cudaq
skipped the conda steps, as they were optional
inputted and ran the sample code: see below

rashap@q:~/Documents/cuda-q$ cat program.py
import sys
import cudaq

print(f"Running on target {cudaq.get_target().name}")
qubit_count = int(sys.argv[1]) if 1 < len(sys.argv) else 2

@cudaq.kernel
def kernel():
qubits = cudaq.qvector(qubit_count)
h(qubits[0])
for i in range(1, qubit_count):
x.ctrl(qubits[0], qubits[i])
mz(qubits)

result = cudaq.sample(kernel)
print(result) # Example: { 11:500 00:500 }
rashap@q:~/Documents/cuda-q$ python3 program.py
Running on target nvidia
RuntimeError: initialization error

Hello @brashap, Would you please post the output of nvidia-smi command?

Thank you @brashap.

Can you please try the following sequence for imports?

import cudaq
import sys

I changed the order, but it not have any effect:

Hi @brashap,

I would like to check if it is an issue with the Nvidia GPU driver.

Would you please set target to qpp-cpu?

cudaq.set_target(“qpp-cpu”)
print(f"Running on target {cudaq.get_target().name}")

Switching to CPU seems to have fixed it, so indeed maybe a gpu issue

Thanks @brashap.

Ah, seems like an issue with Nvidia GPU driver and/or cuda toolkit version then.

Would you be able to update the driver?

@spisal The drivers are integrated into Jetpack 6.2, correct? Is there a way I need to update them that doesn’t disrupt anything else with Jetpack 6.2.

Naive thought, instead of messing up with the embedded drivers, would you be able to upgrade Jetpack to 6.2.1?

@spisal It looks like I already have Jetpack 6.2.1.

And, when I add the -a to the show jetpack, it actually shows three of them: 6.2.1+b38, 6.2+b27, and 6.1+b123, I’m not sure what take presendent.

Can you please show the output of the command below?

apt list --installed nvidia-jetpack

Well, this doesn’t seem right:

image

Does that mean my next step is: sudo apt install nvidia-jetpack

Apt installed listing can be a bit strict about exact names.

Can you try this command?

dpkg -l ‘nvidia-jetpack*’

image

Thanks @brashap.

Please run this command

apt-cache policy nvidia-jetpack

and if you do see Installed: (none), then please use the command below to install it

sudo apt update
sudo apt install nvidia-jetpack

Let us know if CUDA-Q code still does not work on your machine.

@spisal I did get installed: (none) and was able to install it. See the verification below. However, also see that after commenting out the qpp-cpu line, I still get the initialization error.

Thanks @brashap. Would you please set this flag export CUDAQ_LOG_LEVEL=info before running your program.py file?
Please post the logs here.

Here is the log output:

log.txt (15.2 KB)