import pennylane as qml
from pennylane_lightning_gpu.lightning_gpu_qubit_ops import (
LightningGPU_C128,
)
from pennylane_lightning_gpu.lightning_gpu_qubit_ops import (
LightningGPUMPI_C128,
)
In reality, the above code gives the following error, whereas GPU_C128 is successfully imported.
ImportError: cannot import name 'LightningGPUMPI_C128' from 'pennylane_lightning_gpu.lightning_gpu_qubit_ops' (/home/nk/venv/lib/python3.10/site-packages/pennylane_lightning_gpu/lightning_gpu_qubit_ops.cpython-310-x86_64-linux-gnu.so)
CMake seems to find MPI compilers and libraries, and “ENABLE MPI” is ON in ccmake.
Is there anything that I need to double-check so that MPI is enabled?
Thank you for your interests in the distributed Pennylane-Lightning-GPU and reporting this issue.
Could you please let me know if the installed MPI library on your system is CUDA-aware? Currently, the distributed Pennylane-Lightning-GPU is built on top of the CUDA-aware MPI.
If you’ve OpenMPI installed, you could run the following commands: ompi_info --parsable --all | grep mpi_built_with_cuda_support:value
The answer is yes if you get following message: mca:mpi:base:param:**mpi_built_with_cuda_support:value**:true
Thanks for the information. Yes, it should be fine in this context. Could you let us know if the editable installation (see steps below) works for your setup? Could you also check your CUDA version and let us know?
Create and activate a new virtual env.
Install all required python packages (mpi4py, cuquantum and so on). Note that cuquantum has cuda-11 and cuda-12 options and please choose the one that is compatible with the CUDA installed in your system.
Navigate to the pennylane-lightning-gpu directory and build pennylane-lightining-gpu module from its c++ source code with: python setup.py build_ext --define="PLLGPU_ENABLE_MPI=ON;CUQUANTUM_SDK=<path to sdk>" -v
Don’t forget to replace <path to sdk> above with the path in your system.
Then perform an editable mode installation with: python -m pip install -e .
Thanks for the updates. I’m glad that it works for your system. The main issue could be the env. I would recommend to create a new env to install PennyLane-Lightning-GPU to avoid conflicts.
I also would like to let you know that we are working on moving Lightning-GPU to the [Lightning](https://github.com/PennyLaneAI/pennylane-lightning) repo. Once done, I would like to encourage you to have a try.