# Lightning GPU 0.25 on Jetson Xavier NX

**URL:** <https://discuss.pennylane.ai/t/lightning-gpu-0-25-on-jetson-xavier-nx/2033>\
**Category:** PennyLane Help\
**Created:** [July 15, 2022, 11:26pm UTC](https://discuss.pennylane.ai/t/lightning-gpu-0-25-on-jetson-xavier-nx/2033 "2022-07-15T23:26:36Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![art](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/art/32/1126_2.png) [@art](https://discuss.pennylane.ai/u/art)\
**Post date:** [August 15, 2022, 2:45pm UTC](https://discuss.pennylane.ai/t/lightning-gpu-0-25-on-jetson-xavier-nx/2033/21 "2022-08-15T14:45:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mlxd](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/mlxd/32/526_2.png) [@mlxd](https://discuss.pennylane.ai/u/mlxd)\
**Post date:** [August 15, 2022, 3:02pm UTC](https://discuss.pennylane.ai/t/lightning-gpu-0-25-on-jetson-xavier-nx/2033/22 "2022-08-15T15:02:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![art](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/art/32/1126_2.png) [@art](https://discuss.pennylane.ai/u/art)\
**Post date:** [August 15, 2022, 10:36pm UTC](https://discuss.pennylane.ai/t/lightning-gpu-0-25-on-jetson-xavier-nx/2033/23 "2022-08-15T22:36:04Z")

</div>

@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](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

---

<div class="post-metadata">

**Author:** ![mlxd](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/mlxd/32/526_2.png) [@mlxd](https://discuss.pennylane.ai/u/mlxd)\
**Post date:** [August 17, 2022, 1:21pm UTC](https://discuss.pennylane.ai/t/lightning-gpu-0-25-on-jetson-xavier-nx/2033/24 "2022-08-17T13:21:26Z")

</div>

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`?

---

<div class="post-metadata">

**Author:** ![art](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/art/32/1126_2.png) [@art](https://discuss.pennylane.ai/u/art)\
**Post date:** [August 17, 2022, 10:52pm UTC](https://discuss.pennylane.ai/t/lightning-gpu-0-25-on-jetson-xavier-nx/2033/25 "2022-08-17T22:52:29Z")

</div>

@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.](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)
- 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).

---

<div class="post-metadata">

**Author:** ![mlxd](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/mlxd/32/526_2.png) [@mlxd](https://discuss.pennylane.ai/u/mlxd)\
**Post date:** [August 18, 2022, 6:42pm UTC](https://discuss.pennylane.ai/t/lightning-gpu-0-25-on-jetson-xavier-nx/2033/26 "2022-08-18T18:42:55Z")

</div>

Hi @art I can confirm that for an ARM64 platform with NVIDIA device we have access to ([AWS G5g](https://aws.amazon.com/ec2/instance-types/g5g/)) we can fully compile and run the test-suite without any memory issues:

 ![image](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/2/225965fd71a6e8fc032e97a6396eaea8d2d523e7.png)

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

```bash
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.

---

<div class="post-metadata">

**Author:** ![art](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/art/32/1126_2.png) [@art](https://discuss.pennylane.ai/u/art)\
**Post date:** [August 18, 2022, 11:57pm UTC](https://discuss.pennylane.ai/t/lightning-gpu-0-25-on-jetson-xavier-nx/2033/27 "2022-08-18T23:57:45Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![mlxd](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/mlxd/32/526_2.png) [@mlxd](https://discuss.pennylane.ai/u/mlxd)\
**Post date:** [August 19, 2022, 12:41pm UTC](https://discuss.pennylane.ai/t/lightning-gpu-0-25-on-jetson-xavier-nx/2033/28 "2022-08-19T12:41:06Z")

</div>

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.

[Previous page](https://discuss.pennylane.ai/t/lightning-gpu-0-25-on-jetson-xavier-nx/2033.md?page=1)
