Code overview

The Qibo framework in this repository implements a common system to deal with classical hardware and future quantum hardware.


The code abstraction is located in qibo/abstractions and the core simulation engine is located in qibo/core. This simulation engine uses an abstract backend object K to perform calculation the structure of which is defined in qibo/backends/

Including a new backend

New backends can be implemented by inheriting the qibo.backends.abstract.AbstractBackend and implementing its abstract methods. In particular the developer should:

  • Perform an AbstractBackend inheritance.

  • Register the new backend in src/qibo/backends/profiles.yml, or point to a new profile file with the environment flag QIBO_PROFILE.

  • Load your backend with qibo.set_backend("your_backend_name") or use the environment flag QIBO_BACKEND="your_backend_name".

Here you have an example for the structure of the profile.yml file:

# simulation backends - numpy is available by default
- name: tensorflow
    class: TensorflowBackend
    from: qibo.backends.tensorflow

- name: qibotf
    class: TensorflowCustomBackend
    from: qibo.backends.tensorflow

- name: qibojit
    class: JITCustomBackend
    from: qibo.backends.jit

# hardware backends
- name: qiboicarusq
    class: IcarusQBackend
    from: qibo.backends.hardware
    is_hardware: True

# default active backend after importing all modules
default: qibojit

When including a new backend, you should include its:

  • name: The name of the new backend.

  • class: The class which performs the inheritance from AbstractBackend.

  • from: The python module containing the value pointed by the class key.

Finally, the default backend which is loaded when importing Qibo can be updated by changing the value of the default: key.

Examples and tutorials

The examples folder contains benchmark code for applications/tutorials described in Applications while examples/benchmarks contains some code for benchmarking only.