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

The number of qubits supported by the MPI version of Qiskit Aer does not increase with the addition of nodes. #2256

Open
Guogggg opened this issue Nov 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Guogggg
Copy link

Guogggg commented Nov 13, 2024

Informations

  • Qiskit Aer version:0.16.0
  • Python version:3.9.5
  • Operating system:Ubuntu 20.04

What is the current behavior?

I have two compute nodes, each with 14GB of memory, and I have manually compiled the MPI version of Qiskit-Aer on both nodes. Now, I need to simulate a 30-qubit GHZ circuit, which requires around 16GB of RAM. In theory, my available RAM is 2 * 14GB = 28GB, which should be sufficient to run a 30-qubit circuit. My hostfile is set to node1:1, node2:1, and in the code, blocking_qubits = 27. I run the command mpirun -np 2 -machinefile hostfile python new_qiskit.py, but it throws an error indicating insufficient memory. When I checked with htop, I noticed that the memory usage on each node exceeds 14GB during computation.
Here is Error message:

Abort(940225294) on node 1 (rank 1 in comm 0): Fatal error in PMPI_Wait: Unknown error class, error stack:
PMPI_Wait(206): MPI_Wait(request=0x7f127004bfc0, status=0x7f1278755050) failed
MPIR_Wait(106): 
(unknown)(): Unknown error class

Here is my code


from qiskit import QuantumCircuit
#from qiskit.providers.basic_provider import BasicSimulator
from qiskit.compiler import transpile, assemble
from qiskit_aer import AerSimulator

def create_ghz_circuit(n_qubits):
    circuit = QuantumCircuit(n_qubits)
    circuit.h(0)
    for qubit in range(n_qubits - 1):
        circuit.cx(qubit, qubit + 1)
    return circuit

shots = 1000
depth=10
qubits = 30
block_bits = 27
#backend = BasicSimulator()
backend = AerSimulator(method="statevector")

circuit = transpile(create_ghz_circuit(qubits),
                    optimization_level=0)
circuit.measure_all()

#result = backend.run(circuit, shots=shots, seed_simulator=10).result()
result = backend.run(circuit,shots=shots,seed_simulator=12345,blocking_enable=True,blocking_qubits=block_bits).result()
print(result)

adict = result.to_dict()
meta = adict['metadata']
print("meta: ", meta)
myrank = meta['mpi_rank']
print("myrank: ",myrank)

Steps to reproduce the problem

Running code with mpirun -np 2 -machinefile hostfile python new_qiskit.py

What is the expected behavior?

He should be up and running

Suggested solutions

@Guogggg Guogggg added the bug Something isn't working label Nov 13, 2024
@diehlpk
Copy link

diehlpk commented Dec 17, 2024

I am running qiskit using MPI and according to the documentation (https://qiskit.github.io/qiskit-aer/howtos/running_gpu.html) you need to add blocking_enable=True, blocking_qubits=23 to run it distributed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants