Skip to content

Commit

Permalink
Release 0.13.1 (#1983)
Browse files Browse the repository at this point in the history
* add skip Python 3.12 for GPU build (#1965)

* Fix basis gates of Aer backends (#1976)

* move reset and switch_case ops to custom istr

* Fix reset in AerStatevector

* add test case

* format

* fix installing built Aer in some test cases

* Applying global phase multiplication to initialize operation (#1980)

* Applying global phase to initialize operation

* fix format

* remove recursive, add omp

* Release 0.13.1

* Revert too many deprecations in Estimator (#1990)

* Revert too much deprecation

* fix typo

* fix tests

* Change priority of method selection of noise simulation (#1989)

* Avoid selecting stabilizer method when noise model contains rotational gates

* remove checking noise opsets, change priority selecting density_matrix

* format

* modify test cases use auto method result may change by this PR

* modify one more test case

* Remove use of opflow in Estimator (#1996)

* Update misspelling apply_gate method doc (#1998)

Co-authored-by: Jun Doi <doichan@jp.ibm.com>

* Add optimization_level=0 to transpiler for compiling dynamic circuits (#2000)

``id`` gate was removed by transpiler called from aer_compiler without optimization_level for dynamic circuits.
This commits adds ``optimization_level=0`` to avoid removing id gates

* fix ry gate for stabilizer (#2001)

Co-authored-by: Hiroshi Horii <hhorii@users.noreply.github.com>

* Directly use psutil to get total system memory (#2002)

Currently Aer is using Qiskit's local_hardware_info() function which to
determine the total amount of system memory which is used to compute the
largest statevector the system can build. However, this function wasn't
really intended to be used outside of Qiskit and also Qiskit is looking
to remove the memory reporting (see: Qiskit/qiskit#11254). This commit
just pivots to using psutil directly which is what qiskit is doing
internally.

* test build fix (#2004)

* Reverse ordering to read out error in sampling measure (#2003)

* reverse ordering of read out error in sampling measure

* fix batch check

---------

Co-authored-by: Hiroshi Horii <hhorii@users.noreply.github.com>

* Fix extended stabilizer thread safety in apply_ops_parallel (#1993)

* Extended stabilizer simulator no longer shares RngEngine amongst states when ops are applied in parallel

* Added release note

* Fixed ugly cast

---------

Co-authored-by: Jun Doi <doichan@jp.ibm.com>

* add note (#1992)

Co-authored-by: Jun Doi <doichan@jp.ibm.com>

* Fix AerBackend issues caused by upgrading BackendV2 (#1995)

* add description if no description is provided, build coupling map if it is provided

* move import line

* fix target for simulator backend

* format

* remove unused import

* use translation plugin to rebuild gate sets for simulator

* rename plugin

* rebuild of gate sets is eanbled only for opt level 0 and 1

* fix custom pass manager

* fix pass_manager function

* added ccx in NAME_MAPPING

* added missed gates in NAME_MAPPING

* added release note

* add check if opnodes is None

* add check config

* decrease return

* check opt level

* fix searching ops in control flow blocks

* Update qiskit_aer/backends/plugin/aer_backend_plugin.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Update qiskit_aer/backends/plugin/aer_backend_plugin.py

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* refer review comments

* remove unused import

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* add prelude

---------

Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Co-authored-by: jon <70080228+notcruz@users.noreply.github.com>
Co-authored-by: Hiroshi Horii <hhorii@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: eliotheinrich <38039898+eliotheinrich@users.noreply.github.com>
  • Loading branch information
7 people committed Nov 24, 2023
1 parent 2478a5b commit ea4f277
Show file tree
Hide file tree
Showing 47 changed files with 521 additions and 192 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
env:
CIBW_BEFORE_ALL: "yum install -y yum-utils wget && wget -q https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-rhel7-11-8-local-11.8.0_520.61.05-1.x86_64.rpm && rpm -i cuda-repo-rhel7-11-8-local-11.8.0_520.61.05-1.x86_64.rpm && yum clean all && yum -y install cuda && yum -y install openblas-devel && yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo && yum clean all"
CIBW_BEFORE_BUILD : "pip install nvidia-cuda-runtime-cu11 nvidia-cublas-cu11 nvidia-cusolver-cu11 nvidia-cusparse-cu11 cuquantum-cu11"
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* *musllinux*"
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* cp312* *musllinux*"
CIBW_ENVIRONMENT: QISKIT_AER_PACKAGE_NAME=qiskit-aer-gpu-cu11 QISKIT_AER_CUDA_MAJOR=11 CMAKE_VERBOSE_MAKEFILE=true AER_THRUST_BACKEND=CUDA CUDACXX=/usr/local/cuda/bin/nvcc AER_CUDA_ARCH="7.0 7.2 7.5 8.0 8.6 8.7" AER_PYTHON_CUDA_ROOT=/opt/_internal AER_CIBUILD=true
CIBW_REPAIR_WHEEL_COMMAND: 'auditwheel repair --exclude libcudart.so.11.0 --exclude libcustatevec.so.1 --exclude libcutensornet.so.2 --exclude libcutensor.so.1 --exclude libcutensorMg.so.1 --exclude libcusolver.so.11 --exclude libcusolverMg.so.11 --exclude libcusparse.so.11 --exclude libcublas.so.11 --exclude libcublasLt.so.11 -w {dest_dir} {wheel}'
run: |
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
env:
CIBW_BEFORE_ALL: "yum install -y yum-utils wget && wget -q https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda-repo-rhel7-12-2-local-12.2.2_535.104.05-1.x86_64.rpm && rpm -i cuda-repo-rhel7-12-2-local-12.2.2_535.104.05-1.x86_64.rpm && yum clean all && yum -y install nvidia-driver-latest-dkms && yum -y install cuda && yum -y install openblas-devel && yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo && yum clean all"
CIBW_BEFORE_BUILD : "pip install nvidia-cuda-runtime-cu12 nvidia-nvjitlink-cu12 nvidia-cublas-cu12 nvidia-cusolver-cu12 nvidia-cusparse-cu12 cuquantum-cu12"
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* *musllinux*"
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* cp312* *musllinux*"
CIBW_ENVIRONMENT: QISKIT_AER_PACKAGE_NAME=qiskit-aer-gpu QISKIT_AER_CUDA_MAJOR=12 CMAKE_VERBOSE_MAKEFILE=true AER_THRUST_BACKEND=CUDA CUDACXX=/usr/local/cuda/bin/nvcc AER_CUDA_ARCH="7.0 7.2 7.5 8.0 8.6 8.7 9.0" AER_PYTHON_CUDA_ROOT=/opt/_internal AER_CIBUILD=true
CIBW_REPAIR_WHEEL_COMMAND: 'auditwheel repair --exclude libcudart.so.12 --exclude libcustatevec.so.1 --exclude libcutensornet.so.2 --exclude libcutensor.so.1 --exclude libcutensorMg.so.1 --exclude libcusolver.so.11 --exclude libcusolverMg.so.11 --exclude libcusolver.so.12 --exclude libcusolverMg.so.12 --exclude libcusparse.so.12 --exclude libcublas.so.12 --exclude libcublasLt.so.12 --exclude libnvJitLink.so.12 -w {dest_dir} {wheel}'
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ jobs:
- name: Install Aer
run: |
set -e
python -I -m build --wheel --config-setting=--build-option=-- --config-setting=--build-option=-DTEST_JSON=1
pip install --find-links=dist qiskit-aer
python -I -m build --wheel --config-setting=--build-option=-DTEST_JSON=1
pip install -U dist/*.whl
- name: Run Tests
run: |
set -e
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
run: |
set -e
python -I -m build --wheel
pip install --find-links=dist qiskit-aer
pip install -U dist/*.whl
shell: bash
- name: Run Tests
env:
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
author = 'Qiskit Development Team'

# The short X.Y version
version = '0.13.0'
version = '0.13.1'
# The full version, including alpha/beta/rc tags
release = '0.13.0'
release = '0.13.1'

templates_path = ['_templates']

Expand Down
2 changes: 1 addition & 1 deletion qiskit_aer/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.0
0.13.1
4 changes: 3 additions & 1 deletion qiskit_aer/backends/aer_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ def compile(self, circuits, basis_gates=None, optypes=None):
circuit = self._inline_initialize(circuit, compiled_optypes[idx])
if self._is_dynamic(circuit, compiled_optypes[idx]):
compiled_circ = transpile(
self._inline_circuit(circuit, None, None), basis_gates=basis_gates
self._inline_circuit(circuit, None, None),
basis_gates=basis_gates,
optimization_level=0,
)
compiled_circuits.append(compiled_circ)
# Recompute optype for compiled circuit
Expand Down
35 changes: 31 additions & 4 deletions qiskit_aer/backends/aer_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ class AerSimulator(AerBackend):
"while_loop",
"break_loop",
"continue_loop",
"reset",
"switch_case",
]
),
"density_matrix": sorted(
Expand All @@ -538,6 +540,8 @@ class AerSimulator(AerBackend):
"while_loop",
"break_loop",
"continue_loop",
"reset",
"switch_case",
]
),
"matrix_product_state": sorted(
Expand All @@ -562,6 +566,8 @@ class AerSimulator(AerBackend):
"while_loop",
"break_loop",
"continue_loop",
"reset",
"switch_case",
]
),
"stabilizer": sorted(
Expand All @@ -583,6 +589,8 @@ class AerSimulator(AerBackend):
"while_loop",
"break_loop",
"continue_loop",
"reset",
"switch_case",
]
),
"extended_stabilizer": sorted(
Expand All @@ -591,13 +599,15 @@ class AerSimulator(AerBackend):
"qerror_loc",
"roerror",
"save_statevector",
"reset",
]
),
"unitary": sorted(
[
"save_state",
"save_unitary",
"set_unitary",
"reset",
]
),
"superop": sorted(
Expand All @@ -609,6 +619,7 @@ class AerSimulator(AerBackend):
"save_state",
"save_superop",
"set_superop",
"reset",
]
),
"tensor_network": sorted(
Expand All @@ -630,6 +641,8 @@ class AerSimulator(AerBackend):
"save_statevector_dict",
"set_statevector",
"set_density_matrix",
"reset",
"switch_case",
]
),
}
Expand Down Expand Up @@ -682,7 +695,9 @@ class AerSimulator(AerBackend):

_AVAILABLE_DEVICES = None

def __init__(self, configuration=None, properties=None, provider=None, **backend_options):
def __init__(
self, configuration=None, properties=None, provider=None, target=None, **backend_options
):
self._controller = aer_controller_execute()

# Update available methods and devices for class
Expand All @@ -704,7 +719,11 @@ def __init__(self, configuration=None, properties=None, provider=None, **backend
self._cached_basis_gates = self._BASIS_GATES["automatic"]

super().__init__(
configuration, properties=properties, provider=provider, backend_options=backend_options
configuration,
properties=properties,
provider=provider,
target=target,
backend_options=backend_options,
)

@classmethod
Expand Down Expand Up @@ -799,6 +818,11 @@ def _name(self):
def from_backend(cls, backend, **options):
"""Initialize simulator from backend."""
if isinstance(backend, BackendV2):
if backend.description is None:
description = "created by AerSimulator.from_backend"
else:
description = backend.description

configuration = QasmBackendConfiguration(
backend_name=f"'aer_simulator({backend.name})",
backend_version=backend.backend_version,
Expand All @@ -813,9 +837,10 @@ def from_backend(cls, backend, **options):
max_shots=int(1e6),
coupling_map=list(backend.coupling_map.get_edges()),
max_experiments=backend.max_circuits,
description=backend.description,
description=description,
)
properties = target_to_backend_properties(backend.target)
target = backend.target
elif isinstance(backend, BackendV1):
# Get configuration and properties from backend
configuration = copy.copy(backend.configuration())
Expand All @@ -824,6 +849,8 @@ def from_backend(cls, backend, **options):
# Customize configuration name
name = configuration.backend_name
configuration.backend_name = f"aer_simulator({name})"

target = None
else:
raise TypeError(
"The backend argument requires a BackendV2 or BackendV1 object, "
Expand All @@ -840,7 +867,7 @@ def from_backend(cls, backend, **options):
options["noise_model"] = noise_model

# Initialize simulator
sim = cls(configuration=configuration, properties=properties, **options)
sim = cls(configuration=configuration, properties=properties, target=target, **options)
return sim

def available_methods(self):
Expand Down
54 changes: 21 additions & 33 deletions qiskit_aer/backends/aerbackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from qiskit.pulse import Schedule, ScheduleBlock
from qiskit.qobj import QasmQobj, PulseQobj
from qiskit.result import Result
from qiskit.transpiler import CouplingMap
from ..aererror import AerError
from ..jobs import AerJob, AerJobSet, split_qobj
from ..noise.noise_model import NoiseModel, QuantumErrorLocation
Expand All @@ -48,7 +49,7 @@ class AerBackend(Backend, ABC):
"""Aer Backend class."""

def __init__(
self, configuration, properties=None, defaults=None, backend_options=None, provider=None
self, configuration, properties=None, provider=None, target=None, backend_options=None
):
"""Aer class for backends.
Expand All @@ -59,8 +60,8 @@ def __init__(
Args:
configuration (BackendConfiguration): backend configuration.
properties (BackendProperties or None): Optional, backend properties.
defaults (PulseDefaults or None): Optional, backend pulse defaults.
provider (Provider): Optional, provider responsible for this backend.
target (Target): initial target for backend
backend_options (dict or None): Optional set custom backend options.
Raises:
Expand All @@ -76,22 +77,24 @@ def __init__(
backend_version=configuration.backend_version,
)

# Initialize backend properties and pulse defaults.
# Initialize backend properties
self._properties = properties
self._defaults = defaults
self._configuration = configuration

# Custom option values for config, properties, and defaults
# Custom option values for config, properties
self._options_configuration = {}
self._options_defaults = {}
self._options_properties = {}
self._target = None
self._target = target
self._mapping = NAME_MAPPING

# Set options from backend_options dictionary
if backend_options is not None:
self.set_options(**backend_options)

# build coupling map
if self.configuration().coupling_map is not None:
self._coupling_map = CouplingMap(self.configuration().coupling_map)

def _convert_circuit_binds(self, circuit, binds, idx_map):
parameterizations = []

Expand Down Expand Up @@ -330,18 +333,6 @@ def properties(self):
setattr(properties, key, val)
return properties

def defaults(self):
"""Return the simulator backend pulse defaults.
Returns:
PulseDefaults: The backend pulse defaults or ``None`` if the
backend does not support pulse.
"""
defaults = copy.copy(self._defaults)
for key, val in self._options_defaults.items():
setattr(defaults, key, val)
return defaults

@property
def max_circuits(self):
if hasattr(self.configuration(), "max_experiments"):
Expand All @@ -351,17 +342,16 @@ def max_circuits(self):

@property
def target(self):
self._target = convert_to_target(
self.configuration(), self.properties(), self.defaults(), self._mapping
)
return self._target
if self._target is not None:
return self._target

return convert_to_target(self.configuration(), self.properties(), None, NAME_MAPPING)

def clear_options(self):
"""Reset the simulator options to default values."""
self._options = self._default_options()
self._options_configuration = {}
self._options_properties = {}
self._options_defaults = {}

def status(self):
"""Return backend status.
Expand Down Expand Up @@ -702,8 +692,6 @@ def set_option(self, key, value):
self._set_configuration_option(key, value)
elif hasattr(self._properties, key):
self._set_properties_option(key, value)
elif hasattr(self._defaults, key):
self._set_defaults_option(key, value)
else:
if not hasattr(self._options, key):
raise AerError(f"Invalid option {key}")
Expand Down Expand Up @@ -735,15 +723,15 @@ def _set_properties_option(self, key, value):
elif key in self._options_properties:
self._options_properties.pop(key)

def _set_defaults_option(self, key, value):
"""Special handling for setting backend defaults options."""
if value is not None:
self._options_defaults[key] = value
elif key in self._options_defaults:
self._options_defaults.pop(key)

def __repr__(self):
"""String representation of an AerBackend."""
name = self.__class__.__name__
display = f"'{self.name}'"
return f"{name}({display})"

def get_translation_stage_plugin(self):
"""use custom translation method to avoid gate exchange"""
if self._target is None:
return "aer_backend_plugin"
else:
return None
Loading

0 comments on commit ea4f277

Please sign in to comment.