Issues Installing and Running PennyLane Lightning GPU

Hi @LittleFive

Thanks for your interest in using lightning.gpu. There are a few things worth noting for use here:

  • Firstly, you can try upgrading the lightning.gpu installed package as python -m pip install pennylane pennylane-lightning pennylane-lightning-gpu --upgrade to ensure the version is the most recent (v0.33.1 as of writing). Once this is installed and up to date, you can try pip install custatevec-cu11 to bring in the CUDA 11 variant of the NVIDIA cuQuantum custatevec library.
  • lightning.gpu requires a CUDA compute capability of SM7.0 or newer (Volta era and newer) to work. This is a hard requirement from the NVIDIA cuQuantum SDK (specifically the custatevec library), as the library expects data-center/HPC grade hardware to run. I cannot tell which GPUs you have installed, but it may be possible they are not supported by the library. You can inspect the compute capabilities for a variety of NVIDIA devices here
  • Assuming a supported GPU, the lightning.gpu simulator requires a minimum CUDA version of 11.5 runtime libraries to operate. I see your version on the platform is 11.4. If you can upgrade the installed drivers and SDK to 11.5 at a minimum (11.8 preferred), the libraries will work as expected. If you cannot upgrade the SDK, you can attempt to install nvidia-cusparse-cu11, nvidia-cublas-cu11, and nvidia-cuda-runtime-cu11 to your python virtualenv, and these may allow you to operate, assuming the installed hardware driver is of a supported version.
  • If your hardware isn’t supported by NVIDIA cuQuantum, but you can install a CUDA 12 toolchain, you can try to build our other HPC device lightning.kokkos, with instructions here. This require some manual steps to build from source, but may get you GPU support, depending on your hardware type. We require CUDA 12 here as the compiler toolchain for CUDA 11 does not allow some of the newer features we added.
  • If none of the above are valid options, you can swap default.qubit for our C++ backed CPU simulators lightning.qubit and our CPU-variant of lightning.kokkos. When you install PennyLane as pip install pennylane you get lightning.qubit too, so this should work directly. For the OpenMP variant of lightning.kokkos you can run pip install pennylane-lightning[kokkos] and the package will be installed for you.

Hopefully the above steps help you get running with one of the above devices. If not, feel free to let us know and we can try to help out.