Lightning GPU 0.25 on Jetson Xavier NX

@mlxd checking in to see if the main branch has been updated.

Hi @art The main branch has been updated as of this morning. Please feel free to get in touch if we can offer further assistance.

1 Like

@mlxd with the v0.26.0.dev0 version I get the following output on running the test script:

Name: PennyLane
Version: 0.24.0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: https://github.com/XanaduAI/pennylane
Author:
Author-email:
License: Apache License 2.0
Location: /home/arthurlobo/.conda/envs/qml_py310_b/lib/python3.10/site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, retworkx, scipy, semantic-version, toml
Required-by: PennyLane-Lightning, PennyLane-Lightning-GPU

Platform info: Linux-5.10.65-tegra-aarch64-with-glibc2.31
Python version: 3.10.4
Numpy version: 1.22.3
Scipy version: 1.9.0
Installed devices:

  • lightning.gpu (PennyLane-Lightning-GPU-0.26.0.dev0)
  • lightning.qubit (PennyLane-Lightning-0.24.0)
  • default.gaussian (PennyLane-0.24.0)
  • default.mixed (PennyLane-0.24.0)
  • default.qubit (PennyLane-0.24.0)
  • default.qubit.autograd (PennyLane-0.24.0)
  • default.qubit.jax (PennyLane-0.24.0)
  • default.qubit.tf (PennyLane-0.24.0)
  • default.qubit.torch (PennyLane-0.24.0)
    Traceback (most recent call last):
    File “/media/arthurlobo/QML/pennylane-lightning-gpu/test2.py”, line 3, in
    dev = qml.device(“lightning.gpu”, wires=1)
    File “/home/arthurlobo/.conda/envs/qml_py310_b/lib/python3.10/site-packages/pennylane/init.py”, line 316, in device
    dev = plugin_device_class(*args, **options)
    File “/media/arthurlobo/QML/pennylane-lightning-gpu/pennylane_lightning_gpu/lightning_gpu.py”, line 113, in init
    self._gpu_state = _gpu_dtype(self._state.dtype)(self._state)
    pennylane_lightning_gpu.lightning_gpu_qubit_ops.PLException: [/pennylane-lightning-gpu/pennylane_lightning_gpu/src/simulator/StateVectorCudaManaged.hpp][Line:46][Method:CSVHandle]: Error in PennyLane Lightning: custatevec not initialized

Hi @art it looks like the PL version was installed just before the release of 0.25. Can you update your package versions and try again with pip install pennylane --upgrade.

I’d also suggest trying your earlier build process and examining the tests. It could be possible that the Xavier NX has too little RAM to correctly allow them to pass. Can you list the contents of your script test2.py?

@mlxd contents of test2.py:

import pennylane as qml
qml.about()
dev = qml.device(“lightning.gpu”, wires=1)
@qml.qnode(dev)
def circuit():
qml.PauliX(0)
return qml.expval(qml.PauliZ(0))
circuit()

I did the upgrade “pip install pennylane --upgrade”, output of test2.py
still shows the same “custatevec not initialized” error:

Name: PennyLane
Version: 0.25.0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: GitHub - PennyLaneAI/pennylane: PennyLane is a cross-platform Python library for differentiable programming of quantum computers. Train a quantum computer the same way as a neural network.
Author:
Author-email:
License: Apache License 2.0
Location: /home/arthurlobo/.conda/envs/qml_py310_b/lib/python3.10/site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, retworkx, scipy, semantic-version, toml
Required-by: PennyLane-Lightning, PennyLane-Lightning-GPU

Platform info: Linux-5.10.65-tegra-aarch64-with-glibc2.31
Python version: 3.10.4
Numpy version: 1.22.3
Scipy version: 1.9.0
Installed devices:

  • lightning.gpu (PennyLane-Lightning-GPU-0.26.0.dev0)
  • default.gaussian (PennyLane-0.25.0)
  • default.mixed (PennyLane-0.25.0)
  • default.qubit (PennyLane-0.25.0)
  • default.qubit.autograd (PennyLane-0.25.0)
  • default.qubit.jax (PennyLane-0.25.0)
  • default.qubit.tf (PennyLane-0.25.0)
  • default.qubit.torch (PennyLane-0.25.0)
  • default.qutrit (PennyLane-0.25.0)
  • lightning.qubit (PennyLane-Lightning-0.25.0)
    Traceback (most recent call last):
    File “/media/arthurlobo/QML/pennylane-lightning-gpu/test2.py”, line 3, in
    dev = qml.device(“lightning.gpu”, wires=1)
    File “/home/arthurlobo/.conda/envs/qml_py310_b/lib/python3.10/site-packages/pennylane/init.py”, line 318, in device
    dev = plugin_device_class(*args, **options)
    File “/media/arthurlobo/QML/pennylane-lightning-gpu/pennylane_lightning_gpu/lightning_gpu.py”, line 113, in init
    self._gpu_state = _gpu_dtype(self._state.dtype)(self._state)
    pennylane_lightning_gpu.lightning_gpu_qubit_ops.PLException: [/pennylane-lightning-gpu/pennylane_lightning_gpu/src/simulator/StateVectorCudaManaged.hpp][Line:46][Method:CSVHandle]: Error in PennyLane Lightning: custatevec not initialized

It could be possible that the Xavier NX has too little RAM to correctly allow them to pass.

Note that I am using the Jetson AGX Xavier Developer kit P2888-0001
with 16 GB of memory shared between the ARM CPU and GPU. With jtop
running when the test2.py script is run the GPU usage is indicated as a
constant 0 KB (CPU usage is a constant 4.1 GB).

Hi @art I can confirm that for an ARM64 platform with NVIDIA device we have access to (AWS G5g) we can fully compile and run the test-suite without any memory issues:

May I suggest clearing out your existing python environment and starting again from fresh with

python -m venv pyenv
source ./pyenv/bin/activate
python -m pip install pennylane cuquantum ninja cmake
git clone https://github.com/PennyLaneAI/pennylane-lightning-gpu
cd pennylane-lightning-gpu
python -m pip install -e .

I suspect if your file does not run successfully after this, there may be an issue with cuQuantum on the Xavier platform, and will not be something we can fully support.

Please feel free to let us know if this is the case, and we can try revisit this in future after a discussion with the cuQuantum team.

1 Like

@mlxd the steps you outlined worked (I used a conda venv instead of the python venv) on test2.py - I don’t get an error message now.

Great to hear this worked for you. We intend to release ARM builds for a future iteration of LightningGPU, but for now glad this solved the problem.

1 Like