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

Fast forward experimental-0.2 #1389

Merged
merged 77 commits into from
Feb 7, 2024
Merged

Conversation

jyu00
Copy link
Collaborator

@jyu00 jyu00 commented Feb 7, 2024

Summary

Fast forward experimental-0.2 to make it Qiskit 1.0 compatible.

Details and comments

Fixes #

ElePT and others added 30 commits November 16, 2023 12:07
)

* Migrate fake provider

* fix lint

* Only migrate backends and fake_provider file to minimize duplication

* Add reno

* Update snippet to use runtime service

---------

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
* try/except raw result truncation

* catch typeError

* revert try/except, use response.text

* update unit test
* Clean up/fix integration test

* Update test case

* Fix black
* Added deprecation warning when using qiskitrc file

* Fixed bug whereby deprecation warnings cause failure for all 'qiskit*' modules. Changed warning to deprecation warning.

* Release note

* Small grammer fix

* black

---------

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
* update session.from_id()

* add deprecation warning

* add reno
* Revert "Update session.from_id() (Qiskit#1163)"

This reverts commit 8fa0472.

* add reno
* initial removal

* cleanup more files

* move result_decoder

* fix lint

* update unit tests

* update integration tests

* more docs changes

* release note

* fix path

---------

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
* Make sessions thread safe.

The lock prevents other threads from sending new jobs to the service
only if the session hasnot been setup yet. I.e.: when sending the
first "session starter job", or root job. After this happens, the code
is left unlocked to allow threads to access the service concurrently.

Error handling is needed to ensure the lock is always released.

* Allow multiple sessions to execute simultaneously

* Make session test more deterministic

---------

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
* compare cloud instance with channel strategy

* fix unit tests

* error wording

---------

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
* release notes

* fix release
* Add job.properties() method

* add reno
This is the same as Qiskit/qiskit#11352. Now that qiskit.org/ecosystem/ibm-runtime redirects to docs.quantum.ibm.com, we can simplify the docs. 

See the PR description in Qiskit/qiskit#11352 for details on the motivation for each change. The only difference from Qiskit is that we still keep the tutorials around because learning.quantum.ibm.com uses them.

I used a script with `ripgrep` to confirm that none of the images were in use.
* Error if backend not in instance

* add reno

* update reno

* docs build

* fix docs again

* docs formatting :/

* add integration test

* Update test/integration/test_backend.py

Co-authored-by: merav-aharoni <merav@il.ibm.com>

* Update test/integration/test_backend.py

Co-authored-by: merav-aharoni <merav@il.ibm.com>

---------

Co-authored-by: merav-aharoni <merav@il.ibm.com>
* The transpilation tutorial has been updated to use the new runtime transpilation passes, and Batch

* Fix style checker

* Updated names

* Updated section names for transpiled tutorial

* Updated grover

* Fixed consistency

* Final updates

---------

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
* add pointer to qiskit/documentation issues

* Update .github/ISSUE_TEMPLATE/config.yml

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>

* Update CONTRIBUTING.md

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>

---------

Co-authored-by: Kevin Tian <kt474@cornell.edu>
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
* wip debug wrong instance test

* enable integration test

* use backend names instead of obj
* don't block if backend not selected

* add reno

* add test
* add activated_at to session.details()

* add reno
…skit#1267)

* Revert "Don't block for the first job in a session (Qiskit#1170)"

This reverts commit f2e24e4.

* keep test
kaelynj and others added 24 commits January 29, 2024 15:00
### Summary
The documentation from the `transpile` and `fake_provider` modules does not appear in the rendered docs in qiskit.org/documentation or docs.quantum-computing.ibm.com.


### Details and comments

Fixes [Qiskit Docs Issue Qiskit#238](Qiskit/documentation#238)

Replaces PR Qiskit#1330.

Transpiler Doc files added:

 - qiskit_ibm_runtime.transpiler.passes.html
- qiskit_ibm_provider.transpiler.passes.basis.html
- qiskit_ibm_provider.transpiler.passes.scheduling.ALAPScheduleAnalysis.html
- qiskit_ibm_provider.transpiler.passes.scheduling.ASAPScheduleAnalysis.html
- qiskit_ibm_provider.transpiler.passes.scheduling.BlockBasePadder.html
- qiskit_ibm_provider.transpiler.passes.scheduling.DynamicCircuitInstructionDurations.html
- qiskit_ibm_provider.transpiler.passes.scheduling.html
- qiskit_ibm_provider.transpiler.passes.scheduling.PadDelay.html
- qiskit_ibm_provider.transpiler.passes.scheduling.PadDynamicalDecoupling.html

<details>
<summary> Fake Provider Docs added: </summary>

- qiskit_ibm_runtime.fake_provider.FakeAlmaden.html
- qiskit_ibm_runtime.fake_provider.FakeAlmadenV2.html
- qiskit_ibm_runtime.fake_provider.FakeArmonk.html
- qiskit_ibm_runtime.fake_provider.FakeArmonkV2.html
- qiskit_ibm_runtime.fake_provider.FakeAthens.html
- qiskit_ibm_runtime.fake_provider.FakeAthensV2.html
- qiskit_ibm_runtime.fake_provider.FakeAuckland.html
- qiskit_ibm_runtime.fake_provider.FakeBelem.html
- qiskit_ibm_runtime.fake_provider.FakeBelemV2.html
- qiskit_ibm_runtime.fake_provider.FakeBoeblingen.html
- qiskit_ibm_runtime.fake_provider.FakeBoeblingenV2.html
- qiskit_ibm_runtime.fake_provider.FakeBogota.html
- qiskit_ibm_runtime.fake_provider.FakeBogotaV2.html
- qiskit_ibm_runtime.fake_provider.FakeBrooklyn.html
- qiskit_ibm_runtime.fake_provider.FakeBrooklynV2.html
- qiskit_ibm_runtime.fake_provider.FakeBurlington.html
- qiskit_ibm_runtime.fake_provider.FakeBurlingtonV2.html
- qiskit_ibm_runtime.fake_provider.FakeCairo.html
- qiskit_ibm_runtime.fake_provider.FakeCairoV2.html
- qiskit_ibm_runtime.fake_provider.FakeCambridge.html
- qiskit_ibm_runtime.fake_provider.FakeCambridgeV2.html
- qiskit_ibm_runtime.fake_provider.FakeCasablanca.html
- qiskit_ibm_runtime.fake_provider.FakeCasablancaV2.html
- qiskit_ibm_runtime.fake_provider.FakeEssex.html
- qiskit_ibm_runtime.fake_provider.FakeEssexV2.html
- qiskit_ibm_runtime.fake_provider.FakeGeneva.html
- qiskit_ibm_runtime.fake_provider.FakeGuadalupe.html
- qiskit_ibm_runtime.fake_provider.FakeGuadalupeV2.html
- qiskit_ibm_runtime.fake_provider.FakeHanoi.html
- qiskit_ibm_runtime.fake_provider.FakeHanoiV2.html
- qiskit_ibm_runtime.fake_provider.FakeJakarta.html
- qiskit_ibm_runtime.fake_provider.FakeJakartaV2.html
- qiskit_ibm_runtime.fake_provider.FakeJohannesburg.html
- qiskit_ibm_runtime.fake_provider.FakeJohannesburgV2.html
- qiskit_ibm_runtime.fake_provider.FakeKolkata.html
- qiskit_ibm_runtime.fake_provider.FakeKolkataV2.html
- qiskit_ibm_runtime.fake_provider.FakeLagos.html
- qiskit_ibm_runtime.fake_provider.FakeLagosV2.html
- qiskit_ibm_runtime.fake_provider.FakeLima.html
- qiskit_ibm_runtime.fake_provider.FakeLimaV2.html
- qiskit_ibm_runtime.fake_provider.FakeLondon.html
- qiskit_ibm_runtime.fake_provider.FakeLondonV2.html
- qiskit_ibm_runtime.fake_provider.FakeManhattan.html
- qiskit_ibm_runtime.fake_provider.FakeManhattanV2.html
- qiskit_ibm_runtime.fake_provider.FakeManila.html
- qiskit_ibm_runtime.fake_provider.FakeManilaV2.html
- qiskit_ibm_runtime.fake_provider.FakeMelbourne.html
- qiskit_ibm_runtime.fake_provider.FakeMelbourneV2.html
- qiskit_ibm_runtime.fake_provider.FakeMontreal.html
- qiskit_ibm_runtime.fake_provider.FakeMontrealV2.html
- qiskit_ibm_runtime.fake_provider.FakeMumbai.html
- qiskit_ibm_runtime.fake_provider.FakeMumbaiV2.html
- qiskit_ibm_runtime.fake_provider.FakeNairobi.html
- qiskit_ibm_runtime.fake_provider.FakeNairobiV2.html
- qiskit_ibm_runtime.fake_provider.FakeOslo.html
- qiskit_ibm_runtime.fake_provider.FakeOurense.html
- qiskit_ibm_runtime.fake_provider.FakeOurenseV2.html
- qiskit_ibm_runtime.fake_provider.FakeParis.html
- qiskit_ibm_runtime.fake_provider.FakeParisV2.html
- qiskit_ibm_runtime.fake_provider.FakePerth.html
- qiskit_ibm_runtime.fake_provider.FakePoughkeepsie.html
- qiskit_ibm_runtime.fake_provider.FakePoughkeepsieV2.html
- qiskit_ibm_runtime.fake_provider.FakePrague.html
- qiskit_ibm_runtime.fake_provider.FakeProviderForBackendV2.html
- qiskit_ibm_runtime.fake_provider.FakeProvider.html
- qiskit_ibm_runtime.fake_provider.FakeQuito.html
- qiskit_ibm_runtime.fake_provider.FakeQuitoV2.html
- qiskit_ibm_runtime.fake_provider.FakeRochester.html
- qiskit_ibm_runtime.fake_provider.FakeRochesterV2.html
- qiskit_ibm_runtime.fake_provider.FakeRome.html
- qiskit_ibm_runtime.fake_provider.FakeRomeV2.html
- qiskit_ibm_runtime.fake_provider.FakeRueschlikon.html
- qiskit_ibm_runtime.fake_provider.FakeSantiago.html
- qiskit_ibm_runtime.fake_provider.FakeSantiagoV2.html
- qiskit_ibm_runtime.fake_provider.FakeSherbrooke.html
- qiskit_ibm_runtime.fake_provider.FakeSingapore.html
- qiskit_ibm_runtime.fake_provider.FakeSingaporeV2.html
- qiskit_ibm_runtime.fake_provider.FakeSydney.html
- qiskit_ibm_runtime.fake_provider.FakeSydneyV2.html
- qiskit_ibm_runtime.fake_provider.FakeTenerife.html
- qiskit_ibm_runtime.fake_provider.FakeTokyo.html
- qiskit_ibm_runtime.fake_provider.FakeToronto.html
- qiskit_ibm_runtime.fake_provider.FakeTorontoV2.html
- qiskit_ibm_runtime.fake_provider.FakeValencia.html
- qiskit_ibm_runtime.fake_provider.FakeValenciaV2.html
- qiskit_ibm_runtime.fake_provider.FakeVigo.html
- qiskit_ibm_runtime.fake_provider.FakeVigoV2.html
- qiskit_ibm_runtime.fake_provider.FakeWashington.html
- qiskit_ibm_runtime.fake_provider.FakeWashingtonV2.html
- qiskit_ibm_runtime.fake_provider.FakeYorktown.html
- qiskit_ibm_runtime.fake_provider.FakeYorktownV2.html

</details>

Co-authored-by: Rebecca Dimock <66339736+beckykd@users.noreply.github.com>
…#1355)

This commit sets the use_symengine flag during qpy export used during
job payload generation if symengine is installed. For qiskit <1.0
symengine is a hard dependency on platforms that have support for it
(x86_64, aarch64, and ppc64le linux and macOS) and an optional
requirement on other qiskit supported platforms, and when available it
greatly improves the runtime performance of symbolic expressions in
Qiskit. By default QPY opts for the more compatible sympy representation
of an unbound ParameterExpression as it's maximally compatible, and
means that no matter the environment the payload will be loaded from it
will be able to parse the payload. In QPY version 10 a new flag was
added to the payload definition that enables users to use a native
binary symengine representation of a symbolic expression that is
significantly faster to generate and parse, but it still defaults to
sympy as using this flag limits the compatibility of the payload.
However, for runtime job submission we know that the service always has
symengine available so we should be using this flag for job submission
if the local environment has symengine installed as it will greatly
speed up the serialization of unbound ParameterExpression objects.

In Qiskit 1.0, symengine is promoted to a hard requriment for all
environments and use_symengine=True is the default in Qiskit's qpy
module. But, setting it like this is still a good idea as it will always
be safe to do this, it's just in qiskit 1.0 symengine will always be
installed.
* Run all unit tests

* Import fake providers

* Format

* Fake providers not used in this branch

* Unused import

---------

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
This resulted in the imports being called `qiskit_ibm_provider` rather than `qiskit_ibm_runtime`.

Co-authored-by: Frank Harkins <frankharkins@users.noreply.github.com>
* initial commit

* more replacements

* more replacements

* add auth/api

* add reno

* add qpy module back

* address comments

* fix docs build
* Copy pub/sub code into qiskit-ibm-runtime

* fix docs build
* Handle Qiskit 1.0 removals

* Remove removed qiskit modules

* add both qiskit synthesis imports

* fix docs build

* fix lint errors from 1.0.0RC1

* update basicaer import

* Update qiskit_ibm_runtime/fake_provider/fake_backend.py

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* address comments

* Update imports & docstrings

---------

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
* Move provider's session & remove qiskit-ibm-provider

* fix black
…skit#1377)

* Handle qpy serialization across versions and delete vendored fork

For the next qiskit-ibm-runtime release it is desired to have it support
both Qiskit 0.45.x/0.46.x and Qiskit 1.0.0. To do this with QPY it means
we need to emit a fixed qpy version of 10 as that's currently the
maximum version the server side can parse. The easiest way to manage
this across versions is actually to rely on Qiskit's qpy module again.
Starting in Qiskit 1.0.0 the qiskit.qpy.dump() function a new kwarg,
version exists to specify the version of qpy emitted. We can use this
to control the rollout of QPY format versions as the server side is
updated. For right now this is fixed to version 10 which is the same as
the QPY format version emitted by 0.45.x and 0.46.0. Because the
versions are the same we can just use qiskit's qpy module moving forward
as either we're on qiskit 0.45.x/0.46.x and will emit version 10 (as there
is no option) or we're on >=1.0.0 and we explicitly set the qpy version
to one that's compatible with the server side.

The qpy internals usage to serialize parameters and parameter
expressions are left in place (although expanded on to include Qiskit#1355 for
parameter expressions) as an alternative needs to be considered for
this. It is not a good idea to rely on qpy internals and explicitly
private functions to do partial serialization.

This commit also deletes the vendored fork as it's never been included
in a released version of qiskit-ibm-runtime and nothing is using it
anymore.

Related to: Qiskit#1375

* Fix lint

* Fix lint again
* Prepare release 0.19

* add reno stating compatibility
…ons.from_backend` for both `Backend versions` (Qiskit#1383)

* porting qiskit-ibm-provider/pull/787

* porting qiskit-ibm-provider/pull/787

* black

* oops

* monkey patch Qiskit/qiskit#11727

* black lynt

* mypy

---------

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
* Cast use_symengine input to a bool

This commit works around a bug in Qiskit 0.45.x, 0.46.0, and 1.0.0rc1
with the `use_symengine` flag on `qpy.dump()`. The dump function has a
bug when it receives a truthy value instead of a bool literal that it
will generate a corrupt qpy because of a mismatch between how the
encoding was processed (the encoding is incorrectly set to sympy in the
file header but uses symengine encoding in the actual body of the
circuit.  This is being fixed in Qiskit/qiskit#11730 for 1.0.0, and will
be backported to 0.46.1. But to ensure compatibility with 0.45.x, 0.46.0,
and 1.0.0rc1 while waiting for those releases we can workaround this by
just casting the value to a boolean.

* Fix mypy failures

* Mypy fixes again
@coveralls
Copy link

Pull Request Test Coverage Report for Build 7819826110

  • -266 of 749 (64.49%) changed or added relevant lines in 38 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.5%) to 79.369%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_ibm_runtime/api/clients/version.py 8 10 80.0%
qiskit_ibm_runtime/transpiler/passes/scheduling/dynamical_decoupling.py 3 5 60.0%
qiskit_ibm_runtime/ibm_qubit_properties.py 7 11 63.64%
qiskit_ibm_runtime/utils/json.py 5 9 55.56%
qiskit_ibm_runtime/fake_provider/fake_backend.py 2 8 25.0%
qiskit_ibm_runtime/transpiler/passes/scheduling/utils.py 47 53 88.68%
qiskit_ibm_runtime/provider_session.py 24 32 75.0%
qiskit_ibm_runtime/api/clients/base_websocket_client.py 101 115 87.83%
qiskit_ibm_runtime/api/rest/program_job.py 19 33 57.58%
qiskit_ibm_runtime/api/rest/root.py 15 31 48.39%
Totals Coverage Status
Change from base Build 7788033246: 0.5%
Covered Lines: 5659
Relevant Lines: 7130

💛 - Coveralls

@jyu00
Copy link
Collaborator Author

jyu00 commented Feb 7, 2024

I removed the -W sphinx flag since doc build was failing due to the experimental branch warning. I don't know how it worked before 🤔. So we'll need to remember to turn it back.

@jyu00 jyu00 requested a review from kt474 February 7, 2024 19:28
@kt474 kt474 merged commit 852479b into Qiskit:experimental-0.2 Feb 7, 2024
17 checks passed
@jyu00 jyu00 deleted the ff-experimental-0.2 branch February 12, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.