-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from zapatacomputing/zqs-1202-upgrade-qiskit
feat: upgraded qiskit to .38
- Loading branch information
Showing
7 changed files
with
71 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/orquestra/integrations/qiskit/testing/regenerate_pickled_files.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"""Every time the Qiskit version is updated, the pickled files need to be regenerated. | ||
This script regenerates the pickled files.""" | ||
|
||
import os | ||
import pickle | ||
|
||
from orquestra.quantum.circuits import CNOT, Circuit, X | ||
|
||
from orquestra.integrations.qiskit.backend import QiskitBackend | ||
|
||
token = "YOUR_TOKEN_HERE" | ||
file_path = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
|
||
def pickle_jobs_and_batches_with_different_qubits(): | ||
"""Create pickle file for jobs and batches with different qubits.""" | ||
|
||
# make orquestra circuit | ||
circuits = [Circuit([X(0), CNOT(0, 3), CNOT(1, 2)])] | ||
n_samples = 50 | ||
lima_backend = QiskitBackend("ibmq_lima", api_token=token) | ||
|
||
( | ||
experiments, | ||
n_samples_for_experiments, | ||
multiplicities, | ||
) = lima_backend.transform_circuitset_to_ibmq_experiments(circuits, [n_samples]) | ||
( | ||
batches, | ||
n_samples_for_batches, | ||
) = lima_backend.batch_experiments(experiments, n_samples_for_experiments) | ||
|
||
jobs = [ | ||
lima_backend.execute_with_retries(batch, n_samples) | ||
for n_samples, batch in zip(n_samples_for_batches, batches) | ||
] | ||
for job in jobs: | ||
job.result() | ||
|
||
with open( | ||
os.path.join(file_path, "jobs_and_batches_with_different_qubits.pickle"), "wb" | ||
) as f: | ||
pickle.dump(jobs, f) | ||
pickle.dump(batches, f) | ||
pickle.dump(multiplicities, f) | ||
|
||
|
||
if __name__ == "__main__": | ||
pickle_jobs_and_batches_with_different_qubits() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+238 KB
(180%)
tests/orquestra/integrations/qiskit/backend/jobs_and_batches_with_different_qubits.pickle
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters