Skip to content

Commit

Permalink
Merge branch 'main' into backendv2
Browse files Browse the repository at this point in the history
  • Loading branch information
doichanj authored Oct 20, 2023
2 parents 858794c + a13ff4e commit 945b320
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,4 @@ jobs:
rm -rf qiskit_aer
stestr run --slowest
shell: bash

54 changes: 54 additions & 0 deletions .github/workflows/unit-tests-latest-qiskit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Unit Tests for latest Qiskit
on:
schedule:
- cron: '0 5 * * *'
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
unit-tests-latest-qiskit:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
AER_THRUST_BACKEND: OMP
QISKIT_TEST_CAPTURE_STREAMS: 1
# Needed to suppress a warning in jupyter-core 5.x by eagerly migrating to
# a new internal interface that will be the default in jupyter-core 6.x.
# This variable should become redundant on release of jupyter-core 6.
JUPYTER_PLATFORM_DIRS: 1
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version}}-pip-test-${{ hashFiles('setup.py','requirements-dev.txt','constraints.txt') }}
restore-keys: |
${{ 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
run: |
python -m pip install -U .
- name: Run Tests
run: |
set -e
pip check
rm -rf qiskit_aer
stestr run --slowest
shell: bash

2 changes: 1 addition & 1 deletion qiskit_aer/backends/aer_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def _inline_for_loop_op(self, instruction, parent, bit_map):
continue_label = f"{loop_name}_{index}"
inlined_body = self._inline_circuit(body, continue_label, break_label, inner_bit_map)
if loop_parameter is not None:
inlined_body = inlined_body.bind_parameters({loop_parameter: index})
inlined_body = inlined_body.assign_parameters({loop_parameter: index})
parent.append(inlined_body, qargs, cargs)
parent.append(AerMark(continue_label, len(qargs), len(cargs)), qargs, cargs)

Expand Down
4 changes: 4 additions & 0 deletions qiskit_aer/backends/backend_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"mcx_gray",
"ecr",
"reset",
"switch_case",
]
),
"density_matrix": sorted(
Expand Down Expand Up @@ -151,6 +152,7 @@
"pauli",
"ecr",
"reset",
"switch_case",
]
),
"matrix_product_state": sorted(
Expand Down Expand Up @@ -194,6 +196,7 @@
"diagonal",
"initialize",
"reset",
"switch_case",
]
),
"stabilizer": sorted(
Expand All @@ -218,6 +221,7 @@
"rx",
"ry",
"rz",
"switch_case",
]
),
"extended_stabilizer": sorted(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
issues:
- |
Though Aer supports ``switch`` for several methods, transpilation of circuits with ``switch`` has been failed.
This commit enables such transpilation by adding ``switch_case`` operations into basis gates.
2 changes: 1 addition & 1 deletion test/benchmark/simulator_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def add_expval(base, num_terms):
param_binds = {}
for param in circuit.parameters:
param_binds[param] = np.random.random()
circuit = circuit.bind_parameters(param_binds)
circuit = circuit.assign_parameters(param_binds)

simulator = self.simulators[runtime]
if measure == self.MEASUREMENT_SAMPLING:
Expand Down
Loading

0 comments on commit 945b320

Please sign in to comment.