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

IBM Simulated device + Shots/Precision fix + IBM Noisy Expectation Value + Upgrade packages #97

Merged
merged 77 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
3a573ed
feat: setting up the branch
hJaffaliColibritd Oct 11, 2024
8307635
feat: constructing dynamically the enum for fake devices
hJaffaliColibritd Oct 13, 2024
847d76d
chore: Files formated
github-actions[bot] Oct 13, 2024
0df0a6a
fix: re-put IBMDevice as accepted devices for noisy simulations
hJaffaliColibritd Oct 14, 2024
72da413
Merge remote-tracking branch 'origin/feat-qiskit-device-noisemodel' i…
hJaffaliColibritd Oct 14, 2024
5cebe8d
feat: adding IBMSimulatedDevice to the execution pipeline
hJaffaliColibritd Oct 14, 2024
2e49e2c
chore: Files formated
github-actions[bot] Oct 14, 2024
a0c7c38
chore: add TODO
hJaffaliColibritd Oct 14, 2024
9192371
Merge remote-tracking branch 'origin/feat-qiskit-device-noisemodel' i…
hJaffaliColibritd Oct 14, 2024
58c3d98
chore: add change file name
hJaffaliColibritd Oct 14, 2024
0d9f663
feat: move the simulated device to devices.py
hJaffaliColibritd Oct 15, 2024
da2d1be
chore: Files formated
github-actions[bot] Oct 15, 2024
a206698
fix: fixing the execution pipeline
hJaffaliColibritd Oct 15, 2024
25152fc
Merge remote-tracking branch 'origin/feat-qiskit-device-noisemodel' i…
hJaffaliColibritd Oct 15, 2024
c1b75c1
chore: Files formated
github-actions[bot] Oct 15, 2024
33f8aaf
chore: remove 'simulated_device.py', duplicated code
MoHermes Oct 15, 2024
368877a
fix: device support IBMSimulatedDevice type
MoHermes Oct 15, 2024
f53e714
fix: add support for IBMSimulatedDevice
MoHermes Oct 15, 2024
3e928a2
chore: elarge to SimulatedDevice
hJaffaliColibritd Oct 16, 2024
da4e2a8
chore: Files formated
github-actions[bot] Oct 16, 2024
a9b53e9
chore: refactoring the code and solving observable issues
hJaffaliColibritd Oct 16, 2024
85492c6
Merge remote-tracking branch 'origin/feat-qiskit-device-noisemodel' i…
hJaffaliColibritd Oct 16, 2024
d91c898
doc: update the doc
hJaffaliColibritd Oct 16, 2024
20b9031
chore: Files formated
github-actions[bot] Oct 16, 2024
459b370
chore: add todo for handling of noisy expectation measure
hJaffaliColibritd Oct 17, 2024
0d3af6c
Merge remote-tracking branch 'origin/feat-qiskit-device-noisemodel' i…
hJaffaliColibritd Oct 17, 2024
721db3d
feat: try to fix the expectation value
hJaffaliColibritd Oct 18, 2024
0e5312f
chore: Files formated
github-actions[bot] Oct 18, 2024
b806739
doc: update docstring for simulated devices
hJaffaliColibritd Oct 18, 2024
bef5133
Merge remote-tracking branch 'origin/feat-qiskit-device-noisemodel' i…
hJaffaliColibritd Oct 18, 2024
1942679
chore: Files formated
github-actions[bot] Oct 18, 2024
d006e9b
fail: trying to fix the observable job for simulated deviec but failed
hJaffaliColibritd Oct 21, 2024
71a11da
chore: Files formated
github-actions[bot] Oct 21, 2024
39d5636
feat: moving to only available hardware for ibm simulated devices
hJaffaliColibritd Oct 22, 2024
60a2c8a
chore: Files formated
github-actions[bot] Oct 22, 2024
6a0d08f
Merge remote-tracking branch 'origin/dev' into feat-qiskit-device-noi…
hJaffaliColibritd Nov 4, 2024
665299b
chore: small changes
hJaffaliColibritd Nov 4, 2024
93e3c9d
doc: update job device matrix for IBM
hJaffaliColibritd Nov 5, 2024
597b89d
fix: reverting changes from remote fake to local fake providers
hJaffaliColibritd Nov 8, 2024
a7f5694
fix: fixing the expectation value for IBMSimulatedDevice, still work …
hJaffaliColibritd Nov 8, 2024
cd71d11
chore: Files formated
github-actions[bot] Nov 8, 2024
f17e98a
chore: cleaning doc and imports
hJaffaliColibritd Nov 9, 2024
ee0d1f1
chore: Files formated
github-actions[bot] Nov 9, 2024
c4ed664
feat: updating the way of sending remote jobs using the pass_manager …
hJaffaliColibritd Nov 9, 2024
6ddcca0
fix: typecheck issues
hJaffaliColibritd Nov 10, 2024
27e4854
chore: Files formated
github-actions[bot] Nov 10, 2024
048e4b6
chore: adding todo
hJaffaliColibritd Nov 10, 2024
059b592
Merge remote-tracking branch 'origin/feat-qiskit-device-noisemodel' i…
hJaffaliColibritd Nov 10, 2024
5f2dd6c
fix: update the extraction of remote sampling job
hJaffaliColibritd Nov 10, 2024
e35828e
fix: fixing sampling job, and listing of devices
hJaffaliColibritd Nov 11, 2024
4b73742
fix: configure simulator options, add support for noisy simulations
MoHermes Nov 13, 2024
c178035
chore: remove unused imports
MoHermes Nov 13, 2024
2b7fd18
fix: exclude extended_stabilizer from test_observable_demo test
MoHermes Nov 13, 2024
425f957
chore: verify correct shots in simulations
MoHermes Nov 13, 2024
82fccb3
chore: remove resolved TODO's
MoHermes Nov 13, 2024
7b377b0
fix: fixing the number of shots in the remote execution
hJaffaliColibritd Nov 17, 2024
ff493a8
feat: raising an error when the circuit is bigger than the simulated …
hJaffaliColibritd Nov 18, 2024
bb84cef
test: adding test for IBMSimulatedDevices
hJaffaliColibritd Nov 18, 2024
2786f82
Merge remote-tracking branch 'origin/dev' into feat-qiskit-device-noi…
hJaffaliColibritd Nov 18, 2024
adcd798
fix: type error, remove unused 'transpile' import
MoHermes Nov 18, 2024
79119b8
fix: simplify pytest.raises
MoHermes Nov 18, 2024
8791c54
fix: safely handle missing 'twirling' in estimator options
MoHermes Nov 18, 2024
26d8991
doc: improvement to `compute_expectation_value`
Henri-ColibrITD Nov 19, 2024
ddbcebf
Merge branch 'feat-qiskit-device-noisemodel' of https://github.com/Co…
Henri-ColibrITD Nov 19, 2024
2e6c219
chore: update class name
MoHermes Nov 19, 2024
b579ca1
chore: remove .keys()
MoHermes Nov 19, 2024
2b07c97
chore: clean up
MoHermes Nov 19, 2024
9fb0345
doc: adding doc to simulated device.
hJaffaliColibritd Nov 19, 2024
c85ba3d
Merge branch 'feat-qiskit-device-noisemodel' of github.com:ColibrITD-…
hJaffaliColibritd Nov 19, 2024
b2903a4
chore: adjust doc and fix qiskit version
hJaffaliColibritd Nov 19, 2024
fa3f7be
Merge remote-tracking branch 'origin/dev' into feat-qiskit-device-noi…
hJaffaliColibritd Nov 20, 2024
a25e481
chore: remove obsolote TODO comment
MoHermes Nov 20, 2024
2ee54ba
Merge remote-tracking branch 'origin/dev' into feat-qiskit-device-noi…
hJaffaliColibritd Nov 20, 2024
f9fb88d
Merge remote-tracking branch 'origin/dev' into feat-qiskit-device-noi…
hJaffaliColibritd Nov 20, 2024
2e1cc1c
fix: fix name of inherited method
hJaffaliColibritd Nov 20, 2024
6b4d936
fix: fix extended stabilizer device with observable jobs
hJaffaliColibritd Nov 20, 2024
2476f36
chore: Files formated
github-actions[bot] Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/execution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ Devices

.. automodule:: mpqp.execution.devices

.. _SimulatedDevices:

Simulated Devices
-----------------

.. automodule:: mpqp.execution.simulated_devices

Running a circuit
-----------------

Expand Down
3 changes: 3 additions & 0 deletions docs/noise.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ We strongly encourage the user to have a look at the
details about the manipulation, usage, and simulation of noise models are
presented.

For more details on how to use noise models taken from real hardware, you can
look at :ref:`SimulatedDevices`.

.. code-block:: python
:class: import

Expand Down
18 changes: 6 additions & 12 deletions docs/resources/job-device_compat.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,22 @@ IBM ,AER_SIMULATOR ,✓ ,✓ ,✓
IBM ,AER_SIMULATOR_STATEVECTOR ,✓ ,✓ ,✓ ,✓
IBM ,AER_SIMULATOR_DENSITY_MATRIX ,✓ , ,✓ ,✓
IBM ,AER_SIMULATOR_STABILIZER ,✓ , ,✓ ,✓
IBM ,AER_SIMULATOR_EXTENDED_STABILIZER ,✓ ,✓ , ,✓
IBM ,AER_SIMULATOR_EXTENDED_STABILIZER ,✓ ,✓ , ,
IBM ,AER_SIMULATOR_MATRIX_PRODUCT_STATE,✓ ,✓ ,✓ ,✓
IBM ,IBM_BRISBANE ,✓ , ,✓ ,
IBM ,IBM_OSAKA ,✓ , ,✓ ,
IBM ,IBM_KYOTO ,✓ , ,✓ ,
IBM ,IBM_SHERBROOKE ,✓ , ,✓ ,
IBM ,IBM_KYIV ,✓ , ,✓ ,
IBM ,IBM_NAZCA ,✓ , ,✓ ,
IBM ,IBM_CUSCO ,✓ , ,✓ ,
IBM ,IBM_ITHACA ,✓ , ,✓ ,
IBM ,IBM_TORINO ,✓ , ,✓ ,
IBM ,IBM_QUEBEC ,✓ , ,✓ ,
IBM ,IBM_KAWASAKI ,✓ , ,✓ ,
IBM ,IBM_CLEVELAND ,✓ , ,✓ ,
IBM ,IBM_CAIRO ,✓ , ,✓ ,
IBM ,IBM_HANOI ,✓ , ,✓ ,
IBM ,IBM_ALGIERS ,✓ , ,✓ ,
IBM ,IBM_KOLKATA ,✓ , ,✓ ,
IBM ,IBM_MUMBAI ,✓ , ,✓ ,
IBM ,IBM_PEEKSKILL ,✓ , ,✓ ,
IBM ,IBM_RANDOM_SMALL_DEVICE ,✓ , ,✓ ,
IBM ,IBM_SMALL_DEVICES_LEAST_BUSY ,✓ , ,✓ ,
IBM ,IBM_RENSSELAER ,✓ , ,✓ ,
IBM ,IBM_BRUSSELS ,✓ , ,✓ ,
IBM ,IBM_STRASBOURG ,✓ , ,✓ ,
IBM ,IBM_FEZ ,✓ , ,✓ ,
IBM ,IBM_LEAST_BUSY ,✓ , ,✓ ,
Atos ,MYQLM_PYLINALG ,✓ ,✓ ,✓ ,✓
Atos ,MYQLM_CLINALG ,✓ ,✓ ,✓ ,✓
Atos ,QLM_LINALG ,✓ ,✓ ,✓ ,✓
Expand Down
3 changes: 3 additions & 0 deletions mpqp/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
IBMDevice,
AZUREDevice,
)
from .execution.simulated_devices import IBMSimulatedDevice
from .execution.remote_handler import get_all_job_ids
from .execution.vqa import Optimizer, minimize
from .gates import (
Expand Down Expand Up @@ -69,6 +70,8 @@
from .measures import Z as Zop
from .noise import AmplitudeDamping, BitFlip, Depolarizing, PhaseDamping
from .qasm import open_qasm_file_conversion_2_to_3, open_qasm_hard_includes
from .tools.circuit import random_circuit
from .tools.display import pprint

theta, k = symbols("θ k")
obs = Observable(np.array([[0, 1], [1, 0]]))
Expand Down
15 changes: 7 additions & 8 deletions mpqp/execution/connection/ibm_connection.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from getpass import getpass
from typing import TYPE_CHECKING

from mpqp.execution.connection.env_manager import get_env_variable, save_env_variable
from mpqp.execution.devices import IBMDevice
from mpqp.tools.errors import IBMRemoteExecutionError
from termcolor import colored
from typeguard import typechecked

if TYPE_CHECKING:
from qiskit.providers.backend import BackendV2
from qiskit_ibm_runtime import QiskitRuntimeService

from mpqp.execution.connection.env_manager import get_env_variable, save_env_variable
from mpqp.execution.devices import IBMDevice
from mpqp.tools.errors import IBMRemoteExecutionError

Runtime_Service = None

Expand Down Expand Up @@ -158,7 +158,7 @@ def get_backend(device: IBMDevice) -> "BackendV2":
parameter.

Args:
device: The IBMDevice to get from IBMQ provider.
device: The IBMDevice to get from the qiskit Runtime service.

Returns:
The requested backend.
Expand All @@ -175,15 +175,15 @@ def get_backend(device: IBMDevice) -> "BackendV2":

"""
if not device.is_remote():
raise ValueError("Expected a remote IBMQ device but got a local simulator.")
raise ValueError("Expected a remote IBM device but got a local simulator.")
from qiskit.providers.exceptions import QiskitBackendNotFoundError

service = get_QiskitRuntimeService()

try:
if device == IBMDevice.IBM_LEAST_BUSY:
return service.least_busy(operational=True)
return service.get_backend(device.value)
return service.backend(device.value)
except QiskitBackendNotFoundError as err:
raise IBMRemoteExecutionError(
f"Requested device {device} not found. Verify if your instances "
Expand All @@ -209,6 +209,5 @@ def get_all_job_ids() -> list[str]:

"""
if get_env_variable("IBM_CONFIGURED") == "True":
return [job.job_id() for job in get_QiskitRuntimeService().jobs()]

return [job.job_id() for job in get_QiskitRuntimeService().jobs(limit=None)]
return []
40 changes: 23 additions & 17 deletions mpqp/execution/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,29 @@ class IBMDevice(AvailableDevice):
AER_SIMULATOR_EXTENDED_STABILIZER = "extended_stabilizer"
AER_SIMULATOR_MATRIX_PRODUCT_STATE = "matrix_product_state"

IBM_BRISBANE = "ibm_brisbane"
IBM_OSAKA = "ibm_osaka"
IBM_KYOTO = "ibm_kyoto"

IBM_SHERBROOKE = "ibm_sherbrooke"
IBM_BRISBANE = "ibm_brisbane"
IBM_KYIV = "ibm_kyiv"
IBM_NAZCA = "ibm_nazca"
IBM_CUSCO = "ibm_cusco"
IBM_ITHACA = "ibm_ithaca"
IBM_TORINO = "ibm_torino"
IBM_QUEBEC = "ibm_quebec"

IBM_FEZ = "ibm_fez"
IBM_RENSSELAER = "ibm_rensselaer"
IBM_BRUSSELS = "ibm_brussels"
IBM_KAWASAKI = "ibm_kawasaki"
IBM_QUEBEC = "ibm_quebec"
IBM_TORINO = "ibm_torino"
IBM_NAZCA = "ibm_nazca"
IBM_STRASBOURG = "ibm_strasbourg"

# RETIRED - IBM_OSAKA = "ibm_osaka"
# RETIRED - IBM_KYOTO = "ibm_kyoto"
# RETIRED - IBM_CUSCO = "ibm_cusco"
# RETIRED - IBM_ITHACA = "ibm_ithaca"
IBM_CLEVELAND = "ibm_cleveland"
IBM_CAIRO = "ibm_cairo"
IBM_HANOI = "ibm_hanoi"
IBM_ALGIERS = "ibm_algiers"
IBM_KOLKATA = "ibm_kolkata"
IBM_MUMBAI = "ibm_mumbai"
# RETIRED - IBM_CAIRO = "ibm_cairo"
# RETIRED - IBM_HANOI = "ibm_hanoi"
# RETIRED - IBM_ALGIERS = "ibm_algiers"
# RETIRED - IBM_KOLKATA = "ibm_kolkata"
# RETIRED - IBM_MUMBAI = "ibm_mumbai"
IBM_PEEKSKILL = "ibm_peekskill"

IBM_LEAST_BUSY = "ibm_least_busy"
Expand All @@ -131,7 +136,6 @@ def is_remote(self) -> bool:

def is_gate_based(self) -> bool:
return True
# return self != IBMDevice.PULSE_SIMULATOR

def has_reduced_gate_set(self) -> bool:
return self in {
Expand Down Expand Up @@ -163,15 +167,17 @@ def supports_state_vector(self) -> bool:
}

def supports_observable(self) -> bool:
return True
return self not in {
IBMDevice.AER_SIMULATOR_EXTENDED_STABILIZER,
}

def supports_observable_ideal(self) -> bool:
return self in {
IBMDevice.AER_SIMULATOR,
IBMDevice.AER_SIMULATOR_STATEVECTOR,
IBMDevice.AER_SIMULATOR_DENSITY_MATRIX,
IBMDevice.AER_SIMULATOR_STABILIZER,
IBMDevice.AER_SIMULATOR_EXTENDED_STABILIZER,
# IBMDevice.AER_SIMULATOR_EXTENDED_STABILIZER,
IBMDevice.AER_SIMULATOR_MATRIX_PRODUCT_STATE,
}

Expand Down
Loading