2
$\begingroup$

I have an AMD 6700S that I want to use for Qiskit simulations. The test case below is calculating the QFT.

If I set my code up like this:
backend = Aer.get_backend('aer_simulator')
backend.set_options(device='GPU')
result = execute(qft, backend, noise_model=noise_model,backend_options=backend_options).result()

then I get the following output:
Simulation failed and returned the following error message:
ERROR: Failed to load qobj: Simulation device "GPU" is not supported on this system'.

However, if I set it up like this:
simulator = AerSimulator()
backend_options['method'] = 'statevector'
backend_options['device'] = 'GPU'
result = execute(qft, simulator, noise_model=noise_model, backend_options=backend_options).result()

then it outputs successfully. However, I'm unsure to what extent it's actually using the GPU. It seems to be, based on monitoring thermals/voltages, but is also definitely using the CPU. Changing backend_options['method'] = 'statevector' to backend_options['method'] = 'statevector_gpu' did not seem to affect runtime for the 2nd case.

I know Nvidia is the only officially supported card type currently according to this, but I was able to get Pytorch/ROCm working by passing the parameter HSA_OVERRIDE_GFX_VERSION=10.3.0 such that torch.cuda.is_available() outputs True in Jupyter Notebook, so I'm wondering if there are ways of monitoring the details of GPU usage in Qiskit or if/how others have been able to get their AMD cards to work.

My end goal is to be able to simulate molecules using the GPU with the VQE/qiskit-nature.

I also had an issue where pip install qiskit-aer-gpu gave this error when on the 3.10 Python kernel, but 3.9 did not.
ERROR: Could not find a version that satisfies the requirement qiskit-aer-gpu (from versions: none)
ERROR: No matching distribution found for qiskit-aer-gpu

However, both kernel versions had the same result in terms of the code output above, which doesn't make sense given qiskit-aer-gpu isn't installed under 3.10.

If it helps, my OS is OpenSUSE Tumbleweed. All Qiskit packages are on the latest versions.

$\endgroup$
1
  • $\begingroup$ Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. $\endgroup$
    – Community Bot
    Commented Jul 19, 2022 at 6:07

1 Answer 1

2
$\begingroup$

The GPU support included in qiskit-aer is explicitly built with CUDA, so it won't work out of the box with an AMD GPU as CUDA only works with NVIDIA GPUs. If you're trying to run simulations with qiskit-aer that are GPU accelerated you will need an NVIDIA GPU. That being said the actual GPU support in Aer is built using the thrust library: https://github.com/NVIDIA/thrust and a quick search shows that there are attempts to port thrust to AMD's ROCm (for example https://github.com/ROCmSoftwarePlatform/Thrust and https://github.com/ROCmSoftwarePlatform/rocThrust). So if you're confident with your C++ and GPU programming you can take a look at trying to leverage those to build qiskit-aer from source to leverage ROCm instead of CUDA. But that's obviously uncharted territory and likely not as straightforward as it sounds.

As for Python 3.10 support, the qiskit-aer-gpu package isn't available on python 3.10 currently because of compatibility issues in the build system between the OS version used for building the package and the CUDA distribution. With Python 3.10 you can build it from source assuming you have CUDA installed locally.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.