2
$\begingroup$

I'm trying to run an implementation of Shor's algorithm using a GPU device. While running with $N<1023$ works (23 qubits), when running with a higher number of qubits, the program ends before reaching the run instruction.

simulator_gpu = QasmSimulator(method='statevector', device='GPU') 
transpiled_circuit = transpile(circuit[0], simulator_gpu)
simulation = simulator_gpu.run(transpiled_circuit, shots=number_shots)

After using nvtop and htop to visualize the workload of the GPU and the cores, I've realized neither the transpile nor the beginning of the instruction run uses the GPU device. Although it takes lot of time to transpile the circuit for $N > 1023$, the program doesn't even enter in the GPU for the run instruction (it does enter for numbers under 1023).

So my question is if there is any way for the transpile instruction to use the GPU device and if there is any possibility so that the beginning of the run instruction is also parallelized.

$\endgroup$

1 Answer 1

0
$\begingroup$

Just a random thought, can you try

from qiskit_aer import AerSimulator
simulator_gpu = AerSimulator(method='statevector',device = 'GPU')

Or instead of statevector, try tensor_product_state, and see whether running the circuit still doesn't use GPU.

And why would transpile use a GPU. Transpile function is just breaking down the virtual quantum circuit in native gates of the backend /simulator you are using.

$\endgroup$
2
  • $\begingroup$ First of all, thank you for your answer. I guess you mean matrix_product_state. I tried several options but none is working. Regarding the transpile instruction, what I mean is if there is any possible parallelization of the instruction, as it only uses one core of the CPU. $\endgroup$ Commented Mar 21 at 16:54
  • $\begingroup$ You can make use of MPI. qiskit.github.io/qiskit-aer/howtos/running_gpu.html $\endgroup$
    – user27873
    Commented Mar 22 at 0:38

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.