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

Prepare for Qiskit 1.0 #2047

Merged
merged 4 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
51 changes: 33 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,18 @@ jobs:
aer-test/bin/pip check
shell: bash
tests_linux:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
name: Linux Python ${{ matrix.python-version }}${{ matrix.qiskit-extra && format(' ({0})', matrix.qiskit-extra) }}
needs: [sdist, lint]
timeout-minutes: 60
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12.0"]
os: ["ubuntu-latest"]
qiskit-extra: [""]
include:
- python-version: "3.10"
qiskit-extra: "'qiskit>=1.0.0rc1'"

env:
AER_THRUST_BACKEND: OMP
QISKIT_TEST_CAPTURE_STREAMS: 1
Expand All @@ -116,17 +121,19 @@ jobs:
${{ runner.os }}-${{ matrix.python-version}}-pip-test-
${{ runner.os }}-${{ matrix.python-version}}-pip-
${{ runner.os }}-${{ matrix.python-version}}-
- name: Install Deps
run: python -m pip install -U -c constraints.txt -r requirements-dev.txt wheel
- name: Install openblas
run: |
set -e
sudo apt-get update
sudo apt-get install -y libopenblas-dev
shell: bash
- name: Install Aer
- name: Install Aer and dependencies
run: |
python -m pip install -U .
python -m pip install -U \
-c constraints.txt \
-r requirements-dev.txt \
${{ matrix.qiskit-extra }} \
.
- name: Run Tests
run: |
set -e
Expand Down Expand Up @@ -185,13 +192,13 @@ jobs:
stestr run --slowest
shell: bash
tests_macos:
runs-on: ${{ matrix.os }}
runs-on: macOS-latest
name: macOS Python ${{ matrix.python-version }}
needs: [sdist, lint]
timeout-minutes: 60
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", '3.11', "3.12.0"]
os: ["macOS-latest"]
env:
AER_THRUST_BACKEND: OMP
QISKIT_TEST_CAPTURE_STREAMS: 1
Expand All @@ -214,12 +221,13 @@ jobs:
${{ runner.os }}-${{ matrix.python-version}}-pip-test-
${{ runner.os }}-${{ matrix.python-version}}-pip-
${{ runner.os }}-${{ matrix.python-version}}-
- name: Install Deps
- name: Install Aer and dependencies
run: |
set -e
pip install -U -c constraints.txt -r requirements-dev.txt
- name: Install Aer
run: python -m pip install -U .
pip install -U \
-c constraints.txt \
-r requirements-dev.txt \
.
- name: Run Tests
run: |
set -e
Expand All @@ -228,13 +236,13 @@ jobs:
stestr run --slowest
shell: bash
tests_windows:
runs-on: ${{ matrix.os }}
runs-on: windows-2019
name: Windows Python ${{ matrix.python-version }}
needs: ["lint", "sdist"]
timeout-minutes: 60
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12.0"]
os: ["windows-2019"]
env:
AER_THRUST_BACKEND: OMP
QISKIT_TEST_CAPTURE_STREAMS: 1
Expand All @@ -259,15 +267,22 @@ jobs:
${{ runner.os }}-${{ matrix.python-version}}-
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Install Deps
run: python -m pip install -U -c constraints.txt -r requirements-dev.txt wheel build
- name: Install Aer Windows
- name: Build Aer Windows
env:
CMAKE_GENERATOR: "Visual Studio 16 2019"
run: |
set -e
pip install build
python -I -m build --wheel
pip install -U dist/*.whl
shell: bash
- name: Install Aer and dependencies
run: |
set -e
shopt -s failglob
pip install -U \
-c constraints.txt \
-r requirements-dev.txt \
dist/*.whl
shell: bash
- name: Run Tests
env:
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/unit-tests-latest-qiskit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,25 @@ jobs:
${{ runner.os }}-${{ matrix.python-version}}-pip-test-
${{ runner.os }}-${{ matrix.python-version}}-pip-
${{ runner.os }}-${{ matrix.python-version}}-
- name: Install Deps
run: |
python -m pip install -U -c constraints.txt -r requirements-dev.txt wheel
pip install -U git+https://github.com/Qiskit/qiskit.git
- name: Install openblas
run: |
set -e
sudo apt-get update
sudo apt-get install -y libopenblas-dev
shell: bash
- name: Install Aer
- name: Install dependencies and Aer
run: |
python -m pip install -U .
python -m pip install -U setuptools wheel
python -m pip install -U \
-c constraints.txt \
-r requirements-dev.txt \
'git+https://github.com/Qiskit/qiskit.git@main' \
.
- name: Run Tests
run: |
set -e
pip check
rm -rf qiskit_aer
stestr run --slowest
shell: bash


10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ $ python
```python
import qiskit
from qiskit_aer import AerSimulator
from qiskit.providers.fake_provider import FakeManilaV2
from qiskit_ibm_runtime import QiskitRuntimeService

# Generate 3-qubit GHZ state
circ = qiskit.QuantumCircuit(3)
Expand All @@ -73,10 +73,10 @@ counts_ideal = result_ideal.get_counts(0)
print('Counts(ideal):', counts_ideal)
# Counts(ideal): {'000': 493, '111': 531}

# Construct a noisy simulator backend from an IBMQ backend
# This simulator backend will be automatically configured
# using the device configuration and noise model
backend = FakeManilaV2()
# Construct a simulator using a noise model
# from a real backend.
provider = QiskitRuntimeService()
backend = provider.get_backend("ibm_kyoto")
aersim_backend = AerSimulator.from_backend(backend)

# Perform noisy simulation
Expand Down
54 changes: 0 additions & 54 deletions test/terra/backends/aer_simulator/test_from_backend.py
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted this file, because the only tests in it are circular logic - the old FakeBackend.run method also did this same thing, so the test wasn't doing much.

This file was deleted.

14 changes: 10 additions & 4 deletions test/terra/backends/aer_simulator/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
"""

from ddt import ddt, data
from qiskit import QuantumCircuit, transpile
from qiskit_aer.noise import NoiseModel
from test.terra.backends.simulator_test_case import SimulatorTestCase, supported_methods

import qiskit
from qiskit import QuantumCircuit, transpile
from qiskit.quantum_info.random import random_unitary
from qiskit.quantum_info import state_fidelity
from qiskit.providers.fake_provider import FakeMontreal

if qiskit.__version__.startswith("0."):
from qiskit.providers.fake_provider import FakeAlmaden as Fake20QV1
else:
from qiskit.providers.fake_provider import Fake20QV1

from qiskit_aer import AerSimulator

Expand Down Expand Up @@ -299,8 +305,8 @@ def test_statevector_memory(self):
def test_num_qubits(self, method):
"""Test number of qubits is correctly checked"""

num_qubits = FakeMontreal().configuration().num_qubits
backend = AerSimulator.from_backend(FakeMontreal(), method=method)
num_qubits = Fake20QV1().configuration().num_qubits
backend = AerSimulator.from_backend(Fake20QV1(), method=method)
self.assertGreaterEqual(backend.configuration().num_qubits, num_qubits)

def test_mps_svd_method(self):
Expand Down
11 changes: 9 additions & 2 deletions test/terra/backends/aer_simulator/test_truncate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@
AerSimulator Integration Tests
"""
from ddt import ddt

import qiskit
from qiskit import transpile, QuantumCircuit
from qiskit.providers.fake_provider import FakeQuito

if qiskit.__version__.startswith("0."):
from qiskit.providers.fake_provider import FakeQuito as Fake5QV1
else:
from qiskit.providers.fake_provider import Fake5QV1

from qiskit_aer.noise import NoiseModel
from test.terra.backends.simulator_test_case import SimulatorTestCase, supported_methods

Expand Down Expand Up @@ -46,7 +53,7 @@ def create_circuit_for_truncate(self):
return circuit

def device_backend(self):
return FakeQuito()
return Fake5QV1()

def test_truncate_ideal_sparse_circuit(self):
"""Test qubit truncation for large circuit with unused qubits."""
Expand Down
Loading
Loading