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

Unavailability of Probabilities in result after successfull simulation #2183

Open
Suraj1409 opened this issue Jun 27, 2024 · 4 comments
Open

Comments

@Suraj1409
Copy link

Informations

Qiskit = 1.0.2
Qiskit-aer = 0.14.1
Qiskit-aer-gpu = 0.14.1

What is the current behavior?

I have Nvidia A100 GPU with 80GB memory, and I am trying to simulate 33 qubit circuit (statevector simulation) with single precision which will take around 64 GB memory, but when I run the circuit it didnt produce probabilities in the result, but the status of simulation is completed and time taken is 0.0025 sec

Need a guide for it

@chrisamirani
Copy link
Contributor

Hey @Suraj1409 Are you able to share your code here? If not everything, at least the part where you define your circuit and where you run the backend

@Suraj1409
Copy link
Author

from qiskit import *
from qiskit_aer import Aer, AerSimulator
import numpy as np
from qiskit.circuit.library import MCXGate

number_of_qubit = 33
target = [2]

def single_oracle(qc, q):
qc.barrier(q)
n = len(q)
qc.h(q[n - 1])
qc.append(MCXGate(n - 1), q)
qc.h(q[n - 1])
qc.barrier(q)

def diffusion_operator(qc, q):
qc.barrier(q)
n = len(q)
qc.h(q)
qc.x(q)
qc.h(q[n - 1])
qc.append(MCXGate(n - 1), q)
qc.h(q[n - 1])
qc.barrier(q)
qc.x(q)
qc.h(q)
qc.barrier(q)

def grover(qc, q, target):
n = len(q)
n_iterator = int(round((np.pi / 4)*np.sqrt(2**n / len(target)) - 0.5))
# print(n_iterator)
for i in range(0, n_iterator):
for t in target:
temp = t
for i in range(0, n):
if (temp % 2) == 0:
qc.x(q[i])
temp = int(temp / 2)
single_oracle(qc, q)
temp = t
for i in range(0, n):
if (temp % 2) == 0:
qc.x(q[i])
temp = int(temp / 2)
qc.barrier(q)
diffusion_operator(qc, q)

q = QuantumRegister(number_of_qubit)
c = ClassicalRegister(number_of_qubit)
qc = QuantumCircuit(q, c)
qc.h(q)
grover(qc, q, target)
qc.measure(q, c)

backend = Aer.get_backend('aer_simulator_statevector_gpu')
backend.set_options(precision='single')

job_cu = backend.run(qc, shots=3000,cuStateVec_enable=True)

result_cu = job_cu.result()

print("CuStateVec Output : ")
print(result_cu.status)
print(result_cu.time_taken)

@chrisamirani
Copy link
Contributor

Thx @Suraj1409 so when you run job_cu.result().get_counts() you get nothing? You should be able to get the probabilities with that.

@Suraj1409
Copy link
Author

Nothing gets print, even i tried to print job_cu.result() all parameters get printed but not probabilities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants