# Error in PennyLane Lightning: an illegal memory access was encountered

**URL:** <https://discuss.pennylane.ai/t/error-in-pennylane-lightning-an-illegal-memory-access-was-encountered/8157>\
**Category:** PennyLane Help\
**Created:** [March 15, 2025, 5:33am UTC](https://discuss.pennylane.ai/t/error-in-pennylane-lightning-an-illegal-memory-access-was-encountered/8157 "2025-03-15T05:33:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![QuantumMan](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/quantumman/32/2509_2.png) [@QuantumMan](https://discuss.pennylane.ai/u/QuantumMan)\
**Post date:** [March 15, 2025, 5:33am UTC](https://discuss.pennylane.ai/t/error-in-pennylane-lightning-an-illegal-memory-access-was-encountered/8157/1 "2025-03-15T05:33:20Z")

</div>

I installed pennylane-lightning gpu with mpi support on Nersc Perlmutter with modules. using instructions - [quantum-mini-apps/src/mini\_apps/quantum\_simulation/distributed\_state\_vector at main · radical-cybertools/quantum-mini-apps · GitHub](https://github.com/radical-cybertools/quantum-mini-apps/tree/main/src/mini_apps/quantum_simulation/distributed_state_vector#pennylane-lightninggpu-from-source-on-perlmutter). (kind of formulated from previous posts)

It used to work, but some upgrade on the HPC causing the error. I don’t see the installation failing for any reason and could successfully install pennylane-lgpu successfully with mpi support.

Hello! If applicable, put your complete code example down below. Make sure that your code:

- is 100% self-contained — someone can copy-paste exactly what is here and run it to  
reproduce the behaviour you are observing
- includes comments

```auto
from mpi4py import MPI
import pennylane as qml
from pennylane import numpy as np
from timeit import default_timer as timer
import sys
print("starting")

comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
print("Initialized mpi")
print(size)

# Set number of runs for timing averaging
num_runs = 3

# Choose number of qubits (wires) and circuit layers

n_wires =int(sys.argv[1])
print(n_wires)
n_layers = 2

# Instantiate CPU (lightning.qubit) or GPU (lightning.gpu) device
# mpi=True to switch on distributed simulation
# batch_obs=True to reduce the device memory demand for adjoint backpropagation
dev = qml.device('lightning.gpu', wires=n_wires, mpi=True, batch_obs=True)

# Create QNode of device and circuit
@qml.qnode(dev, diff_method="adjoint")
def circuit_adj(weights):
    qml.StronglyEntanglingLayers(weights, wires=list(range(n_wires)))
    return qml.math.hstack([qml.expval(qml.PauliZ(i)) for i in range(n_wires)])

# Set trainable parameters for calculating circuit Jacobian at the rank=0 process
if rank == 0:
    params = np.random.random(qml.StronglyEntanglingLayers.shape(n_layers=n_layers, n_wires=n_wires))
else:
    params = None

# Broadcast the trainable parameters across MPI processes from rank=0 process
params = comm.bcast(params, root=0)

# Run, calculate the quantum circuit Jacobian and average the timing results
timing = []
for t in range(num_runs):
    start = timer()
    jac = qml.jacobian(circuit_adj)(params)
    end = timer()
    timing.append(end - start)

# MPI barrier to ensure all calculations are done
comm.Barrier()

if rank == 0:
    print("num_gpus: ", size, " wires: ", n_wires, " layers ", n_layers, " time: ", qml.numpy.mean(timing)) 

```

If you want help with diagnosing an error, please put the full error message below:

```auto
Traceback (most recent call last):
  File "/global/u1/p/prmantha/dist_mem_jacobian.py", line 47, in <module>
    jac = qml.jacobian(circuit_adj)(params)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/_grad.py", line 517, in _jacobian_function
    jac = tuple(_jacobian(func, arg)(*args, **kwargs) for arg in _argnum)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/_grad.py", line 517, in <genexpr>
    jac = tuple(_jacobian(func, arg)(*args, **kwargs) for arg in _argnum)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/autograd/wrap_util.py", line 20, in nary_f
    return unary_operator(unary_f, x, *nary_op_args, **nary_op_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/autograd/differential_operators.py", line 60, in jacobian
    vjp, ans = _make_vjp(fun, x)
               ^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/autograd/core.py", line 10, in make_vjp
    end_value, end_node = trace(start_node, fun, x)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/autograd/tracer.py", line 10, in trace
    end_box = fun(start_box)
              ^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/autograd/wrap_util.py", line 15, in unary_f
    return fun(*subargs, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/workflow/qnode.py", line 987, in __call__
    return self._impl_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/workflow/qnode.py", line 977, in _impl_call
    res = self._execution_component(args, kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/workflow/qnode.py", line 935, in _execution_component
    res = qml.execute(
          ^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/workflow/execution.py", line 624, in execute
    results = ml_boundary_execute(tapes, execute_fn, jpc, device=device)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/workflow/interfaces/autograd.py", line 147, in autograd_execute
    return _execute(parameters, tuple(tapes), execute_fn, jpc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/autograd/tracer.py", line 44, in f_wrapped
    ans = f_wrapped(*argvals, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/autograd/tracer.py", line 48, in f_wrapped
    return f_raw(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/workflow/interfaces/autograd.py", line 183, in _execute
    return _to_autograd(execute_fn(tapes))
                        ^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/workflow/jacobian_products.py", line 464, in execute_and_cache_jacobian
    results, jac = self._dev_execute_and_compute_derivatives(tapes)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/workflow/jacobian_products.py", line 429, in _dev_execute_and_compute_derivatives
    return self._device.execute_and_compute_derivatives(numpy_tapes, self._execution_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/devices/modifiers/simulator_tracking.py", line 97, in execute_and_compute_derivatives
    return untracked_execute_and_compute_derivatives(self, circuits, execution_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/devices/modifiers/single_tape_support.py", line 62, in execute_and_compute_derivatives
    results, jacs = batch_execute_and_compute_derivatives(self, circuits, execution_config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/devices/modifiers/simulator_tracking.py", line 97, in execute_and_compute_derivatives
    return untracked_execute_and_compute_derivatives(self, circuits, execution_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane/devices/modifiers/single_tape_support.py", line 62, in execute_and_compute_derivatives
    results, jacs = batch_execute_and_compute_derivatives(self, circuits, execution_config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane_lightning/core/lightning_newAPI_base.py", line 334, in execute_and_compute_derivatives
    results = tuple(
              ^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane_lightning/core/lightning_newAPI_base.py", line 335, in <genexpr>
    self.simulate_and_jacobian(
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane_lightning/core/lightning_newAPI_base.py", line 228, in simulate_and_jacobian
    res = self.simulate(circuit, state)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u1/p/prmantha/pennylane-lightning/pennylane_lightning/lightning_gpu/lightning_gpu.py", line 542, in simulate
    return self.LightningMeasurements(final_state).measure_final_state(circuit)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane_lightning/core/_measurements_base.py", line 261, in measure_final_state
    return tuple(self.measurement(mp) for mp in circuit.measurements)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane_lightning/core/_measurements_base.py", line 261, in <genexpr>
    return tuple(self.measurement(mp) for mp in circuit.measurements)
                 ^^^^^^^^^^^^^^^^^^^^
  File "/pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages/pennylane_lightning/core/_measurements_base.py", line 240, in measurement
    return self.get_measurement_function(measurementprocess)(measurementprocess)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/u1/p/prmantha/pennylane-lightning/pennylane_lightning/lightning_gpu/_measurements.py", line 200, in expval
    return self._measurement_lightning.expval(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pennylane_lightning.lightning_gpu_ops.LightningException: [/global/u1/p/prmantha/pennylane-lightning/pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaMPI.hpp][Line:2208][Method:applyMPI_Dispatcher]: Error in PennyLane Lightning: an illegal memory access was encountered
terminate called after throwing an instance of 'Pennylane::Util::LightningException'
  what(): [/global/u1/p/prmantha/pennylane-lightning/pennylane_lightning/core/src/utils/cuda_utils/DataBuffer.hpp][Line:133][Method:~DataBuffer]: Error in PennyLane Lightning: an illegal memory access was encountered
srun: error: nid200321: task 0: Aborted
srun: Terminating StepId=36872546.1
srun: error: nid200324: task 2: Aborted
slurmstepd: error: ***STEP 36872546.1 ON nid200321 CANCELLED AT 2025-03-15T05:25:01***
srun: error: nid200321: task 1: Terminated
srun: error: nid200324: task 3: Terminated
srun: Force Terminated StepId=36872546.1

```

And, finally, make sure to include the versions of your packages. Specifically, show us the output of `qml.about()`.

```auto
Version: 0.39.0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: https://github.com/PennyLaneAI/pennylane
Author: 
Author-email: 
License: Apache License 2.0
Location: /pscratch/sd/p/prmantha/lgpu_env/lib/python3.11/site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, toml, typing-extensions
Required-by: PennyLane_Lightning, PennyLane_Lightning_GPU

Platform info: Linux-5.14.21-150500.55.65_13.0.73-cray_shasta_c-x86_64-with-glibc2.31
Python version: 3.11.7
Numpy version: 2.0.2
Scipy version: 1.15.2
Installed devices:
- lightning.gpu (PennyLane_Lightning_GPU-0.39.0)
- lightning.qubit (PennyLane_Lightning-0.39.0)
- default.clifford (PennyLane-0.39.0)
- default.gaussian (PennyLane-0.39.0)
- default.mixed (PennyLane-0.39.0)
- default.qubit (PennyLane-0.39.0)
- default.qutrit (PennyLane-0.39.0)
- default.qutrit.mixed (PennyLane-0.39.0)
- default.tensor (PennyLane-0.39.0)
- null.qubit (PennyLane-0.39.0)
- reference.qubit (PennyLane-0.39.0)
>>> 

```

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [March 17, 2025, 9:14pm UTC](https://discuss.pennylane.ai/t/error-in-pennylane-lightning-an-illegal-memory-access-was-encountered/8157/2 "2025-03-17T21:14:02Z")

</div>

Hi @QuantumMan ,

Are you able to upgrade to the latest PennyLane version (PennyLane v0.40) and let us know if you’re still experiencing this issue?

---

<div class="post-metadata">

**Author:** ![QuantumMan](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/quantumman/32/2509_2.png) [@QuantumMan](https://discuss.pennylane.ai/u/QuantumMan)\
**Post date:** [March 18, 2025, 1:01am UTC](https://discuss.pennylane.ai/t/error-in-pennylane-lightning-an-illegal-memory-access-was-encountered/8157/3 "2025-03-18T01:01:19Z")

</div>

Yes, i tried v0.40 and still same issue - i think with some latest version of NERSC HPC upgrade, this is broken now. @mlxd helped before with similar issues. But pennylane lightning gpu build should catch it. Now i am not sure where to look for.

File “/global/u1/p/prmantha/pennylane-lightning/pennylane\_lightning/lightning\_gpu/lightning\_gpu.py”, line 464, in simulate  
return self.LightningMeasurements(final\_state).measure\_final\_state(circuit)  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/pscratch/sd/p/prmantha/lgpu\_env/lib/python3.11/site-packages/pennylane\_lightning/core/\_measurements\_base.py”, line 261, in measure\_final\_state  
return tuple(self.measurement(mp) for mp in circuit.measurements)  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/pscratch/sd/p/prmantha/lgpu\_env/lib/python3.11/site-packages/pennylane\_lightning/core/\_measurements\_base.py”, line 261, in   
return tuple(self.measurement(mp) for mp in circuit.measurements)  
^^^^^^^^^^^^^^^^^^^^  
File “/pscratch/sd/p/prmantha/lgpu\_env/lib/python3.11/site-packages/pennylane\_lightning/core/\_measurements\_base.py”, line 240, in measurement  
return self.get\_measurement\_function(measurementprocess)(measurementprocess)  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/global/u1/p/prmantha/pennylane-lightning/pennylane\_lightning/lightning\_gpu/\_measurements.py”, line 196, in expval  
return self.\_measurement\_lightning.expval(  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
pennylane\_lightning.lightning\_gpu\_ops.LightningException: [/global/u1/p/prmantha/pennylane-lightning/pennylane\_lightning/core/src/simulators/lightning\_gpu/StateVectorCudaMPI.hpp][Line:2187][Method:applyMPI\_Dispatcher]: Error in PennyLane Lightning: an illegal memory access was encountered  
terminate called after throwing an instance of ‘Pennylane::Util::LightningException’  
what(): [/global/u1/p/prmantha/pennylane-lightning/pennylane\_lightning/core/src/utils/cuda\_utils/DataBuffer.hpp][Line:133][Method:~DataBuffer]: Error in PennyLane Lightning: an illegal memory access was encountered  
srun: error: nid200412: task 2: Aborted  
srun: Terminating StepId=36968770.1  
slurmstepd: error: \*\*\* STEP 36968770.1 ON nid200409 CANCELLED AT 2025-03-18T00:59:23 \*\*\*  
srun: error: nid200409: task 0: Aborted

---

<div class="post-metadata">

**Author:** ![QuantumMan](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/quantumman/32/2509_2.png) [@QuantumMan](https://discuss.pennylane.ai/u/QuantumMan)\
**Post date:** [March 18, 2025, 1:01am UTC](https://discuss.pennylane.ai/t/error-in-pennylane-lightning-an-illegal-memory-access-was-encountered/8157/4 "2025-03-18T01:01:57Z")

</div>

17:59:25 (lgpu\_env) prmantha@nid200409:~ $ python  
Python 3.11.7 | packaged by conda-forge | (main, Dec 23 2023, 14:43:09) [GCC 12.3.0] on linux  
Type “help”, “copyright”, “credits” or “license” for more information.

> > > import pennylane as qml  
> > > qml.ab\>\>\> qml.about()  
> > > Name: PennyLane  
> > > Version: 0.40.0  
> > > Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.  
> > > Home-page: [GitHub - PennyLaneAI/pennylane: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.](https://github.com/PennyLaneAI/pennylane)  
> > > Author:  
> > > Author-email:  
> > > License: Apache License 2.0  
> > > Location: /pscratch/sd/p/prmantha/lgpu\_env/lib/python3.11/site-packages  
> > > Requires: appdirs, autograd, autoray, cachetools, diastatic-malt, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, tomlkit, typing-extensions  
> > > Required-by: PennyLane\_Lightning, PennyLane\_Lightning\_GPU

Platform info: Linux-5.14.21-150500.55.65\_13.0.73-cray\_shasta\_c-x86\_64-with-glibc2.31  
Python version: 3.11.7  
Numpy version: 2.0.2  
Scipy version: 1.15.2  
Installed devices:

- lightning.qubit (PennyLane\_Lightning-0.40.0)
- lightning.gpu (PennyLane\_Lightning\_GPU-0.40.0)
- default.clifford (PennyLane-0.40.0)
- default.gaussian (PennyLane-0.40.0)
- default.mixed (PennyLane-0.40.0)
- default.qubit (PennyLane-0.40.0)
- default.qutrit (PennyLane-0.40.0)
- default.qutrit.mixed (PennyLane-0.40.0)
- default.tensor (PennyLane-0.40.0)
- null.qubit (PennyLane-0.40.0)
- reference.qubit (PennyLane-0.40.0)

> > >

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [March 18, 2025, 7:03pm UTC](https://discuss.pennylane.ai/t/error-in-pennylane-lightning-an-illegal-memory-access-was-encountered/8157/5 "2025-03-18T19:03:40Z")

</div>

Thanks for reporting this @QuantumMan . We’re investigating and will get back to you with more info.

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [March 19, 2025, 8:43pm UTC](https://discuss.pennylane.ai/t/error-in-pennylane-lightning-an-illegal-memory-access-was-encountered/8157/6 "2025-03-19T20:43:20Z")

</div>

Hi @QuantumMan ,

Our team suspects that this could be due to some combination of CUDA library changes and Cray MPICH changes.

Something you can try is downgrading your CUDA + Cray MPICH version (the system should allow module loading of old versions). Unfortunately we can’t perform tests on this system so we can’t really know what versions will work.

Let us know if you can downgrade to versions that work again. It might help others too.

---

<div class="post-metadata">

**Author:** ![Enrique](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/enrique/32/4442_2.png) [@Enrique](https://discuss.pennylane.ai/u/Enrique)\
**Post date:** [September 20, 2026, 2:51am UTC](https://discuss.pennylane.ai/t/error-in-pennylane-lightning-an-illegal-memory-access-was-encountered/8157/7 "2026-09-20T02:51:49Z")

</div>

Hey @QuantumMan, same error here on Perlmutter with lightning.gpu + MPI for Jacobian.

I ran into this after the cuda stack update too. In my case it was the MPI dispatcher hitting the memory ceiling on simulate\_and\_jacobian - not your install.

I have a private solver that runs that same workload locally without the illegal access error, even for large sizes.

Happy to run your circuit\_adj case privately as a test and send you back the jacobian value if you want to compare. Just DM the wires/params count.

No need to post your full code here.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/e/e64663b1e0ef3b714a28f626004164f29dc41364.png) [@system](https://discuss.pennylane.ai/u/system)\
**Post date:** [September 20, 2026, 2:51am UTC](https://discuss.pennylane.ai/t/error-in-pennylane-lightning-an-illegal-memory-access-was-encountered/8157/8 "2026-09-20T02:51:52Z")

</div>

This topic is temporarily closed for at least 1 hour due to a large number of community flags.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/e/e64663b1e0ef3b714a28f626004164f29dc41364.png) [@system](https://discuss.pennylane.ai/u/system)\
**Post date:** [September 28, 2026, 9:46pm UTC](https://discuss.pennylane.ai/t/error-in-pennylane-lightning-an-illegal-memory-access-was-encountered/8157/9 "2026-09-28T21:46:19Z")

</div>

This topic was automatically opened after 8 days.
