DiCarloLab-Delft / PycQED_py3

Python3 version of PycQED using QCoDeS as backend
MIT License
68 stars 41 forks source link

Discussion on Waveform Generation in Software & Hardware #14

Closed gtaifu closed 7 years ago

gtaifu commented 8 years ago

In the meeting yesterday, I have the some ideas about the pulse generation.

Software & Hardware Implementation Separation

There should be a separation between the hardware implementation of the pulse generation and software waveform definition.

For example, the following waveform generation framework would support this separation:

shs

Here I suggest a QuTech Uniform Waveform Format and a Generation Interface. The interface is written in Python in QCoDeS. The uniform format can be derived from the waveform format of AWG5014, CBox and QWG. Universality and simplicity are the two most important metrics for this uniform waveform format.

Every kind of AWG receives waveform in its predefined format translated by dedicated waveform translator from the QuTech Uniform Waveform Format. For example, AWG5014 receives a list of samples which may last for several milliseconds in its own format file, and CBox receives the eight groups of samples indicating eight pulses and timing tape [(pulse number, interval), ...] presenting the combination of pulses. For most of the devices, dedicated waveform translators have already been developed in QCoDeS.

In the upper layer, every user can easily write his own waveform generating function based on the Uniform Waveform Generation Interface. Specifying the time is based on 1) the absolute time, 2) the interval between consecutive pulses or 3) the interval between the starting points of two consecutive pulses can be determined by the user-defined wave generation functions.

(If experiments only invoke waveforms in the QuTech Uniform Waveform Format, it could free the programmer to generate waveforms in more flexible methods. However, this assumption implies an idea: generating waveform and using waveform should be separated. I don't know if it is feasible in experiment.)

In this way, the software implementation is independent of the hardware implementation, and every user can have his own preferred way to generate the waveform based on the experiment requirements. If there come any new devices, only dedicated waveform translator requires to be developed, and all upper layer software structure requires little change.

However, developing such kind of waveform format might be timing-consuming. I cannot estimate the pros & cons of this method at this stage.

Uniform Waveform Format Definition

Defining the format would be the most unclear part. It should possess the following properties: Can be easily translated into AWG5014/CBox_AWG/QWG waveform format. Flexible configuration parameters:

I cannot go into too much detail because 1) I have little experience in carrying on experiments; 2) we are not sure if this method would help and further this proposal is going to be taken or not.

We can have more discussion on this.

nklangford commented 8 years ago

I have a few brief thoughts to start with:

1) I think it's a very good idea to use a waveform description which allows different ways of defining pulse timing. It would be almost impossible now for us to make a decision now to choose one way over the other which would not later prove to be deficient in some way, especially since none among us actually have enough experience with all elements of experimental pulse sequencing to make a sufficiently well-informed judgement.

2) We heard Adriaan yesterday talking about "pulses", "pulse lists", "channels", "segments", "sequences", etc. These run from one end, the relatively abstract end, where pulses and pulse sequences are defined in terms of which quantum object they ought to act on, to the more physical end, such as a "channel", which refers more to a specific physical input into the fridge or device. We know that individual pulses mostly (though not always) relate to a specific device element. Channels relate to a physical input. Device elements (e.g., a qubit) can often be addressed by multiple channels (flux line, direct drive line, readout resonator/feedline). However, one channel may also address multiple device elements (e.g., a single feedline which couples to multiple qubits, or a global external flux). I suggest we need to define an intermediate level, called something like signal "streams". This would allow some flexibility in terms of how pulse sequences may be combined on individual channels. For example, even if one feedline is used to both drive and readout multiple qubits, each of these functions could be separated out into individual streams. The channel would then contain information about which streams contribute to it and rules for combining them. However, it can also be quite powerful to have the flexibility to define multiple streams for a single task (e.g., device element / channel combination), because sometimes it is convenient to describe a drive pulse sequence for an individual qubit as a combination of sequences in different paradigms. There's no reason, for example, why, on an AWG, one might not wish to address multiple qubit transitions simultaneously, but it may be much simpler to define the logic of those sequences independently.

3) I think it is unlikely that one would want to mix "absolute pulse timing" with "relative pulse timing" in an individual signal "stream". So it may be that one would assign a "timing method" per stream.

4) I know that Adriaan has already put quite a lot of effort into updating and implementing the python sequencer. But if this step is as important as we all seem to agree it is, I think it's important not to limit the discussion based on what directions have already been taken. I'm pretty sure Adriaan agrees with me on this. Adriaan?

5) I know everyone is quite intimidated by the mathematica sequencer. And I am only too aware of some of the frustrations of working with it. And furthermore I completely agree that we need to have an integrated python based sequencer. However, to give some context to Adriaan's and Niels' assessments that the python sequencer is "easy" or "easier", I would make the following observation. From what I understand, it took me a similar amount of time (a day or few) to familiarise myself with the mathematica sequencer in all its existing complexity, once I dedicated the time to do it, to what it took Adriaan to familiarise himself with and start using the python sequencer in arguably a much simpler form. And that was despite the fact that I was not very familiar with mathematica at the start of the process, by comparison with Adriaan's existing expertise in python. The main problem we had with "ease of use" of the mathematica code, is that we were mostly learning it without having someone sufficiently knowledgeable to show us the ropes. My point is that we are not trying to sell why we should move away from the mathematica sequencer, so we should avoid making easy but possibly misleading comparisons.

6) Universality and simplicity are good metrics, but I don't think are enough. Intuitiveness, which is different from simplicity, and flexibility, which is different from universality, are also critical. Also, where possible and where beneficial, we should maintain the ability to design sequences in a way which is reflective of the underlying experimental structure / hardware we are dealing with. This is related also to flexibility.

Okay, this didn't end up being all that brief, but I'll sign off now.

nklangford commented 8 years ago

On another note, Wouter / Xiang / Jakob, when designing something like a CBox or QWG, how constrained are we to having pulses which act sequentially, as opposed to simultaneously? In the AWG, it is obviously possible to define a pulse sequence which is the sum of two independently defined sequences (e.g., on a single channel). Would that always require the definition of a new "sum pulse" and playing that sequentially, or would it be possible to tell the QWG "play pulses 1 and 4 simultaneously".

wvlothuizen commented 8 years ago

I'am not aware of the AWG (e.g. 5014) being able to sum sequences. Generally I'd say that it would be better to perform such an addition at compile time (i.e. during waveform generation), because that saves hardware resources, and allows better handling of overflows (i.e. the addition exceeding the dynamic range of the DAC).

Regarding the 'Uniform Waveform Interface', I think that it should also support the concepts of repetition, variable delay, conditional execution, etc. in order to be able to make use of the intelligent sequencers that we - and also ZI - have. It is much easier to generate a static sequence for the 5014 from such a definition, than it would be the other way round.

Another question is how to expose the hardware to the user. In the QuSurf project, we will have a Central Controller spitting out codewords and triggers to (e.g.) an AWG. For the user, it might prove beneficial to not be bothered with these details, but just be able to play a waveform on a composite object.

Wouter — The best way to predict the future is to invent it Alan Kay

On 14 Apr 2016, at 23:30, nathanlangford notifications@github.com<mailto:notifications@github.com> wrote:

On another note, Wouter / Xiang / Jakob, when designing something like a CBox or QWG, how constrained are we to having pulses which act sequentially, as opposed to simultaneously? In the AWG, it is obviously possible to define a pulse sequence which is the sum of two independently defined sequences (e.g., on a single channel). Would that always require the definition of a new "sum pulse" and playing that sequentially, or would it be possible to tell the QWG "play pulses 1 and 4 simultaneously".

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHubhttps://github.com/DiCarloLab-Delft/PycQED_py3/issues/14#issuecomment-210156525

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.

nklangford commented 8 years ago

@wvlothuizen

Regarding the AWG, that's exactly what I was talking about. The point, as I see it, is to design a way of writing sequences in a way which is flexible, intuitive and relevant which can then be mapped to different types of hardware using a driver to interpret them. And because the AWG sequences are digitised and precompiled, creating a sequence which contains independent pulses acting simultaneously on a single channel is straightforward, providing you don't create problems with clipping, etc. As you say, you just do it at the point of compiling.

By contrast, as I understand it, something like a QWG or Cbox with a "codeword" triggered sequence wouldn't easily have this flexibility. You would need to create a new codeword for each different pulse combination you wanted to drive simultaneously. And if, say, the constituent pulses had different sideband modulation frequencies, then even pairs of the same types of pulses played at different times may require different codewords. Any such composite pulse, I think, would effectively be a new entity. Am I right?

If so, is there any way around this? Or would we just need our drivers to be clever enough to identify different types of "illegal" combinations for different instruments?

I agree also that it is I think very important that any sequencing description should compatible with playing sequences to combinations of different types of pulse hardware. The experimentalist should not be restricted to working with all AWGs or all Cboxes.

AdriaanRol commented 8 years ago

@gtaifu , @nathanlangford @wvlothuizen @cdickel Ok, a bit late but here is my reply. Let me start with the format proposed by Xiang.

Waveform format /sequencer

I think a general waveform format is a good idea and something we should definitely have. However I see two challenges that make this a bit harder.

  1. Information on absolute timing is required for modulation, making it hard to define primitives
  2. The history of a channel is required to calculate the corrections for flux pulsing (@nathanlangford is this correct?)

There are two known solutions to 1, extract timing and calculate modulation at compile time or have an active modulation source in the waveform generator to apply the modulation at runtime (@wvlothoizen, how do I apply a pulse with a different phase in that case).

I do not fully understand the implications yet of 2 but it sounds like this is something that can only be solved at compile time, and depending on the density of pulses and how far back in time the corrections go this is a very computationally intense task.

Defining the format would be the most unclear part. It should possess the following properties: Can be easily translated into AWG5014/CBox_AWG/QWG waveform format. Flexible configuration parameters:

@gtaifu I would like to propose to modify the proposed format by separating the pulse-information from the sequence-information. This relates to the discussion I had with @nathanlangford on timing as well. So let me explain.

To me there is a clear notion of a pulse, let's take for example the pi-pulse around the x-axis, X180. This pulse can occur at multiple places in a sequence and have different timings, however it would always have the same phase, amplitude, DRAG and modulation frequency. To me it would make sense to separate the pulse, that contains the aforementioned parameters, from the sequence, that contains information on the timing, repetitions and conditionality statements.

The counterargument of Nathan could be the Rabi sequence, in which case not the time of the pulse but the amplitude of the pulse is varied. My reply would then be that in that case you are indeed playing different pulses, to which he could point out the same about it being a different pulse if played at a different time. Ultimately the distinction between pulse-and sequence is artificial but I think it is a powerful distinction because it reduces the complexity when working with larger sequences.

Nathan's comments

1) I think it's a very good idea to use a waveform description which allows different ways of defining pulse timing.

In the sequencer I am currently using (as made by Wolfgang) you can specify timing with respect to any pulse in the sequence (including the start of the sequence). Additionally you can specify timing either with respect to the 'start', 'end' or 'center' of a pulse. I think this allows for very flexible ways of specifying timing and is an idea that we can adopt. In the example I showed I chose to set the start of pulses as a default to reduce complexity.

2) ... I suggest we need to define an intermediate level, called something like signal "streams".

I am a bit confused by streams, what exactly are they? And in what sense do they reduce complexity?

3)

Absolute timing is relative to start? No special case needed

4)

Agreed

6) Intuitivity and Flexibility vs Simplicity and Universality

I think the criteria @nathanlangford sketches are the ones we should strive for but are very subjective, however I think that the ones @gtaifu sketches are the computer scientist's objective equivalent of these concepts.

Next steps

Things that we need to do + my estimate on how far we are along that direction

AdriaanRol commented 7 years ago

Closing this issue as we have had enough discussion on this to have a clear view on what it looks like.

We are going for a three step compilation sequence consisting of QASM->time-grid->ASM (this was discussed with @cdickel, @gtaifu and Bertels group )