-
Notifications
You must be signed in to change notification settings - Fork 64
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
A clear directory structure to make it simpler to add new processors #217
Comments
I've also found the current structure a little bit tricky to navigate. Would it be possible to use one file per Hamiltonian model? Often the processor and model share concepts implicitly (e.g. structure of Hamiltonian and its terms) or explicitly (e.g. relying on the presence of methods or variables), so it would be nice to keep them together. It would also be nice to make it clearer what the APIs for the Model and Processor are, by having simple base classes that don't implement the methods themselves and make it clear what implementations should overwrite. It would also be good for the functionality to be aggregated rather than inherited. E.g. If there is shared functionality, put it in a separate module, function or class, rather than having inheritance of complex behaviour. These models are a super useful and important part of qutip-qip. |
@hodgestar I agree that the model and processor belong together. But still it is very nice to be able to clearly just read the model out, get the Hamiltonians etc and therefore I am more inclined to keep it separate as a model.py file. I agree that we could have a better structure and perhaps make one folder per Hamiltonian/device, e.g.,
The part about making the API clearer is also valid. E.g., I want to know that in the Model, I only need to define how to set the |
Having the model and processor classes in one file doesn't prevent them being used independently. |
Thank you both!
I agree that a structure like this makes it easier to import different modules for the same processor.
The problem I experienced with this structure is that if two processors share the same model/noise/transpiler, one has to create a Base processor for it. If
Yes, I agree that creating a folder for each of them makes the structure clearer. There is a lot that can be improved on the naming. About
I'm wondering which one is better, the one above or the current one
with |
I quite like the more split out one:
we can always introduce simple functions or classes to make it easier for new users to produce them, e.g.
|
I also quite like the following design @hodgestar
But I faced an issue where the compiler must know the I don't know what will be the best design for the individual parts. E.g., should the @BoxiLi I am developing a new processor and can work on this over the next few weeks. We could work out these details to also update the qutip-qip module as a whole. Do you have some time to discuss these things in detail? |
I was also thinking that we should make the I am reading up on abstract classes in Python here: |
Yes... That is true, to initialize the compiler it needs the hardware parameters. Getting What I usually do is to first define
That is great! We could do e.g. next week? |
Hi @BoxiLi I am starting to build new devices and noticed that we have a slightly split file/directory structure for the pulse-level simulation code that could be more modular/compact. In any new device, I use the following code structure:
In many cases, these files will just use the qutip-qip code, e.g., the qutip-qip scheduler or the ZZCrossTalk noise. But nevertheless, having this clear folder structure makes things very easy to develop when adding new simulators. Different people working on different aspects of the processor can work independently.
In the code right now, we have files that are spread over different folders, e.g., device/modelprocessor.py that could be processor/modelprocessor.py. Similarly noise.py is just a file and perhaps coule be noise/coherent.py, noise/crosstalk.py. Similarly we have a scheduler in the compiler/scheduler.py as well as a scheduler folder.
I propose to slowly restructure the folder in the main qutip-qip under model, processor, compiler, scheduler, noise and a transpiler folder structure. E.g.:
What do you think?
The text was updated successfully, but these errors were encountered: