diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 471ecfe0ee..a5efe586ee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -280,3 +280,4 @@ jobs: rm -rf qiskit_aer stestr run --slowest shell: bash + \ No newline at end of file diff --git a/.github/workflows/unit-tests-latest-qiskit.yml b/.github/workflows/unit-tests-latest-qiskit.yml new file mode 100644 index 0000000000..425538529c --- /dev/null +++ b/.github/workflows/unit-tests-latest-qiskit.yml @@ -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 + \ No newline at end of file diff --git a/qiskit_aer/backends/aer_compiler.py b/qiskit_aer/backends/aer_compiler.py index 70f7c051f1..d89eca1e87 100644 --- a/qiskit_aer/backends/aer_compiler.py +++ b/qiskit_aer/backends/aer_compiler.py @@ -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) diff --git a/test/benchmark/simulator_benchmark.py b/test/benchmark/simulator_benchmark.py index c7cd605486..bf1230a53f 100644 --- a/test/benchmark/simulator_benchmark.py +++ b/test/benchmark/simulator_benchmark.py @@ -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: diff --git a/test/terra/backends/aer_simulator/test_fusion.py b/test/terra/backends/aer_simulator/test_fusion.py index d2d5c42289..bf281e4324 100644 --- a/test/terra/backends/aer_simulator/test_fusion.py +++ b/test/terra/backends/aer_simulator/test_fusion.py @@ -485,7 +485,7 @@ def test_fusion_two_qubits(self): for param in circuit.parameters: param_binds[param] = np.random.random() - circuit = transpile(circuit.bind_parameters(param_binds), backend, optimization_level=0) + circuit = transpile(circuit.assign_parameters(param_binds), backend, optimization_level=0) backend_options = self.fusion_options(enabled=True, threshold=1) backend_options["fusion_verbose"] = True diff --git a/test/terra/backends/test_parameterized_qobj.py b/test/terra/backends/test_parameterized_qobj.py index 4ca2c809ca..e08c697ccf 100644 --- a/test/terra/backends/test_parameterized_qobj.py +++ b/test/terra/backends/test_parameterized_qobj.py @@ -355,7 +355,7 @@ def test_run_path_with_truncation(self): param_map = {theta: [0.1 * i for i in range(3)]} param_sets = [{theta: 0.1 * i} for i in range(3)] - resolved_circuits = [circuit.bind_parameters(param_set) for param_set in param_sets] + resolved_circuits = [circuit.assign_parameters(param_set) for param_set in param_sets] result = backend.run(circuit, parameter_binds=[param_map]).result() self.assertSuccess(result) @@ -480,7 +480,7 @@ def test_global_phase_parameters(self): circs = [] for v in [1, 2, 3]: - circs.append(circ.bind_parameters({theta: v})) + circs.append(circ.assign_parameters({theta: v})) expected = backend.run(circs, shots=10, seed_simulator=100).result() diff --git a/test/terra/backends/test_runtime_parameterization.py b/test/terra/backends/test_runtime_parameterization.py index 353d7178da..e2c8af659f 100644 --- a/test/terra/backends/test_runtime_parameterization.py +++ b/test/terra/backends/test_runtime_parameterization.py @@ -456,7 +456,7 @@ def test_run_path_with_truncation(self, method, device): param_map = {theta: [0.1 * i for i in range(3)]} param_sets = [{theta: 0.1 * i} for i in range(3)] - resolved_circuits = [circuit.bind_parameters(param_set) for param_set in param_sets] + resolved_circuits = [circuit.assign_parameters(param_set) for param_set in param_sets] result = backend.run( circuit, diff --git a/test/terra/primitives/test_estimator.py b/test/terra/primitives/test_estimator.py index 96c13cf59b..399ab43f5b 100644 --- a/test/terra/primitives/test_estimator.py +++ b/test/terra/primitives/test_estimator.py @@ -98,7 +98,7 @@ def test_estimator(self, abelian_grouping): @data(True, False) def test_init_observable_from_operator(self, abelian_grouping): """test for evaluate without parameters""" - circuit = self.ansatz.bind_parameters([0, 1, 1, 2, 3, 5]) + circuit = self.ansatz.assign_parameters([0, 1, 1, 2, 3, 5]) matrix = Operator( [ [-1.06365335, 0.0, 0.0, 0.1809312], @@ -138,7 +138,7 @@ def test_evaluate_multi_params(self, abelian_grouping): @data(True, False) def test_evaluate_no_params(self, abelian_grouping): """test for evaluate without parameters""" - circuit = self.ansatz.bind_parameters([0, 1, 1, 2, 3, 5]) + circuit = self.ansatz.assign_parameters([0, 1, 1, 2, 3, 5]) est = Estimator(abelian_grouping=abelian_grouping) result = est.run(circuit, self.observable, seed=15, shots=8192).result() self.assertIsInstance(result, EstimatorResult)