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

Bug: Submit task asynchronously #50

Closed
YunJ1e opened this issue Aug 11, 2023 · 1 comment · Fixed by #56
Closed

Bug: Submit task asynchronously #50

YunJ1e opened this issue Aug 11, 2023 · 1 comment · Fixed by #56

Comments

@YunJ1e
Copy link

YunJ1e commented Aug 11, 2023

Bug Description:
Following docs code on Submit task asynchronously will not give the proper output

Code to Reproduce the Bug:
The code is from the documentation website.

import numpy as np
from quafu import QuantumCircuit, Task
task = Task()
task.config(backend="ScQ-P10", shots=2000, compile=False, priority=2)

ts = range(0, 5, 1)
names = ["%dus" %t for t in ts]
for name, t in zip(names, ts): 
    q = QuantumCircuit(3)
    q.x(2)
    q.delay(2, t, unit="us")
    q.measure([2])
    res = task.send(q, wait=False, name=name, group="Q3_T1")

group_res = task.retrieve_group("Q3_T1")
probs = [res.probabilities["1"] for res in group_res]

Code Output:

AttributeError: 'NoneType' object has no attribute 'values'

Those tasks are indeed uploaded to the cloud and could be seen on the website. But it seems like something goes wrong with the task.retrieve_group("Q3_T1")

My Debugging Trials:

ts = range(0, 5, 1)
names = ["%dus" %t for t in ts]
result = []
for name, t in zip(names, ts): 
    q = QuantumCircuit(3)
    q.x(2)
    q.delay(2, t, unit="us")
    q.measure([2])
    task = Task()
    task.config(backend="ScQ-P10", shots=2000, compile=False)
    result.append(task.send(q, name=name))

will do the job similarly, but it is not asynchronous I guess.

@Zhaoyilunnn
Copy link
Collaborator

Zhaoyilunnn commented Aug 11, 2023

We incorporate a patch at pyquafu side to fix this issue. Thanks.

Before we release new version, you could try to build from stable/0.3 branch.

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

Successfully merging a pull request may close this issue.

2 participants