Closed AdriaanRol closed 6 years ago
Hi,
In my opinion this is because the ALAP option only influences the first scheduler but not the cc_light_schedule_rc, the second scheduler. The latter always is ASAP and takes the resource constraints into account.
Best,
Hans
On 09/13/2018 01:40 PM, Adriaan wrote:
@imranashraf https://github.com/imranashraf
OpenQL version 0.5.1. Below is a self contained example showing ALAP (As Late As Possible) scheduling not working as expected. The single qubit gates are expected to be played as late as possible, resulting in the gates appearing right before the measurement. Changing the scheduler option from ALAP to ASAP does not change the generated output.
The scheduling option can correctly be set using |ql.set_option("scheduler", "ALAP")| and read back using |ql.get_option("scheduler")|. Using "ALAP" scheduling the following openQL program:
import openql.openqlas ql
nregisters=0 platf= ql.Platform('OpenQL_Platform', cfg_filname) nqubits= platf.get_qubit_number() p= ql.Program('Scheduling_test', platf, nqubits, nregisters)
k= ql.Kernel('test_kernel', platf, nqubits, nregisters)
k.prepz(0) k.prepz(2) for iin range(10): k.gate('rx180', [0])
for iin range(6): k.gate('rx90', [2]) k.gate('wait', [0,2],0) k.measure(2) k.measure(0) p.add_kernel(k) p.compile()
Produces the following output
|smis s0, {0} smis s1, {1} smis s2, {2} smis s3, {3} smis s4, {4} smis s5, {5} smis s6, {6} smis s7, {0, 1, 2, 3, 4, 5, 6} smis s8, {0, 1, 5, 6} smis s9, {2, 3, 4} smis s10, {0, 2} smis s11, {2, 0} start: test_kernel: 1 prepz s10 qwait 9999 1 cw_03 s2 | cw_01 s0 1 cw_03 s2 | cw_01 s0 1 cw_03 s2 | cw_01 s0 1 cw_03 s2 | cw_01 s0 1 cw_03 s2 | cw_01 s0 1 cw_03 s2 | cw_01 s0 1 cw_01 s0 1 cw_01 s0 1 cw_01 s0 1 cw_01 s0 1 measz s11 qwait 15 br always, start nop nop |
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/QE-Lab/OpenQL/issues/166, or mute the thread https://github.com/notifications/unsubscribe-auth/AQcwttkj7dWL9mFgi-qs6eRERg4sJq4Eks5uakQngaJpZM4WnFYw.
@jvansomeren thanks for the info, this is good to know. Due to the fact that qubits decohere, "ALAP" type scheduling is (almost) always the preferred scheduling algorithm.
@imranashraf Would changing this be a simple flag or would this require significant programming efforts?
@AdriaanRol yes, for qasm generation, both ASAP and ALAP are implemented. For cc-light compilation, only ASAP is available at the moment. The partial basic implementation is there, but it will require some time to be completed and properly tested.
@imranashraf thanks for the update.
Not having a reliable ALAP scheduling feature is quite a problem for us. Currently we are working around this by manually adding k.gate("wait", [qn, ... , q0], 0)
between operations to ensure timing alignment, effectively bypassing all scheduling capabilities. I think it is obvious that this is an undesired workaround that is causing us to build up massive technical debt.
We are currently starting to run into this when scheduling experiments like simultaneous single qubit RB, where we would like to add all pulses for each qubit and expect the timings to be aligned afterwards, this is what prompted #157. I am seriously worried about not having this capability when trying to do multi-qubit experiments beyond two-qubits.
Would it be possible to give an indication as to the timescale on which this issue can be addressed?
@AdriaanRol I implemented a version of ALAP which is already available in OpenQL but due to a bug, is disabled. I had a discussion with @jvansomeren and he proposed to have a look at it today. He also detected a sub-optimality and improved the cc light resource manager on a separate branch for some mapping work. He will soon (hopefully by tomorrow) be able to push working version of ALAP scheduler.
@imranashraf that is great to hear! I was wondering if there will be tests added to test the output for correct scheduling. As far as I can tell these are not there yet.
yes, it tests will be added to check the correctness
Hi Imran,
I’ll do the resource manager and the ALAP for Adriaan’s problem. I’ll not take out the ’sub optimality’, that requires real thinking how to do that best in the current context. You can use the scheduler tests in tests/test_mapper.cchttp://test_mapper.cc but I won’t have more; can you write some?
Best,
Hans
Op 17 sep. 2018, om 08:57 heeft Imran Ashraf notifications@github.com<mailto:notifications@github.com> het volgende geschreven:
yes, it tests will be added to check the correctness
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/QE-Lab/OpenQL/issues/166#issuecomment-421908177, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQcwth6XM9iP3F4XdHTsOtx2Yc-i7H_kks5ub0fsgaJpZM4WnFYw.
@jvansomeren sub-optimality can be dealt with later. right now what is blocking @AdriaanRol is a working version of ALAP. So it will be great if you can take care of it.
Now when you are implementing it, without tests how will you make sure if it is working or not. so I will suggest you add the tests to check the its functionality.
@imranashraf @jvansomeren , this issue is still blocking our OpenQL update for PycQED and we are starting to see diverging branches. Is there any progress on this issue?
@AdriaanRol, yes, @jvansomeren updated the resource manager for this task and @lriesebos helped him write python tests on https://github.com/QE-Lab/OpenQL/tree/bug/alap-schedule-166 branch. It is working as expected. There are some questions/clarifications which I need to discuss with hans. Apart from that there are also failing tests (not ALAP related) which I am having a look at right now. will update you once done.
@imranashraf
OpenQL version 0.5.1. Below is a self contained example showing ALAP (As Late As Possible) scheduling not working as expected. The single qubit gates are expected to be played as late as possible, resulting in the gates appearing right before the measurement. Changing the scheduler option from ALAP to ASAP does not change the generated output.
The scheduling option can correctly be set using
ql.set_option("scheduler", "ALAP")
and read back usingql.get_option("scheduler")
. Using "ALAP" scheduling the following openQL program:Produces the following output