Skip to content

Commit

Permalink
Merge pull request #1239 from chriseclectic/backports-0.8.2
Browse files Browse the repository at this point in the history
Prepare 0.8.2 release
  • Loading branch information
chriseclectic authored Apr 29, 2021
2 parents bd69fcd + 488acd4 commit 629374c
Show file tree
Hide file tree
Showing 46 changed files with 1,999 additions and 561 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build
on:
push:
branches: [master, 'stable/*']
branches: [main, 'stable/*']
pull_request:
branches: [master, 'stable/*']
branches: [main, 'stable/*']
jobs:
standalone:
runs-on: ${{ matrix.os }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Docs and Tutorial
on:
push:
branches: [master, 'stable/*']
branches: [main, 'stable/*']
pull_request:
branches: [master, 'stable/*']
branches: [main, 'stable/*']
jobs:
docs:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_linux.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Tests Linux
on:
push:
branches: [master, 'stable/*']
branches: [main, 'stable/*']
pull_request:
branches: [master, 'stable/*']
branches: [main, 'stable/*']
jobs:
lint:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_mac.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Tests MacOS
on:
push:
branches: [master, 'stable/*']
branches: [main, 'stable/*']
pull_request:
branches: [master, 'stable/*']
branches: [main, 'stable/*']
jobs:
lint:
runs-on: macOS-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_windows.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Tests Windows
on:
push:
branches: [master, 'stable/*']
branches: [main, 'stable/*']
pull_request:
branches: [master, 'stable/*']
branches: [main, 'stable/*']
jobs:
lint:
runs-on: windows-latest
Expand Down
2 changes: 1 addition & 1 deletion BENCHMARKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ After the completion of the tests, you will see the results with a format simila
· Creating environments
· Discovering benchmarks
· Running 3 total benchmarks (1 commit * 1 environment * 3 benchmarks)
[ 0.00%] · For qiskit-aer commit 8b4f4de1 <master>:
[ 0.00%] · For qiskit-aer commit 8b4f4de1 <main>:
[ 0.00%] ·· Benchmarking conda-py3.7
[ 16.67%] ··· Running (quantum_volume_benchmarks.QuantumVolumeTimeSuite.time_quantum_volume--)..
[ 50.00%] ··· Running (simple_benchmarks.SimpleU3TimeSuite.time_simple_u3--).
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ previous version in the release notes.

### Branches

* `master`:
* `main`:

The master branch is used for development of the next version of qiskit-aer.
The main branch is used for development of the next version of qiskit-aer.
It will be updated frequently and should not be considered stable. The API
can and will change on master as we introduce and refine new features.
can and will change on main as we introduce and refine new features.

* `stable/*` branches:
Branches under `stable/*` are used to maintain released versions of qiskit-aer.
Expand All @@ -214,13 +214,13 @@ merged to it are bugfixes.
When it is time to release a new minor version of qiskit-aer, we will:

1. Create a new tag with the version number and push it to github
2. Change the `master` version to the next release version.
2. Change the `main` version to the next release version.

The release automation processes will be triggered by the new tag and perform
the following steps:

1. Create a stable branch for the new minor version from the release tag
on the `master` branch
on the `main` branch
2. Build and upload binary wheels to pypi
3. Create a GitHub release page with a generated changelog
4. Generate a PR on the meta-repository to bump the Aer version and
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '0.8.1'
release = '0.8.2'

# -- General configuration ---------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/aer/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.1
0.8.2
38 changes: 24 additions & 14 deletions qiskit/providers/aer/backends/aer_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ class AerSimulator(AerBackend):
'set_stabilizer'
]),
'extended_stabilizer': sorted([
'roerror', 'snapshot', 'save_statevector',
'save_expval', 'save_expval_var'
'roerror', 'snapshot', 'save_statevector'
]),
'unitary': sorted([
'snapshot', 'save_state', 'save_unitary', 'set_unitary'
Expand Down Expand Up @@ -471,6 +470,10 @@ def __init__(self,
configuration = QasmBackendConfiguration.from_dict(
AerSimulator._DEFAULT_CONFIGURATION)

# Cache basis gates since computing the intersection
# of noise model, method, and config gates is expensive.
self._cached_basis_gates = self._BASIS_GATES['automatic']

super().__init__(configuration,
properties=properties,
available_methods=AerSimulator._AVAILABLE_METHODS,
Expand Down Expand Up @@ -581,14 +584,14 @@ def configuration(self):
Returns:
BackendConfiguration: the configuration for the backend.
"""
config = copy.copy(self._configuration)
for key, val in self._options_configuration.items():
setattr(config, key, val)
# Update basis gates based on custom options, config, method,
# and noise model
basis_gates = self._basis_gates()
method = getattr(self.options, 'method', 'automatic')
custom_inst = self._CUSTOM_INSTR[method]
config = super().configuration()
config.custom_instructions = custom_inst
config.basis_gates = basis_gates + custom_inst
config.custom_instructions = self._CUSTOM_INSTR[
getattr(self.options, 'method', 'automatic')]
config.basis_gates = self._cached_basis_gates + config.custom_instructions
# Update simulator name
config.backend_name = self.name()
return config
Expand All @@ -606,9 +609,14 @@ def _execute(self, qobj):

def set_options(self, **fields):
out_options = {}
update_basis_gates = False
for key, value in fields.items():
if key == 'method':
self._set_method_config(value)
update_basis_gates = True
out_options[key] = value
elif key in ['noise_model', 'basis_gates']:
update_basis_gates = True
out_options[key] = value
elif key == 'device':
if value is not None and value not in self._AVAILABLE_DEVICES:
Expand All @@ -621,6 +629,8 @@ def set_options(self, **fields):
else:
out_options[key] = value
super().set_options(**out_options)
if update_basis_gates:
self._cached_basis_gates = self._basis_gates()

def _validate(self, qobj):
"""Semantic validations of the qobj which cannot be done via schemas.
Expand Down Expand Up @@ -652,15 +662,15 @@ def _basis_gates(self):
if 'basis_gates' in self._options_configuration:
return self._options_configuration['basis_gates']

# Set basis gates to be the intersection of config, method, and noise model
# basis gates
config_gates = self._configuration.basis_gates
basis_gates = set(config_gates)

# Compute intersection with method basis gates
method = getattr(self._options, 'method', 'automatic')
method_gates = self._BASIS_GATES[method]
basis_gates = basis_gates.intersection(method_gates)
config_gates = self._configuration.basis_gates
if config_gates:
basis_gates = set(config_gates).intersection(
method_gates)
else:
basis_gates = method_gates

# Compute intersection with noise model basis gates
noise_model = getattr(self.options, 'noise_model', None)
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/aer/backends/aerbackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def configuration(self):
# If config has custom instructions add them to
# basis gates to include them for the terra transpiler
if hasattr(config, 'custom_instructions'):
config.basis_gates += config.custom_instructions
config.basis_gates = config.basis_gates + config.custom_instructions
return config

def properties(self):
Expand Down
47 changes: 29 additions & 18 deletions qiskit/providers/aer/backends/qasm_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ def __init__(self,
else:
configuration.open_pulse = False

# Cache basis gates since computing the intersection
# of noise model, method, and config gates is expensive.
self._cached_basis_gates = self._DEFAULT_BASIS_GATES

super().__init__(configuration,
properties=properties,
available_methods=QasmSimulator._AVAILABLE_METHODS,
Expand Down Expand Up @@ -445,13 +449,13 @@ def configuration(self):
Returns:
BackendConfiguration: the configuration for the backend.
"""
config = copy.copy(self._configuration)
for key, val in self._options_configuration.items():
setattr(config, key, val)
# Update basis gates based on custom options, config, method,
# and noise model
basis_gates = self._basis_gates()
custom_inst = self._custom_instructions()
config = super().configuration()
config.custom_instructions = custom_inst
config.basis_gates = basis_gates + custom_inst
config.custom_instructions = self._custom_instructions()
config.basis_gates = self._cached_basis_gates + config.custom_instructions
return config

def _execute(self, qobj):
Expand All @@ -467,15 +471,22 @@ def _execute(self, qobj):

def set_options(self, **fields):
out_options = {}
update_basis_gates = False
for key, value in fields.items():
if key == 'method':
self._set_method_config(value)
update_basis_gates = True
out_options[key] = value
elif key in ['noise_model', 'basis_gates']:
update_basis_gates = True
out_options[key] = value
elif key == 'custom_instructions':
self._set_configuration_option(key, value)
else:
out_options[key] = value
super().set_options(**out_options)
if update_basis_gates:
self._cached_basis_gates = self._basis_gates()

def _validate(self, qobj):
"""Semantic validations of the qobj which cannot be done via schemas.
Expand Down Expand Up @@ -511,21 +522,22 @@ def _basis_gates(self):
if 'basis_gates' in self._options_configuration:
return self._options_configuration['basis_gates']

# Set basis gates to be the intersection of config, method, and noise model
# basis gates
# Compute intersection with method basis gates
method_gates = self._method_basis_gates()
config_gates = self._configuration.basis_gates
basis_gates = set(config_gates)
if self._options.noise_model:
noise_gates = self._options.noise_model.basis_gates
basis_gates = basis_gates.intersection(noise_gates)
if config_gates:
basis_gates = set(config_gates).intersection(
method_gates)
else:
noise_gates = None
basis_gates = method_gates

if self._options.method:
method_gates = self._method_basis_gates()
basis_gates = basis_gates.intersection(method_gates)
# Compute intersection with noise model basis gates
noise_model = getattr(self.options, 'noise_model', None)
if noise_model:
noise_gates = noise_model.basis_gates
basis_gates = basis_gates.intersection(noise_gates)
else:
method_gates = None
noise_gates = None

if not basis_gates:
logger.warning(
Expand Down Expand Up @@ -601,8 +613,7 @@ def _custom_instructions(self):
'set_stabilizer'
])
if method == 'extended_stabilizer':
return sorted(['roerror', 'snapshot', 'save_statevector',
'save_expval', 'save_expval_var'])
return sorted(['roerror', 'snapshot', 'save_statevector'])
return QasmSimulator._DEFAULT_CUSTOM_INSTR

def _set_method_config(self, method=None):
Expand Down
2 changes: 2 additions & 0 deletions qiskit/providers/aer/backends/unitary_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def _default_options(cls):
fusion_verbose=False,
fusion_max_qubit=5,
fusion_threshold=14,
blocking_qubits=None,
blocking_enable=False,
# statevector options
statevector_parallel_threshold=14)

Expand Down
4 changes: 2 additions & 2 deletions qiskit/providers/aer/library/instructions_table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
:class:`SaveAmplitudes`,✔,✔,✘,✔,✘,✘,✘,✘
:class:`SaveAmplitudesSquared`,✔,✔,✔,✔,✔,✘,✘,✘
:class:`SaveDensityMatrix`,✔,✔,✔,✔,✘,✘,✘,✘
:class:`SaveExpectationValue`,✔,✔,✔,✔,✔,,✘,✘
:class:`SaveExpectationValueVariance`,✔,✔,✔,✔,✔,,✘,✘
:class:`SaveExpectationValue`,✔,✔,✔,✔,✔,,✘,✘
:class:`SaveExpectationValueVariance`,✔,✔,✔,✔,✔,,✘,✘
:class:`SaveMatrixProductState`,✘,✘,✘,✔,✘,✘,✘,✘
:class:`SaveProbabilities`,✔,✔,✔,✔,✔,✘,✘,✘
:class:`SaveProbabilitiesDict`,✔,✔,✔,✔,✔,✘,✘,✘
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/aer/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _minimal_ext_cmd(cmd):

def git_version():
"""Get the current git head sha1."""
# Determine if we're at master
# Determine if we're at main
try:
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
git_revision = out.strip().decode('ascii')
Expand Down
9 changes: 9 additions & 0 deletions releasenotes/notes/basis-gates-perf-aba3fe10a154a19a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
fixes:
- |
Fixes performance issue with how the ``basis_gates`` configuration
attribute was set. Previously there were unintended side-effects to the
backend class which could cause repeated simulation runtime to
incrementally increase. Refer to
`#1229 <https://github.com/Qiskit/qiskit-aer/issues/1229>` for more
information and examples.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
Fixes a bug with the ``"multiplexer"`` simulator instruction where the
order of target and control qubits was reversed to the order in the
Qiskit instruction.
11 changes: 11 additions & 0 deletions releasenotes/notes/ext-stab-expval-b205dcf3a26707d4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
issues:
- |
The :class:`~qiskit.providers.aer.library.SaveExpectationValue` and
:class:`~qiskit.providers.aer.library.SaveExpectationValueVariance` have
been disabled for the `extended_stabilizer` method of the
:class:`~qiskit.providers.aer.QasmSimulator` and
:class:`~qiskit.providers.aer.AerSimulator` due to returning the
incorrect value for certain Pauli operator components. Refer to
`#1227 <https://github.com/Qiskit/qiskit-aer/issues/1227>` for more
information and examples.
5 changes: 5 additions & 0 deletions releasenotes/notes/fix-gpu-memory-cf50e1def7072f38.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
Fixes a bug introduced in 0.8.0 where GPU simulations would allocate
unneeded host memory in addition to the GPU memory.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
fixes:
- |
Fixes a bug in the ``stabilizer`` simulator method of the
:class:`~qiskit.providers.aer.QasmSimulator` and
:class:`~qiskit.providers.aer.AerSimulator` where the expectation value
for the ``save_expectation_value`` and ``snapshot_expectation_value``
could have the wrong sign for certain ``Y`` Pauli's.
Loading

0 comments on commit 629374c

Please sign in to comment.