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

Memory segfaults with initializing 'lightning.kokkos' after 'lightning.qubit' on macOS (x86_64) #552

Open
maliasadi opened this issue Nov 7, 2023 · 2 comments

Comments

@maliasadi
Copy link
Member

Running the following script on macOS x86_64 using PL-Lightning and PL-Lightning-Kokkos version 0.33.1 (installed via pip) will lead to memory segfaults. These segfaults are related to the initialization of the "lightning.kokkos" state vector.

import pennylane as qml
import pytest

def workflow1():
    @qml.qnode(qml.device("lightning.qubit", wires=1))
    def f(x):
        qml.RX(x, wires=0)
        return qml.expval(qml.PauliZ(wires=0))

    f(0.2)

def workflow2():
    @qml.qnode(qml.device("lightning.kokkos", wires=1))
    def g(x):
        qml.RX(x, wires=0)
        return qml.expval(qml.PauliZ(wires=0))

    g(0.2)

if __name__ == "__main__":
    pytest.main(["-x", __file__])

A few notes:

  • Reordering workflow1 and workflow2 would resolve segfaults.
  • Not a deterministic issue; you may not be able to reproduce it with running the test for the first time.
  • Pre-initializing the 'lightning.kokkos' state-vector by calling qml.device("lightning.kokkos", ...) in workflow1 would resolve the issue.

I could reproduce this by building lightning.qubit and lightning.kokkos on the machine from src, and with using lldb, it seems that the issue is propagated from Kokkos vector kernels. I didn't dig more to see if this is related to the Lightning implementation or Kokkos kernels.

@dime10
Copy link
Contributor

dime10 commented Jul 16, 2024

Does anyone know if this is still an issue?

@erick-xanadu
Copy link
Contributor

erick-xanadu commented Aug 14, 2024

I noticed that our wheels do not use the same kokkos version than the one used in check-catalyst, I'll keep a note of this and maybe we can investigate after StatePrep is merged. See here: PennyLaneAI/catalyst@507302c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants